Skip to content

Commit

Permalink
img infra artifacts isolation wip
Browse files Browse the repository at this point in the history
  • Loading branch information
usrbinkat committed Oct 18, 2020
1 parent 76891b3 commit 44fba03
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 49 deletions.
2 changes: 1 addition & 1 deletion collector/images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
######### 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 \
{{ dir_bin }}/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 \
Expand Down
3 changes: 2 additions & 1 deletion collector/site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

- import_playbook: tree.yml # Create base directory tree
- import_playbook: secrets.yml # Collect Secrets
- import_playbook: images.yml # Pull cloudctl images & Download container images to directory
- import_playbook: tools.yml # Pull OpenShift oc, openshift-install, and kubectl binaries
- import_playbook: images.yml # Download OCP Infra Container Images
- import_playbook: bundle.yml # Bundle artifacts for airgap pivot
# import_playbook: upload.yml # Push artifacts to desired location
59 changes: 12 additions & 47 deletions collector/tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,53 +10,18 @@

tasks:

####### Place OpenShift Version Manifest
####### Place OpenShift Install Binary
- 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'
unarchive:
src: "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/{{ version_openshift }}/openshift-install-linux.tar.gz"
dest: '{{ dir_bin }}'
remote_src: yes
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
####### Place OpenShift Install Binary
- name: '{{ ansible_name_module }} | get_url:url | Place OpenShift release.txt | {{ version_openshift }}'
unarchive:
src: "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/{{ version_openshift }}/openshift-client-linux.tar.gz"
dest: '{{ dir_bin }}'
remote_src: yes
mode: 0775
1 change: 1 addition & 0 deletions collector/tree.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
mode: '0744'
recurse: yes
with_items:
- '{{ dir_bin }}'
- '{{ local_tmp }}'
- '{{ dir_platform }}'
- '{{ dir_platform }}/mirror'
Expand Down
1 change: 1 addition & 0 deletions collector/vars/global.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ ansible_ssh_common_args: '-o StrictHostKeyChecking=no'
# Directory Inventory
local_home: "{{ lookup('env', 'HOME') }}"
local_tmp: /tmp/koffer
dir_bin: "{{ dir_platform }}/bin"
dir_iac: "{{ dir_platform }}/iac"
dir_koffer: "{{ local_home }}/koffer"
dir_bundle: "{{ local_home }}/bundle"
Expand Down

0 comments on commit 44fba03

Please sign in to comment.