NOTE: This state requires the augeas Python module.
Augeas can be used to manage configuration files. Currently only the set command is supported via this state. The augeas module also has support for get, match, remove, etc.
Examples:
Set the first entry in /etc/hosts to localhost:
hosts:
augeas.setvalue:
- changes:
- /files/etc/hosts/1/canonical: localhost
Add a new host to /etc/hosts with the IP address 192.168.1.1 and hostname test:
hosts:
augeas.setvalue:
- changes:
- /files/etc/hosts/2/ipaddr: 192.168.1.1
- /files/etc/hosts/2/canonical: foo.bar.com
- /files/etc/hosts/2/alias[1]: foosite
- /files/etc/hosts/2/alias[2]: foo
You can also set a prefix if you want to avoid redundancy:
nginx-conf:
augeas.setvalue:
- prefix: /files/etc/nginx/nginx.conf
- changes:
- user: www-data
- worker_processes: 2
- http/server_tokens: off
- http/keepalive_timeout: 65
Set a value for a specific augeas path