-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
199 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ galaxy_info: | |
- name: EL | ||
versions: | ||
- 7 | ||
- 8 | ||
|
||
galaxy_tags: | ||
- docker | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
- name: Install Docker Compose | ||
pip: | ||
name: docker-compose | ||
version: "{{ docker_compose_version }}" | ||
state: present | ||
executable: "{{ docker_os_dict.pip }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
- name: Install Docker SDK | ||
pip: | ||
name: docker | ||
version: "{{ docker_sdk_version }}" | ||
state: present | ||
executable: "{{ docker_os_dict.pip }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
--- | ||
|
||
# https://docs.docker.com/install/linux/docker-ce/ubuntu/ | ||
- name: Ubuntu support | ||
when: ansible_distribution == 'Ubuntu' | ||
block: | ||
|
||
- name: Uninstall old packages | ||
apt: | ||
name: | ||
- docker | ||
- docker-engine | ||
- docker.io | ||
- containerd | ||
- runc | ||
state: absent | ||
|
||
- name: Install dependencies | ||
apt: | ||
name: | ||
- apt-transport-https | ||
- ca-certificates | ||
- gnupg-agent | ||
- software-properties-common | ||
state: present | ||
update_cache: yes | ||
|
||
- name: Add key | ||
apt_key: | ||
url: https://download.docker.com/linux/ubuntu/gpg | ||
id: "{{ docker_apt_gpg_key_id }}" | ||
state: present | ||
|
||
- name: Add repository | ||
apt_repository: | ||
repo: "deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable" | ||
state: present | ||
|
||
- name: Install Docker CE | ||
apt: | ||
name: | ||
- docker-ce | ||
- docker-ce-cli | ||
- containerd.io | ||
state: present | ||
update_cache: yes | ||
|
||
|
||
# https://docs.docker.com/install/linux/docker-ce/centos/ | ||
- name: CentOS support | ||
when: ansible_distribution == 'CentOS' | ||
block: | ||
|
||
- name: Uninstall old packages | ||
yum: | ||
name: | ||
- docker | ||
- docker-client | ||
- docker-client-latest | ||
- docker-common | ||
- docker-latest | ||
- docker-latest-logrotate | ||
- docker-logrotate | ||
- docker-engine | ||
state: absent | ||
|
||
- name: Install dependencies | ||
yum: | ||
name: | ||
- yum-utils | ||
- device-mapper-persistent-data | ||
- lvm2 | ||
state: present | ||
update_cache: yes | ||
|
||
- name: Add repository | ||
yum_repository: | ||
name: docker-ce | ||
description: Docker CE Stable | ||
baseurl: "https://download.docker.com/linux/centos/{{ ansible_distribution_major_version }}/{{ ansible_architecture }}/stable" | ||
enabled: yes | ||
gpgkey: https://download.docker.com/linux/centos/gpg | ||
gpgcheck: yes | ||
state: present | ||
|
||
- name: Install Docker CE | ||
yum: | ||
name: | ||
- docker-ce | ||
- docker-ce-cli | ||
- containerd.io | ||
state: present | ||
update_cache: yes | ||
|
||
- name: Enable Docker | ||
service: | ||
name: docker | ||
state: started | ||
enabled: yes | ||
ignore_errors: yes | ||
|
||
- name: Flush handlers | ||
meta: flush_handlers | ||
|
||
- name: Add user to docker group | ||
user: | ||
name: "{{ docker_user | default(ansible_user_id) }}" | ||
groups: docker | ||
append: yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,138 +1,19 @@ | ||
--- | ||
- name: "Update pip" | ||
pip: | ||
name: pip | ||
version: "{{ pip_version }}" | ||
extra_args: --upgrade | ||
- name: Set facts | ||
set_fact: | ||
docker_os_dict: "{{ docker_os_dicts[ansible_distribution + '_' + ansible_distribution_major_version] }}" | ||
|
||
# https://docs.docker.com/install/linux/docker-ce/ubuntu/ | ||
- name: Install Docker CE on Ubuntu | ||
when: ansible_distribution == 'Ubuntu' | ||
block: | ||
- name: Install Docker CE | ||
include_tasks: install-docker.yml | ||
|
||
- name: Uninstall old packages | ||
apt: | ||
name: | ||
- docker | ||
- docker-engine | ||
- docker.io | ||
- containerd | ||
- runc | ||
state: absent | ||
|
||
- name: Double-check dependencies | ||
apt: | ||
name: | ||
- apt-transport-https | ||
- ca-certificates | ||
- gnupg-agent | ||
- software-properties-common | ||
# Below are for Docker Compose | ||
- build-essential | ||
- libssl-dev | ||
- libffi-dev | ||
- python-dev | ||
state: present | ||
update_cache: yes | ||
|
||
- name: Add key | ||
apt_key: | ||
url: https://download.docker.com/linux/ubuntu/gpg | ||
id: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88 | ||
state: present | ||
|
||
- name: Add repository | ||
apt_repository: | ||
repo: "deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable" | ||
state: present | ||
|
||
- name: Install Docker CE | ||
apt: | ||
name: | ||
- docker-ce | ||
- docker-ce-cli | ||
- containerd.io | ||
state: present | ||
update_cache: yes | ||
|
||
|
||
# https://docs.docker.com/install/linux/docker-ce/centos/ | ||
- name: Install Docker CE on CentOS | ||
when: ansible_distribution == 'CentOS' | ||
block: | ||
|
||
- name: Uninstall old packages | ||
yum: | ||
name: | ||
- docker | ||
- docker-client | ||
- docker-client-latest | ||
- docker-common | ||
- docker-latest | ||
- docker-latest-logrotate | ||
- docker-logrotate | ||
- docker-engine | ||
state: absent | ||
|
||
- name: Double-check dependencies | ||
yum: | ||
name: | ||
- yum-utils | ||
- device-mapper-persistent-data | ||
- lvm2 | ||
# Below are for Docker compose | ||
- gcc | ||
- libffi-devel | ||
- python-devel | ||
- openssl-devel | ||
state: present | ||
update_cache: yes | ||
|
||
- name: Add repository | ||
yum_repository: | ||
name: docker-ce | ||
description: Docker CE Stable | ||
baseurl: "https://download.docker.com/linux/centos/{{ ansible_distribution_major_version }}/{{ ansible_architecture }}/stable" | ||
enabled: yes | ||
gpgkey: https://download.docker.com/linux/centos/gpg | ||
gpgcheck: yes | ||
state: present | ||
|
||
- name: Install Docker CE | ||
yum: | ||
name: | ||
- docker-ce | ||
- docker-ce-cli | ||
- containerd.io | ||
state: present | ||
update_cache: yes | ||
|
||
- name: Enable Docker | ||
service: | ||
name: docker | ||
state: started | ||
enabled: yes | ||
ignore_errors: yes | ||
|
||
- name: Flush handlers | ||
meta: flush_handlers | ||
- name: Prepare Python | ||
include_tasks: prepare-python.yml | ||
when: docker_sdk_version != false or docker_compose_version != false | ||
|
||
- name: Install Docker SDK | ||
pip: | ||
name: docker | ||
version: "{{ docker_sdk_version }}" | ||
state: present | ||
include_tasks: install-docker-sdk.yml | ||
when: docker_sdk_version != false | ||
|
||
- name: Install Docker Compose | ||
pip: | ||
name: docker-compose | ||
version: "{{ docker_compose_version }}" | ||
state: present | ||
include_tasks: install-docker-compose.yml | ||
when: docker_compose_version != false | ||
|
||
- name: Add user to docker group | ||
user: | ||
name: "{{ docker_user | default(ansible_user_id) }}" | ||
groups: docker | ||
append: yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
|
||
- name: Ubuntu support | ||
when: ansible_distribution == 'Ubuntu' | ||
block: | ||
|
||
- name: Install dependencies | ||
apt: | ||
name: | ||
- build-essential | ||
- libssl-dev | ||
- libffi-dev | ||
- "{{ docker_os_dict.python_dev }}" | ||
state: present | ||
update_cache: yes | ||
|
||
- name: CentOS support | ||
when: ansible_distribution == 'CentOS' | ||
block: | ||
|
||
- name: Install dependencies | ||
yum: | ||
name: | ||
- gcc | ||
- libffi-devel | ||
- openssl-devel | ||
- "{{ docker_os_dict.python_dev }}" | ||
state: present | ||
update_cache: yes | ||
|
||
|
||
- name: Update pip | ||
pip: | ||
name: pip | ||
version: "{{ pip_version }}" | ||
extra_args: --upgrade | ||
executable: "{{ docker_os_dict.pip }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
docker_apt_gpg_key_id: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88 | ||
|
||
docker_os_dicts: | ||
Ubuntu_16: | ||
pip: pip | ||
python_dev: python-dev | ||
Ubuntu_18: | ||
pip: pip | ||
python_dev: python-dev | ||
Ubuntu_20: | ||
pip: pip3 | ||
python_dev: python3-dev | ||
|
||
CentOS_7: | ||
pip: pip | ||
python_dev: python-devel | ||
CentOS_8: | ||
pip: pip3 | ||
python_dev: python3-devel |