This repository can be used to establish an integration between Ansible and a targeted server(s) and run Playbooks
.
cp ansible/hosts.sample ansible/hosts
vi ansible/hosts
docker build ansible -f=ansible/Dockerfile --tag=ansible:executor
docker-compose -f=ansible/docker-compose.yml up -d
docker exec -it ansible-executor bash
If desired, Playbooks
can be tested locally against the Testing Target
container before executing on remote servers. Build and spin up the container with the following commands.
docker build ansible -f=ansible/Dockerfile.testing-target --tag=ansible-testing-target
docker-compose -f=ansible/docker-compose.testing-target.yml up -d
The password for the root
user configured in the Testing Target
container is: password
With that information, the testing node can be added to the hosts
file as follows:
testing-target ansible_host=test
ansible all -m ping
ansible all -a "python3 --version"
- Make username and group values dynamic using variables within the
docker
playbook