Commit Graph

89 Commits

Author SHA1 Message Date
Sharpz7 4529d48afe [codespell] Fixing Spelling Mistakes
This is the first in a series of commits to add support for codespell. This is continuning the process completed in ironic-python-agent.

Future Commits will add a Tox Target, CI support and potentially a git-blame-ignore-revs file if their are lots of spelling mistakes that could clutter git blame.

Change-Id: I41b2db35cdf21917ac20ed0866af3b9c94789f0b
2024-01-25 21:31:33 +00:00
Matt Crees a6ce283146 Replace Cirros references with generic descriptors
Often it is beneficial to use the functionality provided by `use_cirros`
and `cirros_deploy_image_upstream_url` to download and test with images
of other OS distributions. This patch changes the variable names to
reflect that use case.

`use_cirros` -> `download_custom_deploy_image`
`cirros_deploy_image_upstream_url` -> `custom_deploy_image_upstream_url`

The functionality of the old variables is retained for backwards
compatability.

Co-Authored-By: Alex Welsh <alex@stackhpc.com>

Change-Id: I8b3a973bd5ef19333af563c170b2a28fbbfb5c76
2023-08-10 11:41:32 +01:00
Pierre Riteau 7979498316 Skip unnecessary SDK get_machine calls
The _process_sdk function starts by calling cloud.list_machines() which
returns all nodes including their names. There is no need to call
cloud.get_machine individually for each node just to get its name
attribute when we might be skipping this node.

This speeds up execution of the Bifrost inventory module when
BIFROST_NODE_NAMES is used.

Change-Id: I27ccc12b9f408d510710d5ba82ad04135169827a
2023-05-11 15:28:54 +02:00
Dmitry Tantsur 059bd92b24 Rename include_dhcp_server -> enable_dhcp for consistency
Change-Id: Iff141df7adbe69775ce264d591be0466bd4a7e3b
2022-09-16 12:56:40 +02:00
Erik Berg 673318cf57 make sure we quote extra_kernel_options
argparse will remove quotations, breaking extra_kernel_options and
inspector_extra_kernel_options when more than one option is used, e.g.

  --extra-vars extra_kernel_options="console=tty1 console=ttyS0,115200n8"

Change-Id: I324e1681303115162656f39d7b6cd60a3e717b9f
2022-08-18 12:49:05 +02:00
Dmitry Tantsur e9577408b6 Deprecate os_ironic_node_info
The OpenStack ansible collection provides baremetal_node_info.

Change-Id: I1c8a28666e7e52f838423a9e4c6aa8475728069d
2022-07-06 15:03:45 +02:00
Zuul accab82f0c Merge "Use key as name if not provided in inventory yaml" 2022-06-01 07:52:57 +00:00
Dmitry Tantsur 2fb9e13c02 Prevent the enroll/deploy commands from running without venv
Running them without sourcing the venv configuration results in a very
confusing error message from ansible. Prevent that.

Change-Id: I0cc408b475134eb76d3229b9cccefb9555b4bcba
2022-04-26 17:09:54 +02:00
Erik Berg 235e5c956d Use key as name if not provided in inventory yaml
We don't really need to specify the name of the host in the yaml
if it's already be there in the key. YMMV.

Change-Id: I82a11e1ae9b89f0426b1cc12923fb700406a873b
2022-04-01 14:19:40 +02:00
Dmitry Tantsur f65b52ed8d Remove questionable defaults from the network configuration
We definitely should not default to using Google DNS or assuming a
specific MTU. The default gateway won't work for many deployments.

Remove them, refactor network_metadata and add some unit tests.

Change-Id: Icb5d077a5f68b5affc1ed545e04c96dcc01d9f3e
2022-02-18 12:43:03 +01:00
Dmitry Tantsur fb5b68313f Add `./bifrost-cli deploy` and refactor bifrost-deploy-nodes-dynamic
A new simplified command is added for deploying nodes, optionally
specifying an image.

The underlying role is updated to allow specifying a full image URL,
a configdrive URL or contents and a full checksum.

Change-Id: I6c99b01dc827c0bd2ef98eff73de4dfbac433fe1
2022-02-17 16:26:10 +01:00
Dmitry Tantsur 5821a662f5 Dynamic inventory: do not set network_interface
The same variable is used in Bifrost for a different purpose.

Change-Id: I3c9023a428314a83c0627496a7c488814efd837b
2022-02-16 16:36:19 +01:00
Zuul 4a95e1c2cf Merge "Stop using sub-sections of driver_info" 2022-02-16 11:13:40 +00:00
Dmitry Tantsur 73df7ea137 Stop using sub-sections of driver_info
They are deprecated in the ansible collection and do not match ironic.

Change-Id: I42b4e6f1c76b966d870297aa568a3e81d1967bc1
2022-01-25 16:11:20 +01:00
Dmitry Tantsur 9b83665d83 Generate an environment file during bifrost-cli install
It is recommended to pass the same variables (e.g. testing) to other
commands and playbooks, the new file makes it possible.

Change-Id: I2adc4e2dcfd8555b2c9e6c3bf0f512f603367091
2022-01-06 15:36:47 +01:00
Dmitry Tantsur 8346fbea52 Catch all exceptions from pbr when importing the root package
Apparently, pbr can raise a generic exception. Sigh.

Change-Id: Ib11494769fa42516c953a7efa782515875b0e32b
2021-12-02 15:00:53 +01:00
Dmitry Tantsur 69cbcf4348 Use UEFI by default and deprecate legacy boot
Change-Id: If31bb7e15dd1213b3b17f1aa2a80c0307f2fca91
2021-11-22 10:35:13 +01:00
Victor Morales 6027b173b9 Improve main function
The main function is wrapped with a sys.exit function[1] which has an optional
argument but the current implementation doesn't return a value in case of a
successful execution. This change ensures that main function returns a value
consumed by sys.exit function.

[1] https://docs.python.org/3/library/sys.html#sys.exit

Change-Id: I3b65db9ce57e53b8696e417bcfbd52c67ddb0b89
2021-08-06 11:15:17 -07:00
Dmitry Tantsur f0f6e6aa9e bifrost-cli: fix relative paths in --extra-vars
Ansible accepts YAML files via the syntax `-e @path.yaml`. Since
bifrost-cli changes the working directory to "playbooks", relative paths
don't work as expected. Fix that by turning them into global paths.

Change-Id: I02ba2ac85c72362dbc424037c3d23231098e065b
2021-07-19 14:39:44 +02:00
Zuul f521b9c4ae Merge "Remove explicit default from store_true" 2021-03-30 00:44:15 +00:00
Riccardo Pittau dfb34702a3 Allow disabling integrated dhcp from bifrost cli
Change-Id: I5cd45a247b9f1b1c05af1eab3b4a190e7351c411
2021-03-26 12:40:21 +01:00
Riccardo Pittau 296eba2443 Remove explicit default from store_true
The store_true action for argparse already default to False [0]

[0] https://docs.python.org/3/library/argparse.html#action

Change-Id: I2afa7068f9adc9536b4d96931fd518c065c56652
2021-03-24 16:00:20 +01:00
Dmitry Tantsur a93cb48663 Add `bifrost-cli enroll` command
Change-Id: I14979136e8c3befaabce9c6b169b5d6659f42812
2021-01-09 16:13:48 +01:00
Mark Goddard 71e26d1728 Fix missing node facts with BIFROST_INVENTORY_SOURCE=ironic
In Ussuri and earlier releases, the Bifrost custom inventory returns all
node fields as facts. Currently, most of these are returned as null.
This happened following the switch to openstacksdk. The plugin checks
for the presence of a properties field, and gets detailed node
information if it is missing. This worked with shade, but with
openstacksdk, the returned node object has most fields present but set
to null.

One of the most obvious consequences is that provisioning fails, since
the 'Deploy to hardware - Using custom instance_info.' task tries to use
the instance_info value of null.

This change fixes the issue by removing the check and always getting the
detailed node information.

Change-Id: Ia87c8332994f3b0f037ada953a299987bba246e5
Story: 2008394
Task: 41321
2020-11-27 12:19:52 +00:00
Dmitry Tantsur faa328d4b3 Support UEFI in bifrost-cli and document it
Change-Id: I829bd3454e1e6bc11f1631aef7ed8278c7b8bbe9
2020-11-17 17:35:23 +01:00
Pierre Riteau a6c56c6647 Force local connection for localhost
Starting with Ansible 2.9.10, the "Collecting node facts" task in
bifrost-configdrives-dynamic can fail because it tries to SSH to
localhost, which may not be possible in some environments, such as
Bifrost deployed as a container by Kolla.

Change-Id: I1ed19e325db9396ff6b250e14c967ce90c785201
Story: 2008260
Task: 41118
2020-10-19 22:52:27 +02:00
Pierre Riteau a04b285434 Add missing space in error message
Change-Id: I5080664506841e05c222c7efd213963f3aea336c
2020-10-14 18:33:07 +02:00
Iury Gregory Melo Ferreira 4f175fd5be Add ipe installation to bifrost
This commit adds support to install the Ironic Prometheus Exporter,
it's necessary to set `enable_prometheus_exporter=True` or pass
`--enable-prometheus-exporter` when using the `bifrost-cli`

Also the ipe is now enabled in the
bifrost-integration-tinyipa-keystone-ubuntu-bionic/centos8

Change-Id: I3972e88162fba31ad6e262f47b67a37cd37a2076
2020-10-01 16:50:35 +02:00
Zuul 96b0a74980 Merge "bifrost-cli: do not provide any release if non can be detected" 2020-09-23 18:26:10 +00:00
Zuul 2374283d6e Merge "Always setup environment in bifrost-cli and make it less verbose" 2020-09-22 11:11:40 +00:00
Dmitry Tantsur eaa04b1889 bifrost-cli: do not provide any release if non can be detected
We update defaults on each stable branch to match its release, so
if no release can be detected, let's not provide 'master'.

Change-Id: I01009307a066b6c60a97959764c31b5e7624708e
2020-09-18 12:13:56 +02:00
Dmitry Tantsur 08339c318b Discourage using non-matching versions of Bifrost and Ironic
Also explain how to get a non-master version when using playbooks.

Change-Id: I1f6dd65fab0e2d6456746fbdc0b49fbe26c6d52d
2020-09-16 17:38:27 +02:00
Dmitry Tantsur a874c7ac73 Always setup environment in bifrost-cli and make it less verbose
For upgrades we need bifrost-cli to always try to setup environment
(e.g. in case of a different ansible version). To avoid polluting
the output, make `set -x` conditional on a new variable BIFROST_TRACE.

Change-Id: I8caea6be0962db0e7019d0aa1484ef2424b7629e
2020-09-08 12:47:56 +02:00
Dmitry Tantsur 28c08488a5 Remove unnecessary overrides of ansible_python_interpreter
Bifrost cannot operate in virtual environments without system site
packages, so overriding ansible_python_interpreter to system Python
is not necessary.

Document this limitations.

Change-Id: I669c4e248d23f65015533635ed09dcaf60f8f8f2
2020-09-07 17:33:03 +02:00
Dmitry Tantsur ddafc94e30 TLS support for API services
Change-Id: I084da313eda17435c095ade7cb1b92981f5341dc
2020-09-02 18:23:40 +02:00
Zuul 077acae503 Merge "Remove support for the legacy CSV format" 2020-09-01 18:06:41 +00:00
Dmitry Tantsur 114c21043c Move services to internal_ip by default and refactor endpoint creation
We're currently defaulting to localhost which makes clouds.yaml/openrc not
portable and complicates TLS configuration. Moving to internal_ip makes it
possible to just copy clouds.yaml around.

Refactored endpoint creation in keystone to use the openstack modules and
to avoid copy-pasting authentication information. As a side effect, it
becomes possible to update existing endpoints.

The use_public_urls variable loses most of its sense now and is replaced
by explicitly checking for public_ip.

Change-Id: I48b5ab9aa656abbddd619df4bed6be9bf3766da5
2020-08-31 13:40:16 +02:00
Dmitry Tantsur 790f81c3a8 Remove support for the legacy CSV format
Change-Id: I11f4976fbd48e552990f2a1890cea7201bbbb024
2020-08-25 12:22:12 +02:00
Dmitry Tantsur 2cf21258af Remove support for non-venv deployments
It has been deprecated and untested since ussuri, time to move on.

Change-Id: Ieddda38b12d07a2a5c51650850b150dd82f332a9
2020-08-25 11:08:09 +02:00
Dmitry Tantsur bcda97b630 Support HTTP basic auth and switch bifrost-cli to it
The voting jobs also use the new mode (since it requires more OS
coverage), the DHCP jobs are left with no-auth.

Change-Id: I8c8ee112edbc1e61b54aff13c06c518c7daa9700
2020-08-07 15:21:27 +02:00
Dmitry Tantsur 02fb11fcc7 Support redfish emulation and run the keystone jobs with redfish
Prepare for UEFI support that will be finished in follow-up patches.

Change-Id: I18d034239edd3d49ceedf281b48a650e6011bab4
2020-08-07 15:20:54 +02:00
Dmitry Tantsur 1dc4564b52 Add developer mode to bifrost
Installs all source packages with --editable flag, so that they can be
edited in-place.

Change-Id: Iba0be299aeb3ffe75e644c88d3df9c2af4ec9ef1
2020-07-31 19:20:43 +02:00
Zuul 8bae4d550d Merge "bifrost_inventory: use stderr for logging" 2020-07-29 13:47:10 +00:00
Zuul c081db93b3 Merge "Make ansible ask for sudo password" 2020-07-24 18:36:09 +00:00
Dmitry Tantsur ac2c136049 bifrost_inventory: use stderr for logging
Logging to stdout is not visible to ansible, resulting in empty
error messages.

Change-Id: I26ad4ffc1fe5dc0b51b185c1c13cfa2a6e010e90
2020-07-24 14:21:02 +02:00
Riccardo Pittau 639d9a58b3 Make ansible ask for sudo password
If the user used to install and run bifrost can't run sudo
passwordless, the bifrost-cli appends the --ask-become-pass option
that makes ansible ask for the BECOME password, used to run
commands with become set to true.

Change-Id: I7148243b19baa8bfdd652827a9280d469622e3f3
2020-07-21 14:50:52 +02:00
Dmitry Tantsur b67115d48c Support extra-vars in bifrost-cli
Use it to provide git_url_root in the CI

Change-Id: I99a3a202125f5ca805030a2363729aa81c8f5b4e
2020-07-21 14:50:02 +02:00
Dmitry Tantsur d5b49bd498 Enable metadata cleaning by default
We used to disable cleaning because only full disk cleaning was
available. Enable metadata cleaning by default and add an option
to enable full cleaning.

Change-Id: Ie1198768889bd468176cd68c8ccb48791c724262
2020-07-17 16:53:12 +02:00
Dmitry Tantsur a47db1e302 Account for bugfix branches in bifrost-cli
Fall back to the default branch unless an explicit one is provided.

Change-Id: I960fc1ab98f89feaf57d1b0aee7502ab0612a487
2020-07-09 13:12:48 +02:00
Dmitry Tantsur f5906a9aff Derive enabled hardware interfaces from enabled_hardware_types
This greatly simplifies initial configuration. The simple CLI
now defaults to the community hardware types.

Change-Id: If4bee8ee3e3349742e360fd44f1f5f93b4913aed
2020-06-22 15:21:30 +02:00