Add Docker role from Ansible Galaxy
parent
560ae2aba7
commit
3ed115b410
|
@ -0,0 +1,3 @@
|
||||||
|
skip_list:
|
||||||
|
- '306'
|
||||||
|
- '106'
|
|
@ -0,0 +1,4 @@
|
||||||
|
# These are supported funding model platforms
|
||||||
|
---
|
||||||
|
github: geerlingguy
|
||||||
|
patreon: geerlingguy
|
|
@ -0,0 +1,56 @@
|
||||||
|
# Configuration for probot-stale - https://github.com/probot/stale
|
||||||
|
---
|
||||||
|
# Number of days of inactivity before an Issue or Pull Request becomes stale
|
||||||
|
daysUntilStale: 90
|
||||||
|
|
||||||
|
# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
|
||||||
|
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
|
||||||
|
daysUntilClose: 30
|
||||||
|
|
||||||
|
# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled)
|
||||||
|
onlyLabels: []
|
||||||
|
|
||||||
|
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
|
||||||
|
exemptLabels:
|
||||||
|
- pinned
|
||||||
|
- security
|
||||||
|
- planned
|
||||||
|
|
||||||
|
# Set to true to ignore issues in a project (defaults to false)
|
||||||
|
exemptProjects: false
|
||||||
|
|
||||||
|
# Set to true to ignore issues in a milestone (defaults to false)
|
||||||
|
exemptMilestones: false
|
||||||
|
|
||||||
|
# Set to true to ignore issues with an assignee (defaults to false)
|
||||||
|
exemptAssignees: false
|
||||||
|
|
||||||
|
# Label to use when marking as stale
|
||||||
|
staleLabel: stale
|
||||||
|
|
||||||
|
# Limit the number of actions per hour, from 1-30. Default is 30
|
||||||
|
limitPerRun: 30
|
||||||
|
|
||||||
|
pulls:
|
||||||
|
markComment: |-
|
||||||
|
This pull request has been marked 'stale' due to lack of recent activity. If there is no further activity, the PR will be closed in another 30 days. Thank you for your contribution!
|
||||||
|
|
||||||
|
Please read [this blog post](https://www.jeffgeerling.com/blog/2020/enabling-stale-issue-bot-on-my-github-repositories) to see the reasons why I mark pull requests as stale.
|
||||||
|
|
||||||
|
unmarkComment: >-
|
||||||
|
This pull request is no longer marked for closure.
|
||||||
|
|
||||||
|
closeComment: >-
|
||||||
|
This pull request has been closed due to inactivity. If you feel this is in error, please reopen the pull request or file a new PR with the relevant details.
|
||||||
|
|
||||||
|
issues:
|
||||||
|
markComment: |-
|
||||||
|
This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!
|
||||||
|
|
||||||
|
Please read [this blog post](https://www.jeffgeerling.com/blog/2020/enabling-stale-issue-bot-on-my-github-repositories) to see the reasons why I mark issues as stale.
|
||||||
|
|
||||||
|
unmarkComment: >-
|
||||||
|
This issue is no longer marked for closure.
|
||||||
|
|
||||||
|
closeComment: >-
|
||||||
|
This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.
|
|
@ -0,0 +1,72 @@
|
||||||
|
---
|
||||||
|
name: CI
|
||||||
|
'on':
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
schedule:
|
||||||
|
- cron: "0 7 * * 0"
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: 'geerlingguy.docker'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
lint:
|
||||||
|
name: Lint
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out the codebase.
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
path: 'geerlingguy.docker'
|
||||||
|
|
||||||
|
- name: Set up Python 3.
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: '3.x'
|
||||||
|
|
||||||
|
- name: Install test dependencies.
|
||||||
|
run: pip3 install yamllint ansible-lint
|
||||||
|
|
||||||
|
- name: Lint code.
|
||||||
|
run: |
|
||||||
|
yamllint .
|
||||||
|
ansible-lint
|
||||||
|
|
||||||
|
molecule:
|
||||||
|
name: Molecule
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
distro:
|
||||||
|
- centos8
|
||||||
|
- centos7
|
||||||
|
- ubuntu2004
|
||||||
|
- ubuntu1804
|
||||||
|
- debian10
|
||||||
|
- debian9
|
||||||
|
- fedora31
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check out the codebase.
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
path: 'geerlingguy.docker'
|
||||||
|
|
||||||
|
- name: Set up Python 3.
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: '3.x'
|
||||||
|
|
||||||
|
- name: Install test dependencies.
|
||||||
|
run: pip3 install ansible molecule[docker] docker
|
||||||
|
|
||||||
|
- name: Run Molecule tests.
|
||||||
|
run: molecule test
|
||||||
|
env:
|
||||||
|
PY_COLORS: '1'
|
||||||
|
ANSIBLE_FORCE_COLOR: '1'
|
||||||
|
MOLECULE_DISTRO: ${{ matrix.distro }}
|
|
@ -0,0 +1,38 @@
|
||||||
|
---
|
||||||
|
# This workflow requires a GALAXY_API_KEY secret present in the GitHub
|
||||||
|
# repository or organization.
|
||||||
|
#
|
||||||
|
# See: https://github.com/marketplace/actions/publish-ansible-role-to-galaxy
|
||||||
|
# See: https://github.com/ansible/galaxy/issues/46
|
||||||
|
|
||||||
|
name: Release
|
||||||
|
'on':
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: 'geerlingguy.docker'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
release:
|
||||||
|
name: Release
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out the codebase.
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
path: 'geerlingguy.docker'
|
||||||
|
|
||||||
|
- name: Set up Python 3.
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: '3.x'
|
||||||
|
|
||||||
|
- name: Install Ansible.
|
||||||
|
run: pip3 install ansible-base
|
||||||
|
|
||||||
|
- name: Trigger a new import on Galaxy.
|
||||||
|
run: ansible-galaxy role import --api-key ${{ secrets.GALAXY_API_KEY }} $(echo ${{ github.repository }} | cut -d/ -f1) $(echo ${{ github.repository }} | cut -d/ -f2)
|
|
@ -0,0 +1,3 @@
|
||||||
|
*.retry
|
||||||
|
*/__pycache__
|
||||||
|
*.pyc
|
|
@ -0,0 +1,11 @@
|
||||||
|
---
|
||||||
|
extends: default
|
||||||
|
|
||||||
|
rules:
|
||||||
|
line-length:
|
||||||
|
max: 200
|
||||||
|
level: warning
|
||||||
|
|
||||||
|
ignore: |
|
||||||
|
.github/stale.yml
|
||||||
|
.travis.yml
|
|
@ -0,0 +1,20 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2017 Jeff Geerling
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -0,0 +1,97 @@
|
||||||
|
# Ansible Role: Docker
|
||||||
|
|
||||||
|
[![CI](https://github.com/geerlingguy/ansible-role-docker/workflows/CI/badge.svg?event=push)](https://github.com/geerlingguy/ansible-role-docker/actions?query=workflow%3ACI)
|
||||||
|
|
||||||
|
An Ansible Role that installs [Docker](https://www.docker.com) on Linux.
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
None.
|
||||||
|
|
||||||
|
## Role Variables
|
||||||
|
|
||||||
|
Available variables are listed below, along with default values (see `defaults/main.yml`):
|
||||||
|
|
||||||
|
# Edition can be one of: 'ce' (Community Edition) or 'ee' (Enterprise Edition).
|
||||||
|
docker_edition: 'ce'
|
||||||
|
docker_package: "docker-{{ docker_edition }}"
|
||||||
|
docker_package_state: present
|
||||||
|
|
||||||
|
The `docker_edition` should be either `ce` (Community Edition) or `ee` (Enterprise Edition). You can also specify a specific version of Docker to install using the distribution-specific format: Red Hat/CentOS: `docker-{{ docker_edition }}-<VERSION>`; Debian/Ubuntu: `docker-{{ docker_edition }}=<VERSION>`.
|
||||||
|
|
||||||
|
You can control whether the package is installed, uninstalled, or at the latest version by setting `docker_package_state` to `present`, `absent`, or `latest`, respectively. Note that the Docker daemon will be automatically restarted if the Docker package is updated. This is a side effect of flushing all handlers (running any of the handlers that have been notified by this and any other role up to this point in the play).
|
||||||
|
|
||||||
|
docker_service_state: started
|
||||||
|
docker_service_enabled: true
|
||||||
|
docker_restart_handler_state: restarted
|
||||||
|
|
||||||
|
Variables to control the state of the `docker` service, and whether it should start on boot. If you're installing Docker inside a Docker container without systemd or sysvinit, you should set these to `stopped` and set the enabled variable to `no`.
|
||||||
|
|
||||||
|
docker_install_compose: true
|
||||||
|
docker_compose_version: "1.26.0"
|
||||||
|
docker_compose_path: /usr/local/bin/docker-compose
|
||||||
|
|
||||||
|
Docker Compose installation options.
|
||||||
|
|
||||||
|
docker_apt_release_channel: stable
|
||||||
|
docker_apt_arch: amd64
|
||||||
|
docker_apt_repository: "deb [arch={{ docker_apt_arch }}] https://download.docker.com/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} {{ docker_apt_release_channel }}"
|
||||||
|
docker_apt_ignore_key_error: True
|
||||||
|
docker_apt_gpg_key: https://download.docker.com/linux/{{ ansible_distribution | lower }}/gpg
|
||||||
|
|
||||||
|
(Used only for Debian/Ubuntu.) You can switch the channel to `nightly` if you want to use the Nightly release.
|
||||||
|
|
||||||
|
You can change `docker_apt_gpg_key` to a different url if you are behind a firewall or provide a trustworthy mirror.
|
||||||
|
Usually in combination with changing `docker_apt_repository` as well.
|
||||||
|
|
||||||
|
docker_yum_repo_url: https://download.docker.com/linux/centos/docker-{{ docker_edition }}.repo
|
||||||
|
docker_yum_repo_enable_nightly: '0'
|
||||||
|
docker_yum_repo_enable_test: '0'
|
||||||
|
docker_yum_gpg_key: https://download.docker.com/linux/centos/gpg
|
||||||
|
|
||||||
|
(Used only for RedHat/CentOS.) You can enable the Nightly or Test repo by setting the respective vars to `1`.
|
||||||
|
|
||||||
|
You can change `docker_yum_gpg_key` to a different url if you are behind a firewall or provide a trustworthy mirror.
|
||||||
|
Usually in combination with changing `docker_yum_repository` as well.
|
||||||
|
|
||||||
|
docker_users:
|
||||||
|
- user1
|
||||||
|
- user2
|
||||||
|
|
||||||
|
A list of system users to be added to the `docker` group (so they can use Docker on the server).
|
||||||
|
|
||||||
|
## Use with Ansible (and `docker` Python library)
|
||||||
|
|
||||||
|
Many users of this role wish to also use Ansible to then _build_ Docker images and manage Docker containers on the server where Docker is installed. In this case, you can easily add in the `docker` Python library using the `geerlingguy.pip` role:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- hosts: all
|
||||||
|
|
||||||
|
vars:
|
||||||
|
pip_install_packages:
|
||||||
|
- name: docker
|
||||||
|
|
||||||
|
roles:
|
||||||
|
- geerlingguy.pip
|
||||||
|
- geerlingguy.docker
|
||||||
|
```
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
None.
|
||||||
|
|
||||||
|
## Example Playbook
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- hosts: all
|
||||||
|
roles:
|
||||||
|
- geerlingguy.docker
|
||||||
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT / BSD
|
||||||
|
|
||||||
|
## Author Information
|
||||||
|
|
||||||
|
This role was created in 2017 by [Jeff Geerling](https://www.jeffgeerling.com/), author of [Ansible for DevOps](https://www.ansiblefordevops.com/).
|
|
@ -0,0 +1,31 @@
|
||||||
|
---
|
||||||
|
# Edition can be one of: 'ce' (Community Edition) or 'ee' (Enterprise Edition).
|
||||||
|
docker_edition: 'ce'
|
||||||
|
docker_package: "docker-{{ docker_edition }}"
|
||||||
|
docker_package_state: present
|
||||||
|
|
||||||
|
# Service options.
|
||||||
|
docker_service_state: started
|
||||||
|
docker_service_enabled: true
|
||||||
|
docker_restart_handler_state: restarted
|
||||||
|
|
||||||
|
# Docker Compose options.
|
||||||
|
docker_install_compose: true
|
||||||
|
docker_compose_version: "1.26.0"
|
||||||
|
docker_compose_path: /usr/local/bin/docker-compose
|
||||||
|
|
||||||
|
# Used only for Debian/Ubuntu. Switch 'stable' to 'nightly' if needed.
|
||||||
|
docker_apt_release_channel: stable
|
||||||
|
docker_apt_arch: amd64
|
||||||
|
docker_apt_repository: "deb [arch={{ docker_apt_arch }}] https://download.docker.com/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} {{ docker_apt_release_channel }}"
|
||||||
|
docker_apt_ignore_key_error: true
|
||||||
|
docker_apt_gpg_key: https://download.docker.com/linux/{{ ansible_distribution | lower }}/gpg
|
||||||
|
|
||||||
|
# Used only for RedHat/CentOS/Fedora.
|
||||||
|
docker_yum_repo_url: https://download.docker.com/linux/{{ (ansible_distribution == "Fedora") | ternary("fedora","centos") }}/docker-{{ docker_edition }}.repo
|
||||||
|
docker_yum_repo_enable_nightly: '0'
|
||||||
|
docker_yum_repo_enable_test: '0'
|
||||||
|
docker_yum_gpg_key: https://download.docker.com/linux/centos/gpg
|
||||||
|
|
||||||
|
# A list of users who will be added to the docker group.
|
||||||
|
docker_users: []
|
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
- name: restart docker
|
||||||
|
service: "name=docker state={{ docker_restart_handler_state }}"
|
|
@ -0,0 +1,2 @@
|
||||||
|
install_date: Sun Mar 14 18:38:43 2021
|
||||||
|
version: 3.0.0
|
|
@ -0,0 +1,35 @@
|
||||||
|
---
|
||||||
|
dependencies: []
|
||||||
|
|
||||||
|
galaxy_info:
|
||||||
|
role_name: docker
|
||||||
|
author: geerlingguy
|
||||||
|
description: Docker for Linux.
|
||||||
|
company: "Midwestern Mac, LLC"
|
||||||
|
license: "license (BSD, MIT)"
|
||||||
|
min_ansible_version: 2.4
|
||||||
|
platforms:
|
||||||
|
- name: EL
|
||||||
|
versions:
|
||||||
|
- 7
|
||||||
|
- 8
|
||||||
|
- name: Fedora
|
||||||
|
versions:
|
||||||
|
- all
|
||||||
|
- name: Debian
|
||||||
|
versions:
|
||||||
|
- stretch
|
||||||
|
- buster
|
||||||
|
- name: Ubuntu
|
||||||
|
versions:
|
||||||
|
- xenial
|
||||||
|
- bionic
|
||||||
|
- focal
|
||||||
|
galaxy_tags:
|
||||||
|
- web
|
||||||
|
- system
|
||||||
|
- containers
|
||||||
|
- docker
|
||||||
|
- orchestration
|
||||||
|
- compose
|
||||||
|
- server
|
|
@ -0,0 +1,24 @@
|
||||||
|
---
|
||||||
|
- name: Converge
|
||||||
|
hosts: all
|
||||||
|
become: true
|
||||||
|
|
||||||
|
pre_tasks:
|
||||||
|
- name: Update apt cache.
|
||||||
|
apt: update_cache=yes cache_valid_time=600
|
||||||
|
when: ansible_os_family == 'Debian'
|
||||||
|
|
||||||
|
- name: Wait for systemd to complete initialization. # noqa 303
|
||||||
|
command: systemctl is-system-running
|
||||||
|
register: systemctl_status
|
||||||
|
until: >
|
||||||
|
'running' in systemctl_status.stdout or
|
||||||
|
'degraded' in systemctl_status.stdout
|
||||||
|
retries: 30
|
||||||
|
delay: 5
|
||||||
|
when: ansible_service_mgr == 'systemd'
|
||||||
|
changed_when: false
|
||||||
|
failed_when: systemctl_status.rc > 1
|
||||||
|
|
||||||
|
roles:
|
||||||
|
- role: geerlingguy.docker
|
|
@ -0,0 +1,17 @@
|
||||||
|
---
|
||||||
|
dependency:
|
||||||
|
name: galaxy
|
||||||
|
driver:
|
||||||
|
name: docker
|
||||||
|
platforms:
|
||||||
|
- name: instance
|
||||||
|
image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest"
|
||||||
|
command: ${MOLECULE_DOCKER_COMMAND:-""}
|
||||||
|
volumes:
|
||||||
|
- /sys/fs/cgroup:/sys/fs/cgroup:ro
|
||||||
|
privileged: true
|
||||||
|
pre_build_image: true
|
||||||
|
provisioner:
|
||||||
|
name: ansible
|
||||||
|
playbooks:
|
||||||
|
converge: ${MOLECULE_PLAYBOOK:-converge.yml}
|
|
@ -0,0 +1,20 @@
|
||||||
|
---
|
||||||
|
- name: Check current docker-compose version.
|
||||||
|
command: docker-compose --version
|
||||||
|
register: docker_compose_current_version
|
||||||
|
changed_when: false
|
||||||
|
failed_when: false
|
||||||
|
|
||||||
|
- name: Delete existing docker-compose version if it's different.
|
||||||
|
file:
|
||||||
|
path: "{{ docker_compose_path }}"
|
||||||
|
state: absent
|
||||||
|
when: >
|
||||||
|
docker_compose_current_version.stdout is defined
|
||||||
|
and docker_compose_version not in docker_compose_current_version.stdout
|
||||||
|
|
||||||
|
- name: Install Docker Compose (if configured).
|
||||||
|
get_url:
|
||||||
|
url: https://github.com/docker/compose/releases/download/{{ docker_compose_version }}/docker-compose-Linux-x86_64
|
||||||
|
dest: "{{ docker_compose_path }}"
|
||||||
|
mode: 0755
|
|
@ -0,0 +1,7 @@
|
||||||
|
---
|
||||||
|
- name: Ensure docker users are added to the docker group.
|
||||||
|
user:
|
||||||
|
name: "{{ item }}"
|
||||||
|
groups: docker
|
||||||
|
append: true
|
||||||
|
with_items: "{{ docker_users }}"
|
|
@ -0,0 +1,27 @@
|
||||||
|
---
|
||||||
|
- include_tasks: setup-RedHat.yml
|
||||||
|
when: ansible_os_family == 'RedHat'
|
||||||
|
|
||||||
|
- include_tasks: setup-Debian.yml
|
||||||
|
when: ansible_os_family == 'Debian'
|
||||||
|
|
||||||
|
- name: Install Docker.
|
||||||
|
package:
|
||||||
|
name: "{{ docker_package }}"
|
||||||
|
state: "{{ docker_package_state }}"
|
||||||
|
notify: restart docker
|
||||||
|
|
||||||
|
- name: Ensure Docker is started and enabled at boot.
|
||||||
|
service:
|
||||||
|
name: docker
|
||||||
|
state: "{{ docker_service_state }}"
|
||||||
|
enabled: "{{ docker_service_enabled }}"
|
||||||
|
|
||||||
|
- name: Ensure handlers are notified now to avoid firewall conflicts.
|
||||||
|
meta: flush_handlers
|
||||||
|
|
||||||
|
- include_tasks: docker-compose.yml
|
||||||
|
when: docker_install_compose | bool
|
||||||
|
|
||||||
|
- include_tasks: docker-users.yml
|
||||||
|
when: docker_users | length > 0
|
|
@ -0,0 +1,40 @@
|
||||||
|
---
|
||||||
|
- name: Ensure old versions of Docker are not installed.
|
||||||
|
package:
|
||||||
|
name:
|
||||||
|
- docker
|
||||||
|
- docker-engine
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: Ensure dependencies are installed.
|
||||||
|
apt:
|
||||||
|
name:
|
||||||
|
- apt-transport-https
|
||||||
|
- ca-certificates
|
||||||
|
- gnupg2
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Add Docker apt key.
|
||||||
|
apt_key:
|
||||||
|
url: "{{ docker_apt_gpg_key }}"
|
||||||
|
id: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88
|
||||||
|
state: present
|
||||||
|
register: add_repository_key
|
||||||
|
ignore_errors: "{{ docker_apt_ignore_key_error }}"
|
||||||
|
|
||||||
|
- name: Ensure curl is present (on older systems without SNI).
|
||||||
|
package: name=curl state=present
|
||||||
|
when: add_repository_key is failed
|
||||||
|
|
||||||
|
- name: Add Docker apt key (alternative for older systems without SNI).
|
||||||
|
shell: >
|
||||||
|
curl -sSL {{ docker_apt_gpg_key }} | sudo apt-key add -
|
||||||
|
args:
|
||||||
|
warn: false
|
||||||
|
when: add_repository_key is failed
|
||||||
|
|
||||||
|
- name: Add Docker repository.
|
||||||
|
apt_repository:
|
||||||
|
repo: "{{ docker_apt_repository }}"
|
||||||
|
state: present
|
||||||
|
update_cache: true
|
|
@ -0,0 +1,50 @@
|
||||||
|
---
|
||||||
|
- name: Ensure old versions of Docker are not installed.
|
||||||
|
package:
|
||||||
|
name:
|
||||||
|
- docker
|
||||||
|
- docker-common
|
||||||
|
- docker-engine
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: Add Docker GPG key.
|
||||||
|
rpm_key:
|
||||||
|
key: "{{ docker_yum_gpg_key }}"
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Add Docker repository.
|
||||||
|
get_url:
|
||||||
|
url: "{{ docker_yum_repo_url }}"
|
||||||
|
dest: '/etc/yum.repos.d/docker-{{ docker_edition }}.repo'
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0644
|
||||||
|
|
||||||
|
- name: Configure Docker Nightly repo.
|
||||||
|
ini_file:
|
||||||
|
dest: '/etc/yum.repos.d/docker-{{ docker_edition }}.repo'
|
||||||
|
section: 'docker-{{ docker_edition }}-nightly'
|
||||||
|
option: enabled
|
||||||
|
value: '{{ docker_yum_repo_enable_nightly }}'
|
||||||
|
mode: 0644
|
||||||
|
|
||||||
|
- name: Configure Docker Test repo.
|
||||||
|
ini_file:
|
||||||
|
dest: '/etc/yum.repos.d/docker-{{ docker_edition }}.repo'
|
||||||
|
section: 'docker-{{ docker_edition }}-test'
|
||||||
|
option: enabled
|
||||||
|
value: '{{ docker_yum_repo_enable_test }}'
|
||||||
|
mode: 0644
|
||||||
|
|
||||||
|
- name: Configure containerd on RHEL 8.
|
||||||
|
block:
|
||||||
|
- name: Ensure container-selinux is installed.
|
||||||
|
package:
|
||||||
|
name: container-selinux
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Ensure containerd.io is installed.
|
||||||
|
package:
|
||||||
|
name: containerd.io
|
||||||
|
state: present
|
||||||
|
when: ansible_distribution_major_version | int == 8
|
Loading…
Reference in New Issue