Ansible


Ansible supports docker and can read docker-compose files and, with some help, build the full stack. In comparison you can also create a playbook that configures a more traditional server for Docker. A simple example is below:

  • name: Make sure apt-transport-https is installed apt: pkg: “apt-transport-https” state: installed

  • name: Add Docker repository key apt_key: id: “36A1D7869245C8950F966E92D8576A8BA88D21E9” keyserver: “hkp://keyserver.ubuntu.com:80” state: present

  • name: Add Docker repository and update apt cache apt_repository: repo: “deb http://get.docker.io/ubuntu docker main” update_cache: yes state: present

  • name: Install lxc-docker apt: pkg: “lxc-docker” state: installed
  • name: Install pip apt: pkg: “” state: installed with_items:
    • python-dev
    • python-pip
  • name: Install Docker-py pip: name: docker-py

  • name: Make sure docker is running service: name: docker state: started Current configuration inspired by @jcalazan on Github.

Further exploration looks at using Ansible to create swarm clusters from bare servers, install docker, and then use it to deploy using your docker-compose file.