build the container image with
docker build -t ansible:0.0.1 .
run ansible ping command against hosts defined in an inventory file, noting that
- the keys file needs to contain id_rsa file with appropriate permissions
- a known_hosts file needs to be present in the keys folder
#!/usr/bin/env bash
docker run -it --rm \
-v $(pwd)/keys:/root/.ssh \
-v $(pwd)/k3s-ansible:/root/k3s-ansible \
ansible:0.0.1 \
ansible all -i /root/ansible/inventory/my-cluster/hosts.ini -m ping