Skip to content

nickvth/dockerfile-ansible

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 

Repository files navigation

dockerfile-ansible

Tested with boot2docker on OSX and virtualbox with Centos

With this docker image you can create a temporary container to run ansible(-playbook), after ansible is finished the container will be removed automatically.

Usage

  • Pull
docker pull nickvth/dockerfile-ansible
  • Build
cd /tmp/
git clone https://github.com/nickvth/dockerfile-ansible.git 
cd dockerfile-ansible
docker build --force-rm=true --no-cache=true -t nickvth/dockerfile-ansible .
  • Create dir for ansible playbook and inventory file
mkdir -p /mnt/ansible
  • Create aliases on your linux based system and test ansible
alias ansible='docker run -it --rm=true -v /mnt/ansible:/mnt nickvth/dockerfile-ansible /usr/bin/ansible'
ansible --version
ansible --help
# Example
ansible -i hosts testansible -u root -m setup
alias ansible-playbook='docker run -it --rm=true -v /mnt/ansible:/mnt nickvth/dockerfile-ansible /usr/bin/ansible-playbook'
ansible-playbook --version
ansible-playbook --help
  • ssh-agent needed for ssh password and mount playbook inside the container
docker run -it --rm=true -v /mnt/ansible:/mnt nickvth/dockerfile-ansible /bin/sh /ssh-agent.sh
[root@9d2cfb509f0e /]#ansible --version

Set your alias in .bash_profile, so when you login the alias will be available

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages