Add docker role for making sure Docker is installed
Add a docker role for making sure Docker is installed from the Docker repositories. Take the role from the ccchh-ansible repo, provide attribution in the README and add the relevant license in a new licenses directory. Modify the role by removing the distribution check and adjusting the task names to be in line with other task names in this repo.
This commit is contained in:
7
playbooks/roles/docker/tasks/main.yaml
Normal file
7
playbooks/roles/docker/tasks/main.yaml
Normal file
@@ -0,0 +1,7 @@
|
||||
- name: Ensure the Docker repo is setup
|
||||
ansible.builtin.import_tasks:
|
||||
file: main/01_repo_setup.yaml
|
||||
|
||||
- name: Ensure Docker Engine and other related packages are installed
|
||||
ansible.builtin.import_tasks:
|
||||
file: main/02_docker_install.yaml
|
||||
15
playbooks/roles/docker/tasks/main/01_repo_setup.yaml
Normal file
15
playbooks/roles/docker/tasks/main/01_repo_setup.yaml
Normal file
@@ -0,0 +1,15 @@
|
||||
- name: Ensure Dockers GPG key is added
|
||||
ansible.builtin.get_url:
|
||||
url: https://download.docker.com/linux/debian/gpg
|
||||
dest: /etc/apt/trusted.gpg.d/docker.asc
|
||||
mode: "0644"
|
||||
owner: root
|
||||
group: root
|
||||
become: true
|
||||
|
||||
- name: Ensure Dockers APT repository is added
|
||||
ansible.builtin.apt_repository:
|
||||
repo: "deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/docker.asc] https://download.docker.com/linux/debian {{ ansible_distribution_release }} stable"
|
||||
filename: docker
|
||||
state: present
|
||||
become: true
|
||||
11
playbooks/roles/docker/tasks/main/02_docker_install.yaml
Normal file
11
playbooks/roles/docker/tasks/main/02_docker_install.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
- name: Ensure Docker Engine and other related packages are installed
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- docker-ce
|
||||
- docker-ce-cli
|
||||
- containerd.io
|
||||
- docker-buildx-plugin
|
||||
- docker-compose-plugin
|
||||
state: present
|
||||
update_cache: true
|
||||
become: true
|
||||
Reference in New Issue
Block a user