To enable ssh on each target:
sudo chmod +x start_ssh.sh
./start_ssh.sh
or
for container in dev prod qa; do
container_id=$(docker ps -qf "name=$container")
if [[ -n "$container_id" ]]; then
echo "✅ Container $container is active, starting ssh service..."
echo "$container_id"
docker exec "$container_id" service ssh start
else
echo "⚠️ Container $container is shutdown, skipping..."
fi
done
service ssh start
Check if the ssh is enable:
netstat -tlnp | grep :22
Run the master shell with the following command:
docker exec -it "$(docker ps -qf "name=master")" /bin/bash
ansible all -m ping -i inventory.ini
or if vault in configured
ansible all -m ping -i inventory.ini --ask-vault-pass
User & passwords are defined in the .docker/vm.dockerfile
, and configured in the ansible/inventory
.
If you have success message, it mean you are ready to go ! 🚀
User | Password |
---|---|
root | password |
ansible | ansible |
Encrypt files with ansible with the following command
ansible-vault encrypt group_vars/<your_file>.vault.yml
By default, for this playground, all files are encrypted with the password password
.
Inside the master
Run :
ansible-playbook playbooks/<playbook-name> -i inventory.ini
To run with the vault and vaulted vars
ansible-playbook playbooks/<playbook-name> -i inventory.ini --ask-vault-pass
To run with extra vars
ansible-playbook playbooks/<playbook-name> -i inventory.ini -e <key>=<value>