July 2017
Intermediate to advanced
266 pages
6h 36m
English
Ansible's with_file operator provides us with a handy way to iterate over the contents of a file. This specific iterator operation provides us with a way to iterate over a single file or multiple files in order. To illustrate how this works, let's look at an example:
Hello There:
Bugs BunnyDaffy DuckMickey MouseDonald DuckWiley E. Coyote
# Example Playbook which Iterates Over the Contents of Two Files (iterator_file_contents.yml)---- name: Say hello to our favorite Looney Toons hosts: all tasks: - name: Say Hello to Our Favorite Looney Toons debug: msg: "{{ item }}" with_file: - hello.txt - favorite_toons.txt
From this example, we should ...
Read now
Unlock full access