/poc-ansible

Testing Ansible in local environment with docker

Primary LanguageDockerfile

README

Description

  1. Run docker-compose to start the control, node1 and node2
make up
  1. Enter in the control container
make control
  1. Copy the ssh key to the nodes, the password is Password123
ssh-copy-id root@node1
ssh-copy-id root@node2
  1. Execute ping to the nodes to check if the connection is working
ansible -i inventory/docker_nodes all -m ping

Ansible commands in the control container

  • Install requirements
ansible-galaxy install -r requirements.yml
  • Run playbooks
ansible-playbook -i inventory/docker_nodes playbooks/playbook_name.yaml