diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml index b18d2c9..778bf9f 100644 --- a/.github/workflows/install.yml +++ b/.github/workflows/install.yml @@ -14,12 +14,12 @@ jobs: runs-on: ubuntu-latest steps: - name: check out the codebase - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: path: 'nephelaiio.docker' - name: set up python 3 - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.x' diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 5822eca..b8474ca 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -21,7 +21,7 @@ jobs: path: 'nephelaiio.docker' - name: Set up python 3 - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.x' diff --git a/.github/workflows/molecule.yml b/.github/workflows/molecule.yml index 8f700e2..3cd8bf9 100644 --- a/.github/workflows/molecule.yml +++ b/.github/workflows/molecule.yml @@ -37,7 +37,7 @@ jobs: path: 'nephelaiio.docker' - name: Set up python 3 - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.x' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8084629..716c627 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,7 +26,7 @@ jobs: path: 'nephelaiio.docker' - name: Set up Python 3 - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.x' diff --git a/install/playbook.yml b/install/playbook.yml index f722831..fae661a 100644 --- a/install/playbook.yml +++ b/install/playbook.yml @@ -1,5 +1,5 @@ --- - name: Perform local Docker install - hosts: docker + hosts: all roles: - nephelaiio.docker diff --git a/molecule/common/converge.yml b/molecule/common/converge.yml index 5a74c8d..e11a7c1 100644 --- a/molecule/common/converge.yml +++ b/molecule/common/converge.yml @@ -1,13 +1,12 @@ --- - name: Converge - hosts: docker + hosts: all roles: - nephelaiio.docker pre_tasks: - name: Update apt package cache ansible.builtin.apt: package: gpg-agent - update_cache: true when: ansible_os_family == 'Debian' post_tasks: diff --git a/molecule/common/prepare.yml b/molecule/common/prepare.yml new file mode 100644 index 0000000..fa84eca --- /dev/null +++ b/molecule/common/prepare.yml @@ -0,0 +1,27 @@ +--- +- name: Deploy Docker packages + hosts: all + become: true + tasks: + - name: Prepare Debian systems + when: ansible_os_family == 'Debian' + block: + - name: Update apt package cache + ansible.builtin.apt: + update_cache: true + + - name: Install package helpers + ansible.builtin.apt: + package: gpg-agent + update_cache: true + + - name: Install python3 binary redirection + ansible.builtin.apt: + name: python-is-python3 + + - name: Remove docker packages + ansible.builtin.include_role: + name: nephelaiio.docker + vars: + docker_packages_state: absent + docker_repo_manage: true diff --git a/molecule/common/verify.yml b/molecule/common/verify.yml index 030e420..72b9575 100644 --- a/molecule/common/verify.yml +++ b/molecule/common/verify.yml @@ -1,6 +1,6 @@ --- - name: Verify - hosts: docker + hosts: all vars: docker_service: docker.service pre_tasks: diff --git a/molecule/hold/converge.yml b/molecule/hold/converge.yml index 7a16b32..32c5fdb 100644 --- a/molecule/hold/converge.yml +++ b/molecule/hold/converge.yml @@ -1,6 +1,6 @@ --- - name: Deploy Docker packages - hosts: docker + hosts: all become: true roles: - nephelaiio.docker diff --git a/molecule/hold/molecule.yml b/molecule/hold/molecule.yml index 3c2c887..67d7456 100644 --- a/molecule/hold/molecule.yml +++ b/molecule/hold/molecule.yml @@ -15,10 +15,10 @@ platforms: tmpfs: - /tmp - /opt - groups: - - docker provisioner: name: ansible + playbooks: + prepare: ../common/prepare.yml inventory: hosts: all: diff --git a/molecule/hold/prepare.yml b/molecule/hold/prepare.yml deleted file mode 100644 index 51bdbfe..0000000 --- a/molecule/hold/prepare.yml +++ /dev/null @@ -1,21 +0,0 @@ ---- -- name: Deploy Docker packages - hosts: docker - become: true - roles: - - nephelaiio.docker - vars: - docker_packages_state: absent - docker_repo_manage: true - pre_tasks: - - name: Update apt package cache - ansible.builtin.apt: - package: gpg-agent - update_cache: true - when: ansible_os_family == 'Debian' - - post_tasks: - - name: Install python3 binary redirection - ansible.builtin.apt: - name: python-is-python3 - when: ansible_os_family == 'Debian' diff --git a/molecule/hold/side_effect.yml b/molecule/hold/side_effect.yml index de4b49f..24c09a0 100644 --- a/molecule/hold/side_effect.yml +++ b/molecule/hold/side_effect.yml @@ -1,6 +1,6 @@ --- - name: Update OS - hosts: docker + hosts: all become: true roles: - robertdebock.update diff --git a/molecule/hold/verify.yml b/molecule/hold/verify.yml index d9fce8a..0417dd6 100644 --- a/molecule/hold/verify.yml +++ b/molecule/hold/verify.yml @@ -1,6 +1,6 @@ --- - name: Verify Docker packages - hosts: docker + hosts: all become: true tasks: - name: Query Debian package versions diff --git a/molecule/install/molecule.yml b/molecule/install/molecule.yml index 51967bb..cab6568 100644 --- a/molecule/install/molecule.yml +++ b/molecule/install/molecule.yml @@ -15,11 +15,10 @@ platforms: tmpfs: - /tmp - /opt - groups: - - docker provisioner: name: ansible playbooks: + prepare: ../common/prepare.yml converge: ../common/converge.yml verify: ../common/verify.yml verifier: diff --git a/tasks/main.yml b/tasks/main.yml index 4fa7d50..4342c1b 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -48,7 +48,6 @@ - name: Configure service when: docker_packages_state != 'absent' block: - - name: Configure service path ansible.builtin.file: path: "{{ docker_configuration_path }}" @@ -62,7 +61,6 @@ when: docker_service_manage tags: install block: - - name: Configure service ansible.builtin.template: src: "{{ docker_configuration_template }}" diff --git a/tasks/repo.yml b/tasks/repo.yml index eb5f7d7..7c1d7ae 100644 --- a/tasks/repo.yml +++ b/tasks/repo.yml @@ -1,72 +1,67 @@ --- -- name: Configure apt repository - when: - - ansible_os_family == "Debian" - - docker_repo_manage +- name: Configure package repositories + when: docker_repo_manage tags: install block: + - name: Configure apt repository + when: ansible_os_family == "Debian" + block: + - name: Install Debian package helpers + ansible.builtin.apt: + name: + - apt-transport-https + - ca-certificates + - python3-docker + - python3-pip + - curl - - name: Install Debian package helpers - ansible.builtin.apt: - name: - - apt-transport-https - - ca-certificates - - python3-docker - - python3-pip - - curl - update_cache: true + - name: Install apt key + ansible.builtin.apt_key: + keyserver: "{{ docker_deb_repo.keyserver }}" + state: present + id: "{{ docker_deb_repo.key }}" + ignore_errors: true + register: apt_key_module - - name: Install apt key - ansible.builtin.apt_key: - keyserver: "{{ docker_deb_repo.keyserver }}" - state: present - id: "{{ docker_deb_repo.key }}" - ignore_errors: true - register: apt_key_module + - name: Force install apt key + ansible.builtin.shell: | + curl -fsSL {{ docker_deb_repo.keyserver }} | sudo apt-key add - + when: apt_key_module.failed + tags: skip_ansible_lint - - name: Force install apt key - ansible.builtin.shell: | - curl -fsSL {{ docker_deb_repo.keyserver }} | sudo apt-key add - - when: apt_key_module.failed - tags: skip_ansible_lint + - name: Manage apt repository + ansible.builtin.apt_repository: + repo: "{{ docker_deb_repo.url }}" + state: "{{ docker_repo_state }}" + filename: docker + validate_certs: no + notify: update_apt_cache # noqa name[casing] - - name: Manage apt repository - ansible.builtin.apt_repository: - repo: "{{ docker_deb_repo.url }}" - state: "{{ docker_repo_state }}" - filename: docker - validate_certs: no - notify: update_apt_cache # noqa name[casing] + - name: Configure yum repository + when: ansible_os_family == "RedHat" + block: + - name: Install epel repository + ansible.builtin.package: + name: epel-release -- name: Configure yum repository - when: - - ansible_os_family == "RedHat" - - docker_repo_manage - tags: install - block: - - - name: Install epel repository - ansible.builtin.package: - name: epel-release - - - name: Install RedHat package helpers - ansible.builtin.package: - name: - - python3-pip - - python3-docker + - name: Install RedHat package helpers + ansible.builtin.package: + name: + - python3-pip + - python3-docker - - name: Manage yum repository - ansible.builtin.get_url: - url: "{{ docker_rpm_repo.url }}" - dest: /etc/yum.repos.d/docker.repo - mode: 'u=rw,go=r' - when: docker_repo_state != 'absent' + - name: Manage yum repository + ansible.builtin.get_url: + url: "{{ docker_rpm_repo.url }}" + dest: /etc/yum.repos.d/docker.repo + mode: 'u=rw,go=r' + when: docker_repo_state != 'absent' - - name: Remove yum repository - ansible.builtin.file: - dest: /etc/yum.repos.d/docker.repo - state: absent - when: docker_repo_state == 'absent' + - name: Remove yum repository + ansible.builtin.file: + dest: /etc/yum.repos.d/docker.repo + state: absent + when: docker_repo_state == 'absent' - name: Flush handlers ansible.builtin.meta: flush_handlers