By default, ansible stores its temporary files in `$HOME/.ansible/tmp`.
This causes many files to be created on target device's internal flash
memory on every ansible run (even if run with --check or if there are no
changes), wearing it unnecessarily.
This commit changes default remote_tmp location to a directory mounted
in RAM as tmpfs, so that the flash memory is not touched unless there is
actual change in device's configuration.
When copying, recent versions of ansible set the "checksum" field of the
json-payload for validation of the file after copy. As of now, we simply
ignore the parameter.
New set mode: set path=config match={} values={}
Find uci sections based on path and match, modify their
properties according to values.
# Modify settings for pre-existing wireless interface with device radio0.
- name: configure wireless
uci:
path: wireless
match:
device: radio0
type: wifi-iface
values:
ssid: myssid
encryption: psk2
key: "secret passphrase"
New op: get path=config[.section] [type=t] [match=m]
Used with register var x, outputs to x.result['values']
(x.result.values won't work.) This can be used for conditions
in subsequent tasks.
# See if there already exists a forwarding config with dest=myvpn and src=lan
- name: Get myvpn zone forwarding
uci: op=get path=firewall type=forwarding match="dest=myvpn src=lan"
register: myvpnfw
# Create the section if it doesn't exist
- name: Add myvpn zone forwarding
uci: autocommit=false path=firewall type=forwarding
when: not myvpnfw.result['values']
# Populate the section if it didn't exist
- name: Setup myvpn zone forwarding
uci: autocommit=false path=firewall.@forwarding[-1].{{ item.key }} value={{ item.value}}
with_dict:
dest: myvpn
src: lan
when: not myvpnfw.result['values']