add docker role
This commit is contained in:
parent
149fff70a3
commit
8122bd25d7
11
roles/docker/defaults/main.yaml
Normal file
11
roles/docker/defaults/main.yaml
Normal 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
|
13
roles/docker/tasks/Debian.yaml
Normal file
13
roles/docker/tasks/Debian.yaml
Normal 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
|
9
roles/docker/tasks/RedHat.yaml
Normal file
9
roles/docker/tasks/RedHat.yaml
Normal 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
|
6
roles/docker/tasks/configure.yaml
Normal file
6
roles/docker/tasks/configure.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
- name: manage service
|
||||
service:
|
||||
name: "{{ docker_service_name }}"
|
||||
state: "{{ docker_service_state }}"
|
||||
enabled: "{{ docker_service_enabled }}"
|
6
roles/docker/tasks/install.yaml
Normal file
6
roles/docker/tasks/install.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
- name: install docker
|
||||
package:
|
||||
name: "{{ item }}"
|
||||
state: "{{ docker_package_state }}"
|
||||
loop: "{{ docker_package_name }}"
|
28
roles/docker/tasks/main.yaml
Normal file
28
roles/docker/tasks/main.yaml
Normal 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
|
0
roles/docker/vars/RedHat.yaml
Normal file
0
roles/docker/vars/RedHat.yaml
Normal file
0
roles/docker/vars/default.yaml
Normal file
0
roles/docker/vars/default.yaml
Normal file
Loading…
Reference in New Issue
Block a user