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


  1. Creating Docker containers w/ Ansible Presented by: Roderick R. Randolph

  2. 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
  3. Agenda • Overview • Demo • NodeJS App • Jenkins

  4. None
  5. 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/
  6. Why Ansible? • Agentless • Simple, easy to use AND

    read • Powerful orchestration features • Highly extensible
  7. 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
  8. Why Ansible Container? • Shell scripting in Dockerfiles is bad

    • Reuse existing Ansible modules / roles • Orchestrate across containers • Idempotent
  9. 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
  10. 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
  11. Demo: Triple R Tracker

  12. 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
  13. 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
  14. 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/
  15. THANK YOU capitalone.ca/careers We're hiring! /roderickrandolph