Skip to content

Commit

Permalink
Merge pull request #329 from rebtoor/download-cache-edpm-podman
Browse files Browse the repository at this point in the history
Enable download-cache support in `edpm_podman` role
  • Loading branch information
openshift-merge-robot authored Sep 18, 2023
2 parents bdb2002 + f1ff1da commit 581ab88
Show file tree
Hide file tree
Showing 12 changed files with 53 additions and 61 deletions.
5 changes: 5 additions & 0 deletions roles/edpm_download_cache/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
name: osp.edpm.edpm_bootstrap
tasks_from: download_cache.yml

- name: Download packages for edpm_podman role
ansible.builtin.include_role:
name: osp.edpm.edpm_podman
tasks_from: download_cache.yml

- name: Download packages for edpm_tuned role
ansible.builtin.include_role:
name: osp.edpm.edpm_tuned
Expand Down
8 changes: 8 additions & 0 deletions roles/edpm_podman/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@


# All variables intended for modification should be placed in this file.


# seconds between retries for download tasks
edpm_podman_download_delay: 5

# number of retries for download tasks
edpm_podman_download_retries: 5

edpm_podman_hide_sensitive_logs: "{{ hide_sensitive_logs | default(true) }}"

edpm_podman_buildah_login: false
Expand Down
2 changes: 1 addition & 1 deletion roles/edpm_podman/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
- name: Restart rsyslog
systemd:
ansible.builtin.systemd:
name: rsyslog
state: restarted
8 changes: 8 additions & 0 deletions roles/edpm_podman/meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ argument_specs:
main:
short_description: The main entry point for the edpm_podman role.
options:
edpm_podman_download_delay:
type: int
default: 5
description: The seconds between retries for failed download tasks
edpm_podman_download_retries:
type: int
default: 5
description: The number of retries for failed download tasks
edpm_podman_hide_sensitive_logs:
type: bool
default: true
Expand Down
18 changes: 5 additions & 13 deletions roles/edpm_podman/tasks/buildah_login.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,15 @@
# License for the specific language governing permissions and limitations
# under the License.

- name: Gather variables for each operating system for installing buildah
ansible.builtin.include_vars: "{{ item }}"
with_first_found:
- skip: true
files:
- "{{ ansible_facts['distribution'] | lower }}-{{ ansible_facts['distribution_version'] | lower }}.yml"
- "{{ ansible_facts['distribution'] | lower }}-{{ ansible_facts['distribution_major_version'] | lower }}.yml"
- "{{ ansible_facts['os_family'] | lower }}-{{ ansible_facts['distribution_major_version'] | lower }}.yml"
- "{{ ansible_facts['distribution'] | lower }}.yml"
- "{{ ansible_facts['os_family'] | lower }}-{{ ansible_facts['distribution_version'].split('.')[0] }}.yml"
- "{{ ansible_facts['os_family'] | lower }}.yml"

- name: Ensure buildah is installed
become: true
ansible.builtin.package:
ansible.builtin.dnf:
name: "{{ edpm_buildah_package }}"
state: present
register: edpm_buildah_package_download
until: edpm_buildah_package_download.rc == 0
retries: "{{ edpm_podman_download_retries }}"
delay: "{{ edpm_podman_download_delay }}"

- name: Perform container registry login(s) with buildah
become: true
Expand Down
2 changes: 1 addition & 1 deletion roles/edpm_podman/tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
- name: Configure edpm_container_manage to generate systemd drop-in dependencies
ansible.builtin.copy:
dest: /etc/sysconfig/podman_drop_in
mode: 0644
mode: '0644'
content: |
This file makes edpm_container_manage generate additional systemd
dependencies for containers that have special
Expand Down
13 changes: 13 additions & 0 deletions roles/edpm_podman/tasks/download_cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---

- name: Download needed packages
ansible.builtin.dnf:
name:
- "{{ edpm_podman_package }}"
- "{{ edpm_buildah_package }}"
download_only: true
become: true
register: edpm_podman_packages_download
until: edpm_podman_packages_download.rc == 0
retries: "{{ edpm_podman_download_retries }}"
delay: "{{ edpm_podman_download_delay }}"
14 changes: 7 additions & 7 deletions roles/edpm_podman/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@
# License for the specific language governing permissions and limitations
# under the License.

- name: Load vars id needed
when: edpm_podman_packages is undefined or edpm_podman_packages | length == 0
ansible.builtin.import_tasks: load_vars.yaml

- name: Install block
become: true
block:
- name: Ensure podman and deps are installed
ansible.builtin.package:
ansible.builtin.dnf:
name: "{{ edpm_podman_package }}"
state: present
register: edpm_podman_package_download
until: edpm_podman_package_download.rc == 0
retries: "{{ edpm_podman_download_retries }}"
delay: "{{ edpm_podman_download_delay }}"

- name: Ensure we get the ansible interfaces facts
when:
Expand Down Expand Up @@ -53,7 +53,7 @@
path: /etc/cni/net.d
state: directory
recurse: true
mode: 0755
mode: '0755'
owner: root
group: root

Expand All @@ -74,7 +74,7 @@
path: /etc/containers/networks
state: directory
recurse: true
mode: 0755
mode: '0755'
owner: root
group: root
- name: Get current podman network
Expand Down
32 changes: 0 additions & 32 deletions roles/edpm_podman/tasks/load_vars.yaml

This file was deleted.

3 changes: 0 additions & 3 deletions roles/edpm_podman/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
# License for the specific language governing permissions and limitations
# under the License.

- name: Load vars
ansible.builtin.import_tasks: load_vars.yaml

- name: Podman install
ansible.builtin.import_tasks: install.yml

Expand Down
2 changes: 1 addition & 1 deletion roles/edpm_podman/tasks/rsyslog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
register: logconfig

- name: Restart rsyslog service after logging conf change
ansible.builtin.service:
ansible.builtin.systemd:
name: rsyslog
state: restarted
when: logconfig is changed
7 changes: 4 additions & 3 deletions roles/edpm_podman/tasks/service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,18 @@
ansible.builtin.file:
path: "{{ edpm_podman_socket_path | dirname }}"
state: directory
mode: 0755
mode: '0755'

- name: Create required systemd unit file for podman service
become: true
ansible.builtin.template:
src: podman.service.j2
dest: "/etc/systemd/system/{{ edpm_podman_service_unit_name }}"
mode: 0644
mode: '0644'

- name: Enable podman service unit
ansible.builtin.service:
become: true
ansible.builtin.systemd:
name: "{{ edpm_podman_service_unit_name }}"
state: started
enabled: true

0 comments on commit 581ab88

Please sign in to comment.