Ansible by Michael Heap

Ansible by Michael Heap

Author:Michael Heap
Language: eng
Format: epub
Publisher: Apress, Berkeley, CA


This isn’t terribly useful, as you can just specify the value directly in the task. However, if the task uses the same value multiple times, it can be useful to make it a variable. A good example of this is the Apache2 package.

On Debian-based machines, the Apache2 configuration file lives at /etc/apache2/apache2.conf. On RedHat-based machines, the Apache2 configuration file lives at /etc/httpd/httpd.conf. Instead of providing apache2 or httpd multiple times, you can use a task-level variable, as follows:

---

- hosts: all

tasks:

- template: src=webserver.conf dest=”/etc/{{name}}/{{name}}.conf”

vars:

name: apache2



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.