aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Riteau <pierre@stackhpc.com>2024-12-12 22:24:37 +0100
committerPierre Riteau <pierre@stackhpc.com>2024-12-12 22:24:37 +0100
commit1916b3c2ad1d261537ff05f608f805e5fefd4a54 (patch)
tree8a6622603c7ba44eeee4bb461347e9635efc40df
parent81a5a7cf4d7a27a7c98cc968506b9f44cda257e7 (diff)
downloadkolla-ansible-1916b3c2ad1d261537ff05f608f805e5fefd4a54.tar.gz
kolla-ansible-1916b3c2ad1d261537ff05f608f805e5fefd4a54.zip
Generate system scoped public-openrc
It can be useful to run Ironic commands on the public API if access to the internal API is not possible. Related-Bug: #2051837 Change-Id: Ice0eb62f2bb26ca6e3ac8d02c6ea787b60408a86
-rw-r--r--ansible/post-deploy.yml9
-rw-r--r--ansible/roles/common/templates/public-openrc-system.sh.j215
-rw-r--r--releasenotes/notes/public-openrc-system-e52c9f5440b6f594.yaml7
3 files changed, 31 insertions, 0 deletions
diff --git a/ansible/post-deploy.yml b/ansible/post-deploy.yml
index 9b3a0b9d0..1203ebf90 100644
--- a/ansible/post-deploy.yml
+++ b/ansible/post-deploy.yml
@@ -50,6 +50,15 @@
group: "{{ ansible_facts.user_gid }}"
mode: 0600
+ - name: Template out public-openrc-system.sh
+ become: true
+ template:
+ src: "roles/common/templates/public-openrc-system.sh.j2"
+ dest: "{{ node_config }}/public-openrc-system.sh"
+ owner: "{{ ansible_facts.user_uid }}"
+ group: "{{ ansible_facts.user_gid }}"
+ mode: 0600
+
- import_role:
name: octavia
tasks_from: openrc.yml
diff --git a/ansible/roles/common/templates/public-openrc-system.sh.j2 b/ansible/roles/common/templates/public-openrc-system.sh.j2
new file mode 100644
index 000000000..6c9f52f33
--- /dev/null
+++ b/ansible/roles/common/templates/public-openrc-system.sh.j2
@@ -0,0 +1,15 @@
+# {{ ansible_managed }}
+
+# Clear any old environment that may conflict.
+for key in $( set | awk '{FS="="} /^OS_/ {print $1}' ); do unset $key ; done
+export OS_USER_DOMAIN_NAME=Default
+export OS_SYSTEM_SCOPE=all
+export OS_USERNAME={{ keystone_admin_user }}
+export OS_PASSWORD={{ keystone_admin_password }}
+export OS_AUTH_URL={{ keystone_public_url }}
+export OS_IDENTITY_API_VERSION=3
+export OS_REGION_NAME={{ openstack_region_name }}
+export OS_AUTH_PLUGIN=password
+{% if kolla_admin_openrc_cacert is not none and kolla_admin_openrc_cacert | length > 0 %}
+export OS_CACERT={{ kolla_admin_openrc_cacert }}
+{% endif %}
diff --git a/releasenotes/notes/public-openrc-system-e52c9f5440b6f594.yaml b/releasenotes/notes/public-openrc-system-e52c9f5440b6f594.yaml
new file mode 100644
index 000000000..9e5573b13
--- /dev/null
+++ b/releasenotes/notes/public-openrc-system-e52c9f5440b6f594.yaml
@@ -0,0 +1,7 @@
+---
+features:
+ - |
+ Generates a system-scoped ``public-openrc-system.sh`` file. This allows
+ running Ironic commands against the public API, which is useful when access
+ to the internal API is unavailable.
+ `LP#2051837 <https://launchpad.net/bugs/2051837>`__