From 2486f456d421d1599c8e6688f0b3fb98d53b5f4f Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Wed, 7 Mar 2018 16:31:45 +0000 Subject: [PATCH] Install openstack client, inspector in clouds.yml Installs the openstack client unconditionally, not just when keystone is enabled. This allows us to communicate with ironic inspector, and a new bifrost-inspector entry has been added to clouds.yml in the noauth case to support this. Also adds a play to test-bifrost.yaml that exercises the openstack client by performing a node list and querying inspector rules. Change-Id: I19dfe3f63ba2c7fea7ce5881d7c8d0dff8f11264 --- .../roles/bifrost-ironic-install/tasks/install.yml | 6 ++++++ .../defaults/main.yml | 1 + .../templates/clouds.yaml.j2 | 3 +++ .../roles/bifrost-test-inspection/tasks/main.yml | 13 ++++--------- playbooks/test-bifrost.yaml | 13 +++++++++++++ .../notes/install-osc-c179e673dc338ab3.yaml | 7 +++++++ 6 files changed, 34 insertions(+), 9 deletions(-) create mode 100644 releasenotes/notes/install-osc-c179e673dc338ab3.yaml diff --git a/playbooks/roles/bifrost-ironic-install/tasks/install.yml b/playbooks/roles/bifrost-ironic-install/tasks/install.yml index 2962ca466..1d2bff3e4 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/install.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/install.yml @@ -77,6 +77,12 @@ # as a result. when: skip_install is not defined and install_dib | bool == true +- name: "OpenStack Client - Install" + include: pip_install.yml + package=python-openstackclient + extra_args="-c {{ upper_constraints_file }}" + when: skip_install is not defined + - name: "Ironic Client - Install" include: pip_install.yml package=python-ironicclient diff --git a/playbooks/roles/bifrost-keystone-client-config/defaults/main.yml b/playbooks/roles/bifrost-keystone-client-config/defaults/main.yml index dddd85cf6..61c17a196 100644 --- a/playbooks/roles/bifrost-keystone-client-config/defaults/main.yml +++ b/playbooks/roles/bifrost-keystone-client-config/defaults/main.yml @@ -1,2 +1,3 @@ --- ironic_api_url: "http://localhost:6385" +ironic_inspector_api_url: "http://localhost:5050" diff --git a/playbooks/roles/bifrost-keystone-client-config/templates/clouds.yaml.j2 b/playbooks/roles/bifrost-keystone-client-config/templates/clouds.yaml.j2 index de29b5bfe..7887b5842 100644 --- a/playbooks/roles/bifrost-keystone-client-config/templates/clouds.yaml.j2 +++ b/playbooks/roles/bifrost-keystone-client-config/templates/clouds.yaml.j2 @@ -17,4 +17,7 @@ clouds: bifrost: auth_type: "none" endpoint: {{ ironic_api_url }} + bifrost-inspector: + auth_type: "none" + endpoint: {{ ironic_inspector_api_url }} {% endif %} diff --git a/playbooks/roles/bifrost-test-inspection/tasks/main.yml b/playbooks/roles/bifrost-test-inspection/tasks/main.yml index daeef9c8e..603fec9d9 100644 --- a/playbooks/roles/bifrost-test-inspection/tasks/main.yml +++ b/playbooks/roles/bifrost-test-inspection/tasks/main.yml @@ -12,17 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. --- -# TODO(mgoddard): Ideally we would grab inspection data from ironic inspector -# rather than going direct to the web server. That would require either -# installing python-openstackclient, or creating an ansible module that uses -# python-ironic-inspector-client. - block: - name: Check node hardware inspection data - uri: - url: "{{ inspector_store_data_url ~ '/ironic-inspector/inspector_data-' ~ uuid }}" - method: GET - return_content: True + command: "openstack baremetal introspection data save {{ uuid }}" register: inspection_data + environment: + OS_CLOUD: "{% if enable_keystone | default(false) | bool %}bifrost{% else %}bifrost-inspector{% endif %}" # TODO(mgoddard): More validation of data format and contents. - name: Validate the inspection data format @@ -35,6 +30,6 @@ - "'interfaces' in inventory" - "'disks' in inventory" vars: - data: "{{ inspection_data.content | from_json }}" + data: "{{ inspection_data.stdout | from_json }}" inventory: "{{ data.inventory }}" when: inspector_store_data_in_nginx | bool diff --git a/playbooks/test-bifrost.yaml b/playbooks/test-bifrost.yaml index 3ea2d91e5..600af1bfd 100644 --- a/playbooks/test-bifrost.yaml +++ b/playbooks/test-bifrost.yaml @@ -102,6 +102,19 @@ - role: bifrost-test-inspection when: inspect_nodes | default('false') | bool == true +- hosts: localhost + name: "Tests the use of openstack clients" + connection: local + tasks: + - name: "List bare metal nodes using openstack client" + command: openstack baremetal node list + environment: + OS_CLOUD: bifrost + - name: "List introspection rules using openstack client" + command: openstack baremetal introspection rule list + environment: + OS_CLOUD: "{% if enable_keystone | default(false) | bool %}bifrost{% else %}bifrost-inspector{% endif %}" + when: enable_inspector | bool - hosts: baremetal name: "Create configuration drive files and deploy machines" diff --git a/releasenotes/notes/install-osc-c179e673dc338ab3.yaml b/releasenotes/notes/install-osc-c179e673dc338ab3.yaml new file mode 100644 index 000000000..f6c7b2373 --- /dev/null +++ b/releasenotes/notes/install-osc-c179e673dc338ab3.yaml @@ -0,0 +1,7 @@ +--- +features: + - | + Adds support for installing the ``openstack`` client, even when the + Identity service is disabled. If the Identity service is disabled, + also adds a new cloud in ``clouds.yml`` called ``bifrost-inspector`` + which references to the Bare Metal Introspection service.