Instalar Docker con Ansible

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

- hosts: all
  become: true

    - name: ensure repository key is installed
        id: "58118E89F3A912897C070ADBF76221572C52609D"
        keyserver: "hkp://"
        state: present

    - name: ensure docker registry is available
      # Ubuntu 16.04 LTS
      apt_repository: repo='deb ubuntu-xenial main' state=present

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

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

    # 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"

Leave a Reply




WordPress Anti-Spam by WP-SpamShield