mirror of https://github.com/ansible/ansible.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
924 B
YAML
35 lines
924 B
YAML
4 years ago
|
- name: Install dnf-plugins-core in order to use dnf config-manager
|
||
|
dnf:
|
||
|
name: dnf-plugins-core
|
||
|
state: present
|
||
|
|
||
|
- name: Add docker-ce repo (Only RedHat & CentOS)
|
||
|
shell: dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
|
||
|
when: (ansible_distribution in ['RedHat', 'CentOS'])
|
||
|
|
||
|
- name: Add docker-ce repo (Only Fedora)
|
||
|
shell: dnf config-manager --add-repo=https://download.docker.com/linux/fedora/docker-ce.repo
|
||
|
when: (ansible_distribution in ['Fedora'])
|
||
|
|
||
|
- name: Install docker using nobest option
|
||
|
dnf:
|
||
|
name: docker-ce
|
||
|
state: present
|
||
|
nobest: true
|
||
|
register: dnf_result
|
||
|
|
||
|
- name: Verify installation of docker-ce
|
||
|
assert:
|
||
|
that:
|
||
|
- not dnf_result is failed
|
||
|
|
||
|
- name: Cleanup packages
|
||
|
dnf:
|
||
|
name: docker-ce, dnf-plugins-core
|
||
|
state: absent
|
||
|
|
||
|
- name: Cleanup manually added repos
|
||
|
file:
|
||
|
name: "/etc/yum.repos.d/docker-ce.repo"
|
||
|
state: absent
|