salt.modules.augeas_cfg

Manages configuration files via augeas

This module requires the augeas Python module.

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, but the functions in this execution module fail to run due to being 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.

salt.modules.augeas_cfg.execute(context=None, lens=None, commands=(), load_path=None)

Execute Augeas commands

New in version 2014.7.0.

CLI Example:

salt '*' augeas.execute /files/etc/redis/redis.conf \
commands='["set bind 0.0.0.0", "set maxmemory 1G"]'
context

The Augeas context

lens

The Augeas lens to use

commands

The Augeas commands to execute

New in version 2016.3.0.

load_path

A colon-spearated list of directories that modules should be searched in. This is in addition to the standard load path and the directories in AUGEAS_LENS_LIB.

salt.modules.augeas_cfg.get(path, value='', load_path=None)

Get a value for a specific augeas path

CLI Example:

salt '*' augeas.get /files/etc/hosts/1/ ipaddr
path

The path to get the value of

value

The optional value to get

New in version 2016.3.0.

load_path

A colon-spearated list of directories that modules should be searched in. This is in addition to the standard load path and the directories in AUGEAS_LENS_LIB.

salt.modules.augeas_cfg.ls(path, load_path=None)

List the direct children of a node

CLI Example:

salt '*' augeas.ls /files/etc/passwd
path

The path to list

New in version 2016.3.0.

load_path

A colon-spearated list of directories that modules should be searched in. This is in addition to the standard load path and the directories in AUGEAS_LENS_LIB.

salt.modules.augeas_cfg.match(path, value='', load_path=None)

Get matches for path expression

CLI Example:

salt '*' augeas.match /files/etc/services/service-name ssh
path

The path to match

value

The value to match on

New in version 2016.3.0.

load_path

A colon-spearated list of directories that modules should be searched in. This is in addition to the standard load path and the directories in AUGEAS_LENS_LIB.

salt.modules.augeas_cfg.remove(path, load_path=None)

Get matches for path expression

CLI Example:

salt '*' augeas.remove \
/files/etc/sysctl.conf/net.ipv4.conf.all.log_martians
path

The path to remove

New in version 2016.3.0.

load_path

A colon-spearated list of directories that modules should be searched in. This is in addition to the standard load path and the directories in AUGEAS_LENS_LIB.

salt.modules.augeas_cfg.setvalue(*args)

Set a value for a specific augeas path

CLI Example:

salt '*' augeas.setvalue /files/etc/hosts/1/canonical localhost

This will set the first entry in /etc/hosts to localhost

CLI Example:

salt '*' augeas.setvalue /files/etc/hosts/01/ipaddr 192.168.1.1 \
                         /files/etc/hosts/01/canonical test

Adds a new host to /etc/hosts the ip address 192.168.1.1 and hostname test

CLI Example:

salt '*' augeas.setvalue prefix=/files/etc/sudoers/ \
         "spec[user = '%wheel']/user" "%wheel" \
         "spec[user = '%wheel']/host_group/host" 'ALL' \
         "spec[user = '%wheel']/host_group/command[1]" 'ALL' \
         "spec[user = '%wheel']/host_group/command[1]/tag" 'PASSWD' \
         "spec[user = '%wheel']/host_group/command[2]" '/usr/bin/apt-get' \
         "spec[user = '%wheel']/host_group/command[2]/tag" NOPASSWD

Ensures that the following line is present in /etc/sudoers:

%wheel ALL = PASSWD : ALL , NOPASSWD : /usr/bin/apt-get , /usr/bin/aptitude

salt.modules.augeas_cfg.tree(path, load_path=None)

Returns recursively the complete tree of a node

CLI Example:

salt '*' augeas.tree /files/etc/
path

The base of the recursive listing

New in version 2016.3.0.

load_path

A colon-spearated list of directories that modules should be searched in. This is in addition to the standard load path and the directories in AUGEAS_LENS_LIB.

© 2021 SaltStack.
Licensed under the Apache License, Version 2.0.
https://docs.saltproject.io/en/latest/ref/modules/all/salt.modules.augeas_cfg.html