123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- ---
- ######################################################################
- # Copying Examples
- #
- # We used to use the copy module to transfer the openshift examples to
- # the remote. Then it started taking more than a minute to transfer
- # the files. As noted in the module:
- #
- # "The 'copy' module recursively copy facility does not scale to
- # lots (>hundreds) of files."
- #
- # The `synchronize` module is suggested as an alternative, we can't
- # use it either due to changes introduced in Ansible 2.x.
- - name: Create local temp dir for OpenShift examples copy
- local_action: command mktemp -d /tmp/openshift-ansible-XXXXXXX
- become: False
- register: copy_examples_mktemp
- run_once: True
- - name: Create tar of OpenShift examples
- local_action: command tar -C "{{ role_path }}/files/examples/{{ content_version }}/" -cvf "{{ copy_examples_mktemp.stdout }}/openshift-examples.tar" .
- become: False
- register: copy_examples_tar
- - name: Create the remote OpenShift examples directory
- file:
- dest: "{{ examples_base }}"
- state: directory
- mode: 0755
- - name: Unarchive the OpenShift examples on the remote
- unarchive:
- src: "{{ copy_examples_mktemp.stdout }}/openshift-examples.tar"
- dest: "{{ examples_base }}/"
- - name: Cleanup the OpenShift Examples temp dir
- become: False
- local_action: file dest="{{ copy_examples_mktemp.stdout }}" state=absent
- # Done copying examples
- ######################################################################
- # Begin image streams
- - name: Modify registry paths if registry_url is not registry.access.redhat.com
- shell: >
- find {{ examples_base }} -type f | xargs -n 1 sed -i 's|registry.access.redhat.com|{{ registry_host | quote }}|g'
- when: registry_host != '' and openshift_examples_modify_imagestreams | default(False) | bool
- # RHEL and Centos image streams are mutually exclusive
- - name: Import RHEL streams
- command: >
- {{ openshift.common.client_binary }} {{ openshift_examples_import_command }} -n openshift -f {{ rhel_image_streams }}
- when: openshift_examples_load_rhel | bool
- register: oex_import_rhel_streams
- failed_when: "'already exists' not in oex_import_rhel_streams.stderr and oex_import_rhel_streams.rc != 0"
- changed_when: false
- - name: Import Centos Image streams
- command: >
- {{ openshift.common.client_binary }} {{ openshift_examples_import_command }} -n openshift -f {{ centos_image_streams }}
- when: openshift_examples_load_centos | bool
- register: oex_import_centos_streams
- failed_when: "'already exists' not in oex_import_centos_streams.stderr and oex_import_centos_streams.rc != 0"
- changed_when: false
- - name: Import db templates
- command: >
- {{ openshift.common.client_binary }} {{ openshift_examples_import_command }} -n openshift -f {{ db_templates_base }}
- when: openshift_examples_load_db_templates | bool
- register: oex_import_db_templates
- failed_when: "'already exists' not in oex_import_db_templates.stderr and oex_import_db_templates.rc != 0"
- changed_when: false
- - name: Import quickstart-templates
- command: >
- {{ openshift.common.client_binary }} {{ openshift_examples_import_command }} -n openshift -f {{ quickstarts_base }}
- when: openshift_examples_load_quickstarts | bool
- register: oex_import_quickstarts
- failed_when: "'already exists' not in oex_import_quickstarts.stderr and oex_import_quickstarts.rc != 0"
- changed_when: false
- - name: Import origin infrastructure-templates
- command: >
- {{ openshift.common.client_binary }} {{ openshift_examples_import_command }} -n openshift -f {{ infrastructure_origin_base }}
- when: openshift_examples_load_centos | bool
- register: oex_import_infrastructure
- failed_when: "'already exists' not in oex_import_infrastructure.stderr and oex_import_infrastructure.rc != 0"
- changed_when: false
- - name: Import enterprise infrastructure-templates
- command: >
- {{ openshift.common.client_binary }} {{ openshift_examples_import_command }} -n openshift -f {{ infrastructure_enterprise_base }}
- when: openshift_examples_load_rhel | bool
- register: oex_import_infrastructure
- failed_when: "'already exists' not in oex_import_infrastructure.stderr and oex_import_infrastructure.rc != 0"
- changed_when: false
- - name: Import xPaas image streams
- command: >
- {{ openshift.common.client_binary }} {{ openshift_examples_import_command }} -n openshift -f {{ xpaas_image_streams }}
- when: openshift_examples_load_xpaas | bool
- register: oex_import_xpaas_streams
- failed_when: "'already exists' not in oex_import_xpaas_streams.stderr and oex_import_xpaas_streams.rc != 0"
- changed_when: false
- - name: Import xPaas templates
- command: >
- {{ openshift.common.client_binary }} {{ openshift_examples_import_command }} -n openshift -f {{ xpaas_templates_base }}
- when: openshift_examples_load_xpaas | bool
- register: oex_import_xpaas_templates
- failed_when: "'already exists' not in oex_import_xpaas_templates.stderr and oex_import_xpaas_templates.rc != 0"
- changed_when: false
|