--- ############################################################################### # Perform overcloud image build and/or uploads # # Description: # This is a basic playbook that can be used to build and/or upload overcloud # images into the undercloud. This playbook assumes that the repositories # are already configured on the undercloud and checks that the tripleoclient # is installed. # ############################################################################### - hosts: undercloud gather_facts: true collections: - tripleo.operator vars: images_debug: true build_images: true upload_images: true tripleo_overcloud_image_build_output_directory: "{{ ansible_env.HOME }}/images" tripleo_overcloud_image_build_dib_yum_repo_conf: "/etc/yum.repos.d/*" tripleo_overcloud_image_build_extra_env_vars: {} tripleo_overcloud_image_upload_update_existing: true tasks: - name: Gather the rpm package facts package_facts: - name: Check if tripleoclient is installed fail: msg: >- TripleO Client is not installed. Please make sure that the client has been installed and the repositories are properly configured. when: (ansible_facts.distribution_major_version|int <= 7 and not 'python2-tripleoclient' in ansible_facts.packages) or (ansible_facts.distribution_major_version|int >= 8 and not 'python3-tripleoclient' in ansible_facts.packages) - name: Set distribution variables set_fact: distro_name: "{{ (ansible_facts.distribution == 'RedHat') | ternary('rhel', 'centos') }}" distro_version: "{{ ansible_facts.distribution_major_version | int }}" - name: Ensure image folder exists file: path: "{{ tripleo_overcloud_image_build_output_directory }}" state: directory mode: '0755' owner: "{{ ansible_env.USER }}" - name: Build images include_role: name: tripleo_overcloud_image_build vars: tripleo_overcloud_image_build_debug: "{{ images_debug }}" tripleo_overcloud_image_build_config_files: - /usr/share/openstack-tripleo-common/image-yaml/overcloud-images.yaml - /usr/share/openstack-tripleo-common/image-yaml/overcloud-images-{{ distro_name }}{{ distro_version }}.yaml when: build_images|bool - name: Upload images include_role: name: tripleo_overcloud_image_upload vars: tripleo_overcloud_image_upload_debug: "{{ images_debug }}" tripleo_overcloud_image_upload_os_cloud: undercloud tripleo_overcloud_image_upload_image_path: "{{ tripleo_overcloud_image_build_output_directory }}" when: upload_images|bool