# salt.states.augeas

## Configuration management using Augeas

New in version 0.17.0.

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.

Warning

Minimal installations of Debian and Ubuntu have been seen to have packaging bugs with python-augeas, causing the augeas module to fail to import. If the minion has the augeas module installed, and the state fails with a comment saying that the state is unavailable, first restart the salt-minion service. If the problem persists past that, the following command can be run from the master to determine what is causing the import to fail:

    salt minion-id cmd.run 'python -c "from augeas import Augeas"'

For affected Debian/Ubuntu hosts, installing `libpython2.7` has been known to resolve the issue.

Usage examples:

1. Set the first entry in `/etc/hosts` to `localhost`:

       hosts:
         augeas.setvalue:
           - changes:
             - /files/etc/hosts/1/canonical: localhost

2. 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

A prefix can also be set, 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

`salt.states.augeas.` `setvalue`(name, prefix=None, changes=None, **kwargs)

  Set a value for a specific augeas path

Current Salt release: 0.17.1

### Table Of Contents

- salt.states.augeas
  - Configuration management using Augeas

#### Previous topic

salt.states.apt

#### Next topic

salt.states.cmd

### Quick search

Enter search terms or a module, class or function name.

### Upcoming SaltStack Events

My conferences on Lanyrd