Skip to content

Commit

Permalink
7 add support for fedora linux (#10)
Browse files Browse the repository at this point in the history
Add support for Fedora 35
  • Loading branch information
kirill-zak authored Apr 11, 2022
1 parent 8f12b2d commit f1118f6
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 10 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jobs:
- centos8
- debian10
- debian11
- fedora35
- ubuntu2004
- ubuntu1804

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
- centos8
- debian10
- debian11
- fedora35
- ubuntu2004
- ubuntu1804

Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

An Ansible role that installs the latest version of Docker CE on the official installation instructions.

## Support distributive

* CentOS 7
* CentOS 8
* Debian 10 (Buster)
* Debian 11 (Bullseye)
* Fedora 35
* Ubuntu 18.04 (Bionic Beaver)
* Ubuntu 20.04 (Focal Fossa)

## Requirements

N/A
Expand Down
6 changes: 4 additions & 2 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ galaxy_info:
versions:
- "7"
- "8"
- name: Fedora
versions:
- "35"
- name: Ubuntu
versions:
- focal
- bionic
- xenial
- focal
galaxy_tags:
- docker
dependencies: []
13 changes: 13 additions & 0 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@
hosts: all
become: true

pre_tasks:
- name: Wait for systemd to complete initialization. # noqa 303
ansible.builtin.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

tasks:
- name: "Include kirill_zak.ansible_docker"
include_role:
Expand Down
10 changes: 2 additions & 8 deletions molecule/default/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@
- name: Gather service facts
ansible.builtin.service_facts:

- name: Check if docker service run (for CentOS)
- name: Check if docker service run
ansible.builtin.assert:
that: "'running' in ansible_facts.services['docker.service']['state']"
when: ansible_distribution == 'CentOS'

- name: Check if docker service run (for Ubuntu or Debian)
ansible.builtin.assert:
that: "'running' in ansible_facts.services['docker']['state']"
when: ansible_distribution == 'Ubuntu' or ansible_distribution == 'Debian'
that: "'running' in ansible_facts.services['docker.service']['state']"
45 changes: 45 additions & 0 deletions tasks/install/fedora.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
# Based on https://docs.docker.com/engine/install/fedora/
- name: Ensure old versions of Docker are not installed
ansible.builtin.dnf:
name:
- docker
- docker-client
- docker-client-latest
- docker-common
- docker-latest
- docker-latest-logrotate
- docker-logrotate
- docker-selinux
- docker-engine-selinux
- docker-engine
state: absent
changed_when: false

- name: Install Docker dependencies
ansible.builtin.dnf:
name:
- dnf-plugins-core
state: present
register: result
until: result is success
retries: 5
delay: 5
changed_when: false

- name: Add Docker repository
ansible.builtin.command: dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
changed_when: false

- name: Install Docker
ansible.builtin.dnf:
name:
- docker-ce
- docker-ce-cli
- containerd.io
state: present
register: result
until: result is success
retries: 5
delay: 5
changed_when: false
4 changes: 4 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
include_tasks: install/debian.yml
when: ansible_distribution == 'Debian'

- name: Include Fedora install task
include_tasks: install/fedora.yml
when: ansible_distribution == 'Fedora'

- name: Include Ubuntu install task
include_tasks: install/ubuntu.yml
when: ansible_distribution == 'Ubuntu'
Expand Down
1 change: 1 addition & 0 deletions tasks/post_process.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
name: docker
state: "{{ docker_service_state }}"
enabled: "{{ docker_service_enabled }}"
changed_when: false

- name: Add user to Docker group
ansible.builtin.user:
Expand Down

0 comments on commit f1118f6

Please sign in to comment.