This commit is contained in:
parent
8eee022005
commit
da57e58a3d
@ -7,6 +7,7 @@
|
|||||||
- hosts: all
|
- hosts: all
|
||||||
roles:
|
roles:
|
||||||
- common
|
- common
|
||||||
|
- docker
|
||||||
|
|
||||||
- hosts: docker2.t-juice.club
|
- hosts: docker2.t-juice.club
|
||||||
roles:
|
roles:
|
||||||
|
BIN
project/roles/docker/files/docker-archive-keyring.gpg
Normal file
BIN
project/roles/docker/files/docker-archive-keyring.gpg
Normal file
Binary file not shown.
82
project/roles/docker/files/docker-ce.repo
Normal file
82
project/roles/docker/files/docker-ce.repo
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
[docker-ce-stable]
|
||||||
|
name=Docker CE Stable - $basearch
|
||||||
|
baseurl=https://download.docker.com/linux/centos/7/$basearch/stable
|
||||||
|
enabled=1
|
||||||
|
gpgcheck=1
|
||||||
|
gpgkey=https://download.docker.com/linux/centos/gpg
|
||||||
|
|
||||||
|
[docker-ce-stable-debuginfo]
|
||||||
|
name=Docker CE Stable - Debuginfo $basearch
|
||||||
|
baseurl=https://download.docker.com/linux/centos/7/debug-$basearch/stable
|
||||||
|
enabled=0
|
||||||
|
gpgcheck=1
|
||||||
|
gpgkey=https://download.docker.com/linux/centos/gpg
|
||||||
|
|
||||||
|
[docker-ce-stable-source]
|
||||||
|
name=Docker CE Stable - Sources
|
||||||
|
baseurl=https://download.docker.com/linux/centos/7/source/stable
|
||||||
|
enabled=0
|
||||||
|
gpgcheck=1
|
||||||
|
gpgkey=https://download.docker.com/linux/centos/gpg
|
||||||
|
|
||||||
|
[docker-ce-edge]
|
||||||
|
name=Docker CE Edge - $basearch
|
||||||
|
baseurl=https://download.docker.com/linux/centos/7/$basearch/edge
|
||||||
|
enabled=0
|
||||||
|
gpgcheck=1
|
||||||
|
gpgkey=https://download.docker.com/linux/centos/gpg
|
||||||
|
|
||||||
|
[docker-ce-edge-debuginfo]
|
||||||
|
name=Docker CE Edge - Debuginfo $basearch
|
||||||
|
baseurl=https://download.docker.com/linux/centos/7/debug-$basearch/edge
|
||||||
|
enabled=0
|
||||||
|
gpgcheck=1
|
||||||
|
gpgkey=https://download.docker.com/linux/centos/gpg
|
||||||
|
|
||||||
|
[docker-ce-edge-source] [1/6021]name=Docker CE Edge - Sources
|
||||||
|
baseurl=https://download.docker.com/linux/centos/7/source/edge
|
||||||
|
enabled=0
|
||||||
|
gpgcheck=1
|
||||||
|
gpgkey=https://download.docker.com/linux/centos/gpg
|
||||||
|
|
||||||
|
[docker-ce-test]
|
||||||
|
name=Docker CE Test - $basearch
|
||||||
|
baseurl=https://download.docker.com/linux/centos/7/$basearch/test
|
||||||
|
enabled=0
|
||||||
|
gpgcheck=1
|
||||||
|
gpgkey=https://download.docker.com/linux/centos/gpg
|
||||||
|
|
||||||
|
[docker-ce-test-debuginfo]
|
||||||
|
name=Docker CE Test - Debuginfo $basearch
|
||||||
|
baseurl=https://download.docker.com/linux/centos/7/debug-$basearch/test
|
||||||
|
enabled=0
|
||||||
|
gpgcheck=1
|
||||||
|
gpgkey=https://download.docker.com/linux/centos/gpg
|
||||||
|
|
||||||
|
[docker-ce-test-source]
|
||||||
|
name=Docker CE Test - Sources
|
||||||
|
baseurl=https://download.docker.com/linux/centos/7/source/test
|
||||||
|
enabled=0
|
||||||
|
gpgcheck=1
|
||||||
|
gpgkey=https://download.docker.com/linux/centos/gpg
|
||||||
|
|
||||||
|
[docker-ce-nightly]
|
||||||
|
name=Docker CE Nightly - $basearch
|
||||||
|
baseurl=https://download.docker.com/linux/centos/7/$basearch/nightly
|
||||||
|
enabled=0
|
||||||
|
gpgcheck=1
|
||||||
|
gpgkey=https://download.docker.com/linux/centos/gpg
|
||||||
|
|
||||||
|
[docker-ce-nightly-debuginfo]
|
||||||
|
name=Docker CE Nightly - Debuginfo $basearch
|
||||||
|
baseurl=https://download.docker.com/linux/centos/7/debug-$basearch/nightly
|
||||||
|
enabled=0
|
||||||
|
gpgcheck=1
|
||||||
|
gpgkey=https://download.docker.com/linux/centos/gpg
|
||||||
|
|
||||||
|
[docker-ce-nightly-source]
|
||||||
|
name=Docker CE Nightly - Sources
|
||||||
|
baseurl=https://download.docker.com/linux/centos/7/source/nightly
|
||||||
|
enabled=0
|
||||||
|
gpgcheck=1
|
||||||
|
gpgkey=https://download.docker.com/linux/centos/gpg
|
1
project/roles/docker/files/docker.list
Normal file
1
project/roles/docker/files/docker.list
Normal file
@ -0,0 +1 @@
|
|||||||
|
deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian bullseye stable
|
14
project/roles/docker/tasks/main.yml
Normal file
14
project/roles/docker/tasks/main.yml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
- name: Install debian packages
|
||||||
|
import_tasks: packages_debian.yml
|
||||||
|
when: ansible_facts['os_family'] == 'Debian'
|
||||||
|
|
||||||
|
- name: Install rhel packages
|
||||||
|
import_tasks: packages_redhat.yml
|
||||||
|
when: ansible_facts['os_family'] == 'RedHat'
|
||||||
|
|
||||||
|
- name: Ensure service is started and enabled
|
||||||
|
ansible.builtin.systemd:
|
||||||
|
name: docker
|
||||||
|
state: started
|
||||||
|
enabled: yes
|
29
project/roles/docker/tasks/packages_debian.yml
Normal file
29
project/roles/docker/tasks/packages_debian.yml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
---
|
||||||
|
- name: Remove unwanted packages
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name:
|
||||||
|
- docker
|
||||||
|
- docker-engine
|
||||||
|
- docker.io
|
||||||
|
- containerd
|
||||||
|
- runc
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: Add docker repo signing key
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: docker-archive-keyring.gpg
|
||||||
|
dest: /usr/share/keyrings/docker-archive-keyring.gpg
|
||||||
|
|
||||||
|
- name: Add docker repo
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: docker.list
|
||||||
|
dest: /etc/apt/sources.list.d/docker.list
|
||||||
|
|
||||||
|
- name: Install docker packages
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name:
|
||||||
|
- docker-ce-cli
|
||||||
|
- docker-ce-rootless-extras
|
||||||
|
- docker-ce
|
||||||
|
- docker-scan-plugin
|
||||||
|
state: present
|
26
project/roles/docker/tasks/packages_redhat.yml
Normal file
26
project/roles/docker/tasks/packages_redhat.yml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
---
|
||||||
|
- name: Remove unwanted packages
|
||||||
|
ansible.builtin.yum:
|
||||||
|
name:
|
||||||
|
- docker
|
||||||
|
- docker-client
|
||||||
|
- docker-client-latest
|
||||||
|
- docker-common
|
||||||
|
- docker-latest
|
||||||
|
- docker-latest-logrotate
|
||||||
|
- docker-logrotate
|
||||||
|
- docker-engine
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: Add repo
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: docker-ce.repo
|
||||||
|
dest: /etc/yum.repos.d/docker-ce.repo
|
||||||
|
|
||||||
|
- name: Install packages
|
||||||
|
ansible.builtin.yum:
|
||||||
|
name:
|
||||||
|
- docker-ce
|
||||||
|
- docker-ce-cli
|
||||||
|
- docker-ce-rootless-extras
|
||||||
|
- docker-scan-plugin
|
Loading…
Reference in New Issue
Block a user