Skip to content

omnys/docker-ansible

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

Docker with ansible

Inspired by: https://github.com/willhallonline/docker-ansible

An "ansible" user is created inside the container and used to execute commands. Change the "/home/user" path with your local environment.

Run in interactive mode

docker run  --rm -it \
    --mount type=bind,source="$(pwd)",target=/ansible \
    --mount type=bind,source=/home/user/.ssh,target=/home/ansible/.ssh \
    omnys/ansible:2.8.17.3 \
    bash

Run a playbook

docker run  --rm -it \
    --mount type=bind,source="$(pwd)",target=/ansible \
    --mount type=bind,source=/home/user/.ssh,target=/home/ansible/.ssh \
    omnys/ansible:2.8.17.3 \    
    ansible-playbook playbook.yml

Execute aws cli cmd from ansible

If you need to execute aws cli commands, and you want to load local aws profiles, add a custom mount:

... --mount type=bind,source=/home/user/.aws,target=/home/ansible/.aws ...

Share the ssh agent socket with the container

... --volume $SSH_AUTH_SOCK:/ssh-agent --env SSH_AUTH_SOCK=/ssh-agent ...

About

Docker image with ansible installed.

Resources

Stars

Watchers

Forks

Packages

No packages published