add docker role

This commit is contained in:
Ryan Cavicchioni 2022-08-30 07:46:19 -05:00
parent 149fff70a3
commit 8122bd25d7
Signed by: ryanc
GPG Key ID: 877EEDAF9245103D
8 changed files with 73 additions and 0 deletions

View File

@ -0,0 +1,11 @@
---
docker_package_name:
- docker-ce
- docker-ce-cli
- containerd.io
- docker-compose-plugin
docker_package_state: present
docker_service_name: docker.service
docker_service_state: started
docker_service_enabled: true

View File

@ -0,0 +1,13 @@
---
- name: install apt key
apt_key:
url: "https://download.docker.com/linux/{{ ansible_lsb.id | lower }}/gpg"
state: present
- name: install apt repo
apt_repository:
repo: >
deb [arch=amd64] https://download.docker.com/linux/{{ ansible_lsb.id | lower }}
{{ ansible_lsb.codename }}
stable
filename: docker

View File

@ -0,0 +1,9 @@
---
- name: install Docker CE yum repo
yum_repository:
name: docker-ce
description: Docker CE Stable - $basearch
baseurl: https://download.docker.com/linux/centos/$releasever/$basearch/stable
enabled: 1
gpgcheck: 1
gpgkey: https://download.docker.com/linux/centos/gpg

View File

@ -0,0 +1,6 @@
---
- name: manage service
service:
name: "{{ docker_service_name }}"
state: "{{ docker_service_state }}"
enabled: "{{ docker_service_enabled }}"

View File

@ -0,0 +1,6 @@
---
- name: install docker
package:
name: "{{ item }}"
state: "{{ docker_package_state }}"
loop: "{{ docker_package_name }}"

View File

@ -0,0 +1,28 @@
---
- name: gather os specific variables
include_vars: "{{ lookup('first_found', possible_files) }}"
vars:
possible_files:
files:
- "{{ ansible_distribution }}-{{ ansible_distribution_version }}.yaml"
- "{{ ansible_distribution }}.yaml"
- "{{ ansible_os_family }}.yaml"
- "default.yaml"
paths:
- vars
- name: include os specific tasks
include_tasks: "{{ lookup('first_found', possible_files) }}"
vars:
possible_files:
files:
- "{{ ansible_distribution }}-{{ ansible_distribution_version }}.yaml"
- "{{ ansible_distribution }}.yaml"
- "{{ ansible_os_family }}.yaml"
- "default.yaml"
paths:
- tasks
- include: install.yaml
- include: configure.yaml

View File

View File