|
|
@ -3,25 +3,18 @@
|
|
|
|
# in addition to loop_with_items, the loop that works over a variable, ansible can do more sophisticated looping.
|
|
|
|
# in addition to loop_with_items, the loop that works over a variable, ansible can do more sophisticated looping.
|
|
|
|
|
|
|
|
|
|
|
|
# developer types: these are powered by 'lookup_plugins' should you ever decide to write your own
|
|
|
|
# developer types: these are powered by 'lookup_plugins' should you ever decide to write your own
|
|
|
|
# see lib/ansible/runner/lookup_plugins/fileglob.py
|
|
|
|
# see lib/ansible/runner/lookup_plugins/fileglob.py -- they can do basically anything!
|
|
|
|
|
|
|
|
|
|
|
|
- hosts: all
|
|
|
|
- hosts: all
|
|
|
|
gather_facts: False
|
|
|
|
gather_facts: False
|
|
|
|
|
|
|
|
|
|
|
|
tasks:
|
|
|
|
tasks:
|
|
|
|
|
|
|
|
|
|
|
|
# this will copy every file in /etc to the directory /tmp/fuzz
|
|
|
|
# this will copy a bunch of config files over -- dir must be created first
|
|
|
|
# note the directory must be created first
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- file: dest=/tmp/fuzz state=directory
|
|
|
|
- file: dest=/etc/fooapp state=directory
|
|
|
|
|
|
|
|
|
|
|
|
- copy: src=$item dest=/tmp/fuzz/
|
|
|
|
- copy: src=$item dest=/etc/fooapp/ owner=root mode=600
|
|
|
|
with_fileglob: /etc/*
|
|
|
|
with_fileglob: /playbooks/files/fooapp/*
|
|
|
|
|
|
|
|
|
|
|
|
# think about what other kinds of variables you would like to use in ansible. It's easy to write lookup
|
|
|
|
|
|
|
|
# plugins and the name of the plugin will make "with_(PLUGIN)" available for use in the task syntax.
|
|
|
|
|
|
|
|
# for instance, writing a plugin named "weather" would make "with_weather" available, and you could
|
|
|
|
|
|
|
|
# write a lookup plugin to query the weather forecast.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# note with_items and with_* are currently incompatible, and you can use only one of these per task.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|