Test Ansible Playbooks on the Linux Execution Server
Before running the playbook in an App, it is recommended to test it manually. To do that, follow these steps:
-
On a Linux Execution Server machine, access the
/etc/ansible/ansible.cfg
file and uncomment the line:host_key_checking = False
Notes- At runtime, the Ansible driver creates a local
ansible.cfg
file and adds the above key. - In addition, this local
ansible.cfg
takes priority over all other config files. See this Ansible documentation page for details about Ansible config file hierarchies.
- At runtime, the Ansible driver creates a local
-
Create a folder that will be the root of your test. This folder will contain the Ansible playbook as well as any additional folders and files required by the playbook.
-
Add an inventory file with hosts and their groups (optional) for testing.
-
Add one or more playbook files.
noteIf you plan on using several playbook files in the App, make sure the main one is named site.yml.
-
(Optional) Add a "roles” folder.
-
(Optional) Populate it with the desired roles.
-
Test the playbook by running
ansible-playbook –i <InventoryFile> <MainPlaybookFile.yml>
. For some sample playbooks, see Ansible Playbook Examples. -
Once you are done developing your playbook, zip the playbook files along with the roles folder, upload it to a repository, and set the URL in the App template, as explained in Add the Playbook to an App.