March 2019
Intermediate to advanced
412 pages
9h 49m
English
The random filter is used to make a random selection from a sequence. Let's use this filter to delegate a task to a random selection from the db_servers group:
name: backup the database shell: mysqldump -u root nova > /data/nova.backup.sql delegate_to: "{{ groups['db_servers'] | random }}" run_once: true
Here, we can easily delegate this task to a single member of the db_servers group, picked at random using our filter.
Read now
Unlock full access