tripleo-ansible/tripleo_ansible/roles/octavia_undercloud/tasks/main.yml
Emilien Macchi c1959707db Remove all ignore_errors to avoid confusion when debugging
- octavia_controller_post_config: remove "ignore_errors: true". It's not
  supposed to be needed, since there is already a
  "failed_when: config_contents.rc != 0" which knows when to fail.

- octavia_undercloud, tripleo_cellv2, tripleo_ceph_common,
  tripleo_container_manage, tripleo_packages and tripleo_puppet_cache:
  replace "ignore_errors: true" by "failed_when: false" for debugging
  experience. We know the tasks can fail and we don't care, let's just
  not show them as failures in that case and force the task to never
  fail.

- tripleo_podman: instead of ignoring errors, check if the config file
  actually exists before wipping it out.

Change-Id: Ib3716e4823735a9db9bd3cac33b8daf0e5f3d186
2020-03-06 16:09:37 +00:00

76 lines
2.3 KiB
YAML

---
- name: set file if already set by heat variable (backwards-compatibility)
set_fact:
image_filename: "{{ amp_image_filename }}"
when:
- amp_image_filename is defined
- not ((amp_image_filename | length) < 1)
- name: set location if CentOS
set_fact:
image_filename: "/usr/share/openstack-octavia-amphora-images/amphora-x64-haproxy.qcow2"
when:
- ansible_distribution == 'CentOS'
- not (image_filename is defined)
- name: set location if Red Hat
set_fact:
image_filename: "/usr/share/openstack-octavia-amphora-images/octavia-amphora.qcow2"
when:
- ansible_distribution == 'RedHat'
- not (image_filename is defined)
- name: check if amphora image file exists
stat:
path: "{{ image_filename }}"
follow: true
get_md5: true
register: image_file_result
- include_tasks: image_mgmt.yml
when:
- image_file_result.stat.exists | bool
- name: use ssh pub key file if provided and is readable
block:
- name: check if pub key file exists
stat: path="{{ amp_ssh_key_path }}"
register: key_file_result
- name: fail if ssh pub key file does not exist or is not readable
fail: msg="{{ amp_ssh_key_path }} does not exist or is not readable by user {{ ansible_user }}"
when:
- (not (key_file_result.stat.exists | bool)) or (not (key_file_result.stat.readable | bool))
- name: Set final key fact
set_fact:
amp_ssh_key_path_final: "{{ amp_ssh_key_path }}"
when:
- amp_ssh_key_path is defined
- (amp_ssh_key_path | length) > 0
- name: defaulting to public key from undercloud default keypair
block:
- name: create temp pub key file
tempfile: state=file
register: ssh_key_tmp_file
- name: copy ssh public key content to temp file
copy: content="{{ amp_ssh_key_data }}" dest="{{ ssh_key_tmp_file.path }}"
- name: Set final key fact
set_fact:
amp_ssh_key_path_final: "{{ ssh_key_tmp_file.path }}"
when:
- amp_ssh_key_path is not defined or ((amp_ssh_key_path | length) < 1)
- name: upload pub key to overcloud
shell: |-
openstack keypair show {{ amp_ssh_key_name }} || \
openstack keypair create --public-key {{ amp_ssh_key_path_final }} {{ amp_ssh_key_name }}
environment:
OS_USERNAME: "{{ auth_username }}"
OS_PASSWORD: "{{ auth_password }}"
OS_PROJECT_NAME: "{{ auth_project_name }}"