Add docker installation role
This commit is contained in:
parent
1fe4c617db
commit
89453cd53b
3 changed files with 69 additions and 0 deletions
47
roles/docker/tasks/Ubuntu.yml
Normal file
47
roles/docker/tasks/Ubuntu.yml
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
- name: Ensure requirements installed
|
||||||
|
ansible.builtin.package:
|
||||||
|
name: "{{ requisites }}"
|
||||||
|
state: present
|
||||||
|
update_cache: yes
|
||||||
|
tags:
|
||||||
|
- apt
|
||||||
|
- download
|
||||||
|
- packages
|
||||||
|
become: true
|
||||||
|
|
||||||
|
- name: Ensure docker GPG apt key exists
|
||||||
|
apt_key:
|
||||||
|
url: https://download.docker.com/linux/ubuntu/gpg
|
||||||
|
state: present
|
||||||
|
tags:
|
||||||
|
- apt
|
||||||
|
- repository
|
||||||
|
become: true
|
||||||
|
|
||||||
|
- name: Ensure docker repository exists
|
||||||
|
apt_repository:
|
||||||
|
repo: deb https://download.docker.com/linux/ubuntu focal stable
|
||||||
|
state: present
|
||||||
|
tags:
|
||||||
|
- apt
|
||||||
|
- repository
|
||||||
|
become: true
|
||||||
|
|
||||||
|
- name: Ensure latest docker-ce installed
|
||||||
|
ansible.builtin.package:
|
||||||
|
name: "{{ packages }}"
|
||||||
|
state: latest
|
||||||
|
tags:
|
||||||
|
- apt
|
||||||
|
- download
|
||||||
|
- packages
|
||||||
|
become: true
|
||||||
|
|
||||||
|
- name: Ensure docker module for python installed
|
||||||
|
pip:
|
||||||
|
name: docker
|
||||||
|
tags:
|
||||||
|
- pip
|
||||||
|
- python
|
||||||
|
- packages
|
||||||
|
become: true
|
||||||
11
roles/docker/tasks/main.yml
Normal file
11
roles/docker/tasks/main.yml
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
---
|
||||||
|
# Bring docker on the system and up to date
|
||||||
|
|
||||||
|
- name: "Select tasks for {{ ansible_distribution }} {{ ansible_distribution_major_version }}"
|
||||||
|
include_tasks: "{{ distribution }}"
|
||||||
|
with_first_found:
|
||||||
|
- "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml"
|
||||||
|
- "{{ ansible_distribution }}.yml"
|
||||||
|
- "{{ ansible_os_family }}.yml"
|
||||||
|
loop_control:
|
||||||
|
loop_var: distribution
|
||||||
11
roles/docker/vars/main.yml
Normal file
11
roles/docker/vars/main.yml
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
requisites:
|
||||||
|
- apt-transport-https
|
||||||
|
- ca-certificates
|
||||||
|
- curl
|
||||||
|
- software-properties-common
|
||||||
|
- python3-pip
|
||||||
|
- python3-setuptools
|
||||||
|
- virtualenv
|
||||||
|
|
||||||
|
packages:
|
||||||
|
- docker-ce
|
||||||
Loading…
Add table
Add a link
Reference in a new issue