docker/tasks/main.yml
vincent 02cd70a2ed
Some checks failed
continuous-integration/drone/push Build is failing
fix notify issue
2023-11-01 09:57:38 +01:00

50 lines
1.2 KiB
YAML

- name: Include OS-specific variables.
ansible.builtin.include_vars: "{{ ansible_os_family }}.yml"
- name: Add CentOS repository
when: ansible_os_family == "RedHat"
become: true
block:
- name: Add Docker repository.
ansible.builtin.get_url:
url: "https://download.docker.com/linux/centos/docker-ce.repo"
dest: '/etc/yum.repos.d/docker-ce.repo'
owner: root
group: root
mode: "0644"
- name: Install Docker.
ansible.builtin.package:
name: "{{ docker_package }}"
state: present
notify: restart docker
become: true
- name: Ensure /etc/docker exist
ansible.builtin.file:
dest: /etc/docker/
owner: root
group: root
mode: "0755"
state: directory
become: true
- name: Template daemon.json
ansible.builtin.template:
dest: /etc/docker/daemon.json
src: template/daemon.json.j2
mode: "0644"
notify: Restart docker
become: true
- name: Ensure Docker is started and enabled at boot.
ansible.builtin.service:
name: docker
state: "{{ docker_service_state }}"
enabled: "{{ docker_service_enabled }}"
become: true
- name: Include Users task
ansible.builtin.include_tasks: docker-users.yml
when: docker_users | length > 0