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
This commit is contained in:
Mark Goddard 2018-03-07 16:31:45 +00:00
parent 0312ffa07f
commit 2486f456d4
6 changed files with 34 additions and 9 deletions

View File

@ -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

View File

@ -1,2 +1,3 @@
---
ironic_api_url: "http://localhost:6385"
ironic_inspector_api_url: "http://localhost:5050"

View File

@ -17,4 +17,7 @@ clouds:
bifrost:
auth_type: "none"
endpoint: {{ ironic_api_url }}
bifrost-inspector:
auth_type: "none"
endpoint: {{ ironic_inspector_api_url }}
{% endif %}

View File

@ -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

View File

@ -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"

View File

@ -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.