Sign inSign up

leanstacks/ansible

By leanstacks

•Updated almost 8 years ago

An encapsulated Ansible execution environment. Acts as an Ansible control machine.

Image
0

307

leanstacks/ansible repository overview

⁠How to Use

⁠Volume

⁠Ansible Home

Location: /var/ansible_home

The Ansible Home volume allows you to mount your Ansible project to the Docker container. This maximizes the reuse of the Docker container, allowing it to work with any Ansible project without rebuilding the Docker image.

⁠Container

⁠Run

The Ansible Docker container needs an Ansible project to run. To maximize container reuse, the Ansible project source files are mounted to a container at runtime as a Docker Volume.

docker container run --rm \
  --interactive \
  --tty \
  --volume <Ansible Project Directory>:/var/ansible_home \
  leanstacks/ansible:latest

OR as a single line...

docker container run --rm -it -v <Ansible Project Directory>:/var/ansible_home leanstacks/ansible:latest
⁠Example: Mounting a Specific Path
docker container run --rm \
  --interactive \
  --tty \
  --volume /home/leanstacks/projects/my-ansible-project:/var/ansible_home \
  leanstacks/ansible:latest

OR as a single line...

docker container run --rm -it -v /home/leanstacks/projects/my-ansible-project:/var/ansible_home leanstacks/ansible:latest
⁠Example: Mounting the Current Directory

As an alternative to mounting an explicit path, you may choose to change your current directory to the Ansible project you wish to run. To start the Ansible Docker Container with the Ansible project files in the current directory, use this command.

docker container run --rm \
  --interactive \
  --tty \
  --volume $(pwd):/var/ansible_home \
  leanstacks/ansible:latest

OR as a single line...

docker container run --rm -it -v $(pwd):/var/ansible_home leanstacks/ansible:latest

See pwd⁠ for more information.

⁠Example: Running with AWS Credentials

Mounts an Ansible project and passes AWS credentials from a local machine AWS profile to the Docker container. The example illustrates using the default AWS profile, but any configured profile name may be substituted.

docker container run --rm \
  --interactive \
  --tty \
  --volume $(pwd)/ansible:/var/ansible_home \
  --env AWS_ACCESS_KEY_ID=$(aws --profile default configure get aws_access_key_id) \
  --env AWS_SECRET_ACCESS_KEY=$(aws --profile default configure get aws_secret_access_key) \
  leanstacks/ansible:latest

OR as a single line...

docker container run --rm -it -v $(pwd)/ansible:/var/ansible_home -e AWS_ACCESS_KEY_ID=$(aws --profile default configure get aws_access_key_id) -e AWS_SECRET_ACCESS_KEY=$(aws --profile default configure get aws_secret_access_key) leanstacks/ansible:latest

Tag summary

Content type

Image

Digest

Size

88.2 MB

Last updated

almost 8 years ago

docker pull leanstacks/ansible