We are asking host-inventory file from source-control (GIT in this case). This will gives flexibility to developers for add/remove of containers and make them CI pipeline ready. This is equivalent to a list of applications hosted on Organization's server. Ansible will also install git along with performing other tasks.
Example of host inventory file:
Variables related to git login/project name/locations are stored at /group_vars/all.yaml file
Control machine: host-inventory file: /ansible/repo/hostNetwork Control machine: host-inventory for deletion of hosts file: /ansible/repo/hostNetwork_hostForDeletion Control machine: back-ups of host-inventory file: /ansible/repo/hostNetwork/backup File to read from reository is; repoRemoteFile: test.txt.
- role: role name is git.
- hosts: localhost = this tells that this playbook will not look for hosts-inventory rather it will get executed on this local machine. So yeah Ansible can run without a host-inventory file.
- Do not run this playbook in conjunction with other playbooks.
and
file: playbook.yaml
Directories:
* roles (need for input to playbook)
* group_vars (need for input to playbook)
* ansible (created on control machine for output by playbook)
* repo
* backup
ansible-playbook gitPlaybook.yaml -K
Where
-k
= ask for privilege escalation password.
This is what resulted at Control machine(localhost machine, where provisioning is being done).
host files lives here
The first Backup
The difference of Backups, so we can track what is changing b/w subsequent git pull.