July 2017
Intermediate to advanced
402 pages
9h 38m
English
At the top level of our Ansible repository (two directories up from the helloworld role), we are going to create a new file called helloworld.yml. In it, we are going to add the following:
---
- hosts: "{{ target | default('localhost') }}"
become: yes
roles:
- helloworld
This basically tells Ansible to execute the role helloworld on to the hosts listed in the variable target or the localhost if the target isn't defined. The become option will tell Ansible to execute the role with elevated privileges (in our case sudo). At this point, your Ansible repository should look like this: http://bit.ly/2uPkROD. We are ready to test our playbook.
Note that in practice, on a bigger scale, the roles sections could include ...
Read now
Unlock full access