---
- name: Determine docker daemon DNS servers
vars:
_docker_daemon_dns: []
ansible.builtin.set_fact:
_docker_daemon_dns: "{{ _docker_daemon_dns + (item.value.dns | default([])) }}"
loop: "{{ skylab_networking | dict2items }}"
loop_control:
label: "{{ item.key }}"
- name: Create docker config directory
become: true
ansible.builtin.file:
path: /etc/docker
state: directory
owner: "{{ ansible_user }}"
group: docker
mode: 0750
- name: Configure docker daemon
ansible.builtin.template:
src: daemon.json.j2
dest: /etc/docker/daemon.json
mode: 0640
- name: Start and enable docker service
ansible.builtin.systemd:
name: docker
state: started
enabled: true
- name: Include access variables
ansible.builtin.include_vars:
file: vars/access.yaml
- name: Add administrators to docker group
when: item.admin | default(false) and 'cluster' in (item.targets | default([]))
ansible.builtin.user:
name: "{{ item.name }}"
group: "{{ item.name }}"
groups: docker
append: true
loop: "{{ skylab_accounts }}"
label: "{{ item.name }},{{ item.uid }}"
- name: Reset connection to get new group membership
ansible.builtin.meta: reset_connection