Skip to content

Commit 9597d2a

Browse files
committed
Fix Amphora register playbook failing when using TLS
CA certificate was not injected correctly for this playbook. Plus, using openstack.cloud.image Ansible module for renaming the existing old Amphora image.
1 parent a64b9fd commit 9597d2a

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

etc/kayobe/ansible/maintenance/octavia-amphora-image-register.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
vars:
2222
venv: "{{ virtualenv_path }}/octavia-amphora"
2323
image_path: "/tmp/amphora-x64-haproxy.qcow2"
24+
openstack_cacert: "{{ '/etc/pki/tls/certs/ca-bundle.crt' if os_distribution in ['centos', 'rocky'] else '/etc/ssl/certs/ca-certificates.crt' }}"
2425
tasks:
2526
- name: Get image checksum
2627
vars:
@@ -89,14 +90,25 @@
8990
vars:
9091
ansible_python_interpreter: "{{ venv }}/bin/python"
9192
ansible_host: "{{ hostvars[groups['controllers'][0]].ansible_host }}"
92-
ansible.builtin.command:
93-
cmd: >-
94-
{{ venv }}/bin/openstack image set amphora-x64-haproxy --name amphora-x64-haproxy-{{ ansible_facts.date_time.iso8601_basic_short }}
93+
openstack.cloud.image:
94+
auth_type: password
95+
auth: "{{ openstack_auth }}"
96+
ca_cert: "{{ openstack_cacert }}"
97+
interface: "{{ openstack_interface }}"
98+
id: "{{ image_info.images[0].id }}"
99+
name: "amphora-x64-haproxy-{{ ansible_facts.date_time.iso8601_basic_short }}" # Change the name
100+
tags: ["amphora"]
101+
container_format: bare
102+
disk_format: qcow2
103+
is_public: false
104+
filename: "{{ image_path }}"
105+
properties:
106+
hw_architecture: x86_64
107+
hw_rng_model: virtio
95108
when:
96109
- image_info.images | length != 0
97110
- image_info.images[0].checksum != image_checksum.stat.checksum
98111
changed_when: true
99-
environment: "{{ openstack_auth_env }}"
100112
delegate_to: "{{ groups['controllers'][0] }}"
101113

102114
- name: Ensure new Octavia Amphora image is registered

0 commit comments

Comments
 (0)