Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Creating Docker containers with Ansible

Creating Docker containers with Ansible

Roderick Randolph

September 08, 2016
Tweet

More Decks by Roderick Randolph

Other Decks in Technology

Transcript

  1. Who am I • RRR • Capital One • DevOps

    • Amelia • Toronto Roderick R. Randolph Opinions expressed are solely my own and do not express the views or opinions of my employer. /roderickrandolph
  2. What is Ansible? Ansible is an IT automation tool. It

    can configure systems, deploy software, and orchestrate more advanced IT tasks such as continuous deployments or zero downtime rolling updates. http://docs.ansible.com/ansible/
  3. Why Ansible? • Agentless • Simple, easy to use AND

    read • Powerful orchestration features • Highly extensible
  4. What is Ansible Container? Ansible Container is an open source

    project that aims to enable the automation of the entire container build, deployment and management process. https://www.ansible.com/ansible-container
  5. Why Ansible Container? • Shell scripting in Dockerfiles is bad

    • Reuse existing Ansible modules / roles • Orchestrate across containers • Idempotent
  6. How does Ansible Container work? • Docker Compose • Version

    1.7.0 • Uses the Version 1 file format • Ansible Container Builder (Docker image) • Runs ansible-playbook from inside the container • Docker connection plugin (now available in Ansible 2.1) • Can be used outside of ansible-container
  7. Ansible Container features (as of 9/8/16) • Build containers •

    Run containers • Push containers to any Docker registry • Ship containers to a Docker cloud compatible platform • Google's Kubernetes • RedHat's OpenShift
  8. Ansible Container gotchas and tips! • SSH is not required

    • Python is required to run Ansible in containers • Ansible's raw module can be used to install Python into the container • Don't mix container-managed playbooks with server-managed playbooks • Use Ansible roles to share tasks between playbooks • Ansible Galaxy roles must be installed next to the playbook vs. in the global default directory (i.e. /etc/ansible/roles) • E.g. ansible-galaxy install <role> -p ansible/roles • Use --flatten to reduce image size • Docker-in-Docker and Ansible Container don't play well together
  9. Upcoming 0.2.0 features (eta: early Oct '16) •Build Cache •Naming

    and tagging images •Template rendering in container.yml •Custom build variables and volumes •And more… https://docs.ansible.com/ansible-container/roadmaps/roadmap_0_2_0.html
  10. Resources • Ansible Container GitHub: • https://github.com/ansible/ansible-container • Ansible Container

    Docs: • https://docs.ansible.com/ansible-container/ • https://www.ansible.com/blog/ansible-container-project • Demo: • http://goo.gl/DkTddK • Jenkins Pipeline: • https://jenkins.io/doc/pipeline/