Commit Graph

14 Commits

Author SHA1 Message Date
Pavlo Shchelokovskyy 725b85484f Remove Ansible-deploy interface
it is now part of ironic itself, and version in ironic-staging-drivers
conflicts with version in ironic, blocking ironic-conductor from
starting when ironic-staging-drivers is installed.

Change-Id: I917b7399b3249143ba6cf75f61d96a1c64f94e7d
2017-12-18 14:55:35 +02:00
Pavlo Shchelokovskyy 0e21965a8f Do not monkey-patch in ansible unit tests
some unit tests for ansible deploy interface were using
dumb monkeypatch instead of proper mocking.

Change-Id: I317e1b8e9f0ec4cb792ee09ce592cbd83f956b75
2017-10-14 13:40:44 +03:00
Pavlo Shchelokovskyy 0cdc53948f [ansible] configure SSL validation
This patch adds a number of configration options and playbook variables
that govern SSL validation and authentication when accessing the image
store to download the image and configdrive from the deploy ramdisk.

Most of them are not yet used in the default set of playbooks provided
with the driver
(for example some of them require yet unreleased Ansible 2.4),
however they can be used by custom playbooks, for example to upload
and enable those custom CA bundle and cert files to the ramdisk at
deploy time.

This patch also sets DevStack to disable validation of image store SSL
certificate by ansible deploy interface (similar to how IPA is currently
confugured).

This patch also caps Anisble < 2.4, since our custom callback plugin
has troubles with the newest Ansible 2.4 version (to be fixed later).

Change-Id: Id40f1067361cc32e98973c70fc5cd3d4242308d0
Closes-Bug: #1717858
2017-09-25 10:48:24 +00:00
Yuriy Zveryanskyy 84b1b0d34e [ansible] Add basic root device hints support
This patch adds support for Ironic root hints to ansible deploy driver.

The advanced root hints based on oslo.utils operators are not supported yet,
only exact matches.

Change-Id: I6fd468cfa9a7792fa0e55aa58c337396e13d76ee
2017-06-16 19:25:58 +00:00
Pavlo Shchelokovskyy 1d6b1b89d2 [ansible] Improve partition images support
- partitioning scheme now closer resembles what's being done by IPA

  - for partition images the root partition is last so that it can grow
  - for whole-disk images, configdrive is created as far as possible

- added support for setting disk label for created partition table,
  supported are 'gpt' and 'msdos' (default)

  - for 'gpt' disks, a bios_grub partiton is prepended to standard ones

- 'parted' module for Ansible was renamed to ``ironic_parted`` to not
  shadow ``parted`` module included in Ansible 2.3
  It was also rewritten to be cleaner and more stable:

  - changed accepted module arguments
  - added support for units (MiB and % for now)
  - added more validations
  - left support for msdos and gpt partition tables only
  - partitions are created one by one, and actual block devices created
    are searched for and reported.
  - module returns only after all partitions are available for write

Change-Id: I4d6d7619c6f3ba25c29263ffe5d778698e598429
2017-06-16 19:25:51 +00:00
Pavlo Shchelokovskyy b963a18c63 [ansible] Major changes in playbooks "API"
Possibly existing out-of-tree playbooks will be imcompatible
with this version and must be rewritten!

Changes include:

- all info passed into ansible playbooks from ironic is now available in
  the playbooks as elements of 'ironic' dictionary to better differentiate
  those from other vars possibly created/set inside playbooks.

- any field of node's instance_info having a form of "image_<field>"
  is now available in playbooks as "ironic.image.<field>" var.

- 'parted' tag in playbooks is removed and instead differentiation
  between partition and whole-disk imaged is being done based on
  ironic.image.type var value.

- 'shutdown' tag is removed, and soft power-off is moved to a separate
  playbook, defined by new driver_info field 'ansible_shutdown_playbook'
  ('shutdown.yaml' by default)

- default 'deploy' role is split into smaller roles,
  each targeting a separate stage of deployment process
  to faciliate customiation and re-use

    - discover - e.g. set root device and image target
    - prepare - if needed, prepare system, e.g. create partitions
    - deploy - download/convert/write user image and configdrive
    - configure - post-deployment steps, e.g. installing the bootloader

Documentation is updated.

Change-Id: I158a96d26dc9a114b6b607267c13e3ee1939cac9
2017-06-12 13:47:18 +00:00
Pavlo Shchelokovskyy e1ece310fa [ansible] honor deploy_forces_oob_reboot
To use this driver property, tasks that soft poweroff the deploy ramdisk
in-band are tagged with additional 'shutdown' tag and are executed
separately.

Change-Id: Ie7bae9dd9fa17a764599390362e1c7f6926c7746
2017-05-15 17:21:11 +00:00
Pavlo Shchelokovskyy 6e8cd3163f [ansible] driver refactoring
make driver much closer to AgentDeploy by reusing HeartbeatMixin and
implementing other required methods

This effectively requires ironic version > 7.0

Change-Id: I9ba5186ecdae49a17785a109341050c828c849cc
2017-05-15 17:21:02 +00:00
Pavlo Shchelokovskyy 77326e7a5c [ansible] improve cleaning
- make cleaning re-use url from agent heartbeat as node ip
- improve validation of cleaning steps
  - require step names to be present and unique

Change-Id: I63067c2d91a05673f5f46c38a4ffbc9c0999342c
2017-05-15 15:07:28 +00:00
Pavlo Shchelokovskyy 6eaf42f11f [ansible] reuse build_instance_info_for_deploy
this function was moved to common place in deploy_utils and now can be
easily reused.

Also, it does basic disk layout parsing and validation so there is no
more need to do it in ansible-deploy driver.

Change-Id: I2054dc1f124a62ef1f45c8a0dad0b755e8de23ea
2017-05-08 16:56:21 +00:00
Pavlo Shchelokovskyy 92865503a7 Update style checkers
bring ironic_staging_drivers pep8 checks in line with main ironic:
- update hacking version to the one from g-r
- add import order checks, with the same style
- enable same additional checks from hacking

Only two small violations found, so better to update now while it's
easy.

Change-Id: I12459a1ffdb122f50ce25230e310412f18717ef5
2017-03-17 20:37:57 +00:00
Vladyslav Drok 9de213f26f Change cleaning methods to use network interface
As part of the commit a9a1293312ca67c5e5dbb258146832516a41e939
to ironic, prepare_cleaning_ports and tear_down_cleaning_ports
methods from deploy_utils module were removed. This change
replaces their usage with network interface's add_cleaning_network
and remove_cleaning_network methods.

Closes-Bug: #1644874
Change-Id: I139c6284f93a63fbd5a02eef18610c7df236d2db
2016-11-25 19:49:25 +02:00
Anton Arefiev 52dac91217 Don't log success cleaning if ansible fails
If ansible fails cleaning, it's log "Ansible completed cleaning ...",
the reason - missing 'else' statement.

Change-Id: I418012daeb7377b3dad983bb17e06317b623bb22
2016-10-20 16:23:50 +03:00
Pavlo Shchelokovskyy ffd006e098 Add Ansible-deploy driver
Requires Ironic API >= 1.22 when using heartbeats to Ironic API.

For better logging and proper deployment failure handling,
Ironic should be > '6.1.1.dev147' version.

Tested with and targets Ansible >= 2.1

Experimental DIB element: I3f6c3baf0197d27f2d423f52611666ca186cd0a4
Experimental TinyCore-based bootstrap:
Ie39ce67dc93e7d53bf75937c7defacafad5fbfcf

Tested with DevStack, Bifrost and Mirantis OpenStack,
with both VMs and real IPMI hardware.
Tempest's baremetal_server_basic_ops test reliably passes on DevStack
with `pxe_ssh_ansible` driver.

More elaborate documentation will be proposed in next changes.

Change-Id: Ib9317d365d7bc39aa00a9d9e1eadddd2f9b2947f
Related-bug: #1526308
Co-Authored-By: Yuriy Zveryanskyy <yzveryanskyy@mirantis.com>
2016-09-16 21:54:24 +03:00