By | 3 septiembre, 2018

Instalar en Ubuntu 16.04 con Ansible docker engine y docker-compose.

- hosts: all
  become: true

  tasks:
    - name: ensure repository key is installed
      apt_key:
        id: "58118E89F3A912897C070ADBF76221572C52609D"
        keyserver: "hkp://p80.pool.sks-keyservers.net:80"
        state: present

    - name: ensure docker registry is available
      # Ubuntu 16.04 LTS
      apt_repository: repo='deb https://apt.dockerproject.org/repo ubuntu-xenial main' state=present

    - name: ensure docker and dependencies are installed
      apt: name={{ item }} update_cache=yes
      with_items:
        - docker-engine
        - docker-compose

    # To enable insecure registries with Docker
    #- name: ensure docker can use insecure registries in 10.1.0.0/16
    #  lineinfile: "dest=/etc/default/docker regexp=^DOCKER_OPTS line=DOCKER_OPTS='--insecure-registry 10.1.0.0/16'"

    # Optional if you are provisioning vagrant
    #- name: add vagrant to docker group
    #  user: name=vagrant groups=docker append=yes

    - service: name=docker state=restarted

Configuración de provision con Vagrant:

  config.vm.provision "ansible_local" do |ansible|
    ansible.playbook = "playbook.yml"
    ansible.compatibility_mode = "2.0"
  end

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *