-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
- name: Set up shared images storage | ||
hosts: all | ||
become: true | ||
|
||
vars: | ||
# username for private automation hub for EE or to password protected registry | ||
registry_user: "USERNAME" | ||
# password for private automation hub for EE or to password protected registry | ||
registry_pass: "PASSWORD" | ||
# specific image to pull | ||
ansible_image: "registry.redhat.io/ansible-automation-platform-24/ee-supported-rhel8:latest" | ||
# location of additional image store for shared storage | ||
additionalimagestores: "/var/lib/mycontainers-shared" | ||
|
||
roles: | ||
- shadowman_dev_shared_image_store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
ansible_image: "registry.redhat.io/ansible-automation-platform-24/ee-supported-rhel8:latest" | ||
additionalimagestores: "/var/lib/mycontainers-shared" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
|
||
- name: Ensure shared image directory exists | ||
ansible.builtin.file: | ||
path: "{{ additionalimagestores }}" | ||
state: directory | ||
owner: root | ||
group: root | ||
mode: a+rx | ||
recurse: true | ||
|
||
- name: Install podman | ||
ansible.builtin.dnf: | ||
name: podman | ||
state: present | ||
|
||
- name: Check if EE present | ||
ansible.builtin.command: "podman --root {{ additionalimagestores }} image exists {{ ansible_image }}" | ||
register: exists | ||
changed_when: exists.rc == 1 | ||
failed_when: exists.rc > 1 | ||
|
||
- name: Pull EE only if not present | ||
ansible.builtin.command: "podman pull --root {{ additionalimagestores }} --creds={{ registry_user }}:{{ registry_pass }} {{ ansible_image }}" | ||
register: ee | ||
changed_when: ee.rc == 0 | ||
when: exists.rc == 1 |