Skip to content

Commit

Permalink
Remove superfluous package cache updates (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
teddyphreak authored Jul 16, 2024
1 parent de39728 commit b6827cd
Show file tree
Hide file tree
Showing 16 changed files with 95 additions and 98 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
2 changes: 1 addition & 1 deletion install/playbook.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
- name: Perform local Docker install
hosts: docker
hosts: all
roles:
- nephelaiio.docker
3 changes: 1 addition & 2 deletions molecule/common/converge.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
27 changes: 27 additions & 0 deletions molecule/common/prepare.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion molecule/common/verify.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
- name: Verify
hosts: docker
hosts: all
vars:
docker_service: docker.service
pre_tasks:
Expand Down
2 changes: 1 addition & 1 deletion molecule/hold/converge.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
- name: Deploy Docker packages
hosts: docker
hosts: all
become: true
roles:
- nephelaiio.docker
Expand Down
4 changes: 2 additions & 2 deletions molecule/hold/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ platforms:
tmpfs:
- /tmp
- /opt
groups:
- docker
provisioner:
name: ansible
playbooks:
prepare: ../common/prepare.yml
inventory:
hosts:
all:
Expand Down
21 changes: 0 additions & 21 deletions molecule/hold/prepare.yml

This file was deleted.

2 changes: 1 addition & 1 deletion molecule/hold/side_effect.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
- name: Update OS
hosts: docker
hosts: all
become: true
roles:
- robertdebock.update
2 changes: 1 addition & 1 deletion molecule/hold/verify.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
- name: Verify Docker packages
hosts: docker
hosts: all
become: true
tasks:
- name: Query Debian package versions
Expand Down
3 changes: 1 addition & 2 deletions molecule/install/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 0 additions & 2 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
- name: Configure service
when: docker_packages_state != 'absent'
block:

- name: Configure service path
ansible.builtin.file:
path: "{{ docker_configuration_path }}"
Expand All @@ -62,7 +61,6 @@
when: docker_service_manage
tags: install
block:

- name: Configure service
ansible.builtin.template:
src: "{{ docker_configuration_template }}"
Expand Down
113 changes: 54 additions & 59 deletions tasks/repo.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit b6827cd

Please sign in to comment.