main.yml 920 Bytes
Newer Older
1
---
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
- name: create docker config dir
  file:
    state: directory
    path: /etc/docker
    owner: root
    mode: 0750

- name: configure Docker default network
  copy:
    src: daemon.json
    dest: /etc/docker/daemon.json
    mode: 0644
    owner: root
  notify: Docker restart

- name: create Docker service config directory
  file:
    state: directory
    path: /etc/systemd/system/docker.service.d/
    mode: 0755
    owner: root

- name: configure http proxy for Docker daemon
  copy:
     src: http-proxy.conf
     dest: /etc/systemd/system/docker.service.d/http-proxy.conf
     mode: 0644
     owner: root
  notify: Docker restart

- name: start and enable docker daemon now that it is configured
  service:
    name: docker
    state: started
    enabled: yes

- name: create user docker
  user:
    create_home: yes
    home: /docker
    group: docker
    name: docker
    shell: /bin/bash
    state: present