From beb404f19abe3fc0330886e684e105187cf859de Mon Sep 17 00:00:00 2001 From: Olivier Bourdon Date: Tue, 2 Oct 2018 14:36:36 +0200 Subject: [PATCH] Allow to specify the public IP to be used for public endpoints This complements a previous patchset in case the Bifrost deployment user would like to set a specific value instead of using the interface IP value. This could be useful in case NAT is used for instance. Change-Id: I67e45c98473de35c08feb67a9f792270230f6499 --- .../bifrost-ironic-install/tasks/keystone_setup.yml | 2 +- .../tasks/keystone_setup_inspector.yml | 2 +- .../bifrost-keystone-install/tasks/bootstrap.yml | 2 +- ...custom-public-endpoints-ip-4662c246f029589e.yaml | 13 +++++++++++++ 4 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 releasenotes/notes/allow-custom-public-endpoints-ip-4662c246f029589e.yaml diff --git a/playbooks/roles/bifrost-ironic-install/tasks/keystone_setup.yml b/playbooks/roles/bifrost-ironic-install/tasks/keystone_setup.yml index 12c07154e..fca621d4a 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/keystone_setup.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/keystone_setup.yml @@ -170,7 +170,7 @@ - name: "Setting external Ironic public URL" set_fact: - ironic_public_url: "{{ ironic.keystone.public_url | default('http://127.0.0.1:6385/') | replace('127.0.0.1', hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address']) }}" + ironic_public_url: "{{ ironic.keystone.public_url | default('http://127.0.0.1:6385/') | replace('127.0.0.1', public_ip | default(hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address'])) }}" when: use_public_urls | default(false) | bool - name: "Create ironic public endpoint" diff --git a/playbooks/roles/bifrost-ironic-install/tasks/keystone_setup_inspector.yml b/playbooks/roles/bifrost-ironic-install/tasks/keystone_setup_inspector.yml index 32d3faa3f..99121a1f8 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/keystone_setup_inspector.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/keystone_setup_inspector.yml @@ -149,7 +149,7 @@ - name: "Setting external ironic-inspector public URL" set_fact: - ironic_inspector_public_url: "{{ ironic_inspector.keystone.public_url | default('http://127.0.0.1:5050/') | replace('127.0.0.1', hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address']) }}" + ironic_inspector_public_url: "{{ ironic_inspector.keystone.public_url | default('http://127.0.0.1:5050/') | replace('127.0.0.1', public_ip | default(hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address'])) }}" when: use_public_urls | default(false) | bool # NOTE(TheJulia): This seems like something that should be diff --git a/playbooks/roles/bifrost-keystone-install/tasks/bootstrap.yml b/playbooks/roles/bifrost-keystone-install/tasks/bootstrap.yml index d186a7812..87c33eca8 100644 --- a/playbooks/roles/bifrost-keystone-install/tasks/bootstrap.yml +++ b/playbooks/roles/bifrost-keystone-install/tasks/bootstrap.yml @@ -163,7 +163,7 @@ - name: "Setting external Keystone public URL" set_fact: - keystone_public_url: "{{ keystone.bootstrap.public_url | replace('127.0.0.1', hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address']) }}" + keystone_public_url: "{{ keystone.bootstrap.public_url | replace('127.0.0.1', public_ip | default(hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address'])) }}" when: use_public_urls | default(false) | bool - name: "Bootstrap Keystone Database" diff --git a/releasenotes/notes/allow-custom-public-endpoints-ip-4662c246f029589e.yaml b/releasenotes/notes/allow-custom-public-endpoints-ip-4662c246f029589e.yaml new file mode 100644 index 000000000..4dc5e4a4b --- /dev/null +++ b/releasenotes/notes/allow-custom-public-endpoints-ip-4662c246f029589e.yaml @@ -0,0 +1,13 @@ +--- +features: + - | + By adding extra string variable ``-e public_ip=8.8.8.8`` + which is to be used in conjunction with ``use_public_urls=true`` + Bifrost, if used with Keystone enabled, will configure + public services endpoints (for Keystone, Ironic and Ironic + Inspector) to contain this public IP address in replacement + of the default values which are set to point to localhost. + + The default behaviour is kept unchanged, which means that + services public endpoints will contain references to + localhost aka 127.0.0.1.