Skip to content

Latest commit

 

History

24 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

docker-ansible

This repository provides a minimal setup to run Ansible playbooks from inside a Docker container.

Contents

  • Dockerfile: builds an image based on ubuntu:latest with ansible, openssh-client, and sshpass installed. The container copies playbook.yml and inventory and runs ansible-playbook by default using --ask-pass.
  • playbook.yml: a simple playbook that:
    • checks whether a reboot is required and performs it if necessary,
    • runs apt autoremove to remove no-longer-needed packages.
  • inventory: a hosts list (expected next to playbook.yml inside the container).

Usage

  1. Build the Docker image:
docker build -t docker-ansible .
  1. Run the container (you will be prompted for the SSH password):
docker run --rm -it \
  -v "$PWD/playbook.yml:/ansible/playbook.yml:ro" \
  -v "$PWD/inventory:/ansible/inventory:ro" \
  docker-ansible

About

This is a repository for a Docker image based on Ansible.

Resources

Stars

1 star

Watchers

0 watching

Forks

Packages

Used by

Contributors

Languages