-
Notifications
You must be signed in to change notification settings - Fork 6
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
4 changed files
with
67 additions
and
3 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
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,62 @@ | ||
#!/usr/local/bin/ansible-playbook --inventory=inventory.yaml | ||
- name: '{{ name_vendor }} | Koffer | images.yml' | ||
hosts: koffer | ||
vars_files: | ||
- 'vars/global.yml' | ||
|
||
vars: | ||
module: "images" | ||
ansible_name_module: "{{ ansible_name }} | {{ module }}" | ||
|
||
tasks: | ||
|
||
####### Place OpenShift Version Manifest | ||
- name: '{{ ansible_name_module }} | get_url:url | Place OpenShift release.txt | {{ version_openshift }}' | ||
get_url: | ||
url: 'https://mirror.openshift.com/pub/openshift-v4/clients/ocp/{{ version_openshift }}/openshift-install-linux.tar.gz' | ||
dest: '{{ dir_platform }}/nginx/openshift/latest/release.txt' | ||
mode: 0775 | ||
|
||
###### Evaluate lock file presence | ||
- name: '{{ ansible_name_module }} | stat | check for mirror v2.sha256 Lock file' | ||
stat: | ||
path: '{{ dir_platform }}/mirror/ocp-release.{{ version_openshift }}.lock' | ||
register: mirror_lock_check | ||
|
||
###### Download OpenShift Docker Images from Quay.io to File: /root/platform/mirror/v2 | ||
- name: '{{ ansible_name_module }} | block | Download OpenShift images' | ||
block: | ||
|
||
######### Purge & Prepare | ||
- name: '{{ ansible_name_module }} | file:directory | Create mirror artifact directories' | ||
file: | ||
path: "{{ dir_platform }}/mirror" | ||
state: directory | ||
|
||
######### Mirror Images to directory | ||
- name: '{{ ansible_name_module }} | shell:oc.adm.release.mirror | Sync content from quay.io' | ||
shell: | | ||
oc adm release mirror --insecure=true \ | ||
--to=localhost:5000/openshift-release-dev \ | ||
--registry-config=/root/.docker/config.json \ | ||
--from=quay.io/openshift-release-dev/ocp-release:{{ version_openshift }}-x86_64 \ | ||
--to-release-image=localhost:5000/openshift-release-dev:{{ version_openshift }}-x86_64 | ||
when: image_mirror_utility == "oc" | ||
|
||
######### Skopeo Copy Images to Registry | ||
- name: '{{ ansible_name_module }} | shell:skopeo.copy | Sync content from quay.io' | ||
shell: | | ||
for i in $(cat /var/lib/koffer/release.list); do \ | ||
skopeo copy docker://quay.io/$i \ | ||
docker://localhost:5000/openshift-release-dev/$i ; \ | ||
done | ||
when: image_mirror_utility == "skopeo" | ||
|
||
####### Block Conditionals | ||
when: not mirror_lock_check.stat.exists | ||
|
||
- name: '{{ ansible_name_module }} | command:touch | Place mirror lock file' | ||
command: | ||
cmd: 'touch {{ dir_platform }}/mirror/ocp-release.{{ version_openshift }}.lock' | ||
args: | ||
warn: false |
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
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