50 Commits

Author SHA1 Message Date
Mark Goddard
d28635d2cf Changes to support standalone ironic
For standalone ironic deployments, such as those deployed using bifrost, there
is typically no keystone or placement service running. Use of the ironic API is
without authentication. We use clouds.yaml in this case.

Change-Id: I61ed791d019e43f6dfc632fa185f079b385c290c
Story: 2004425
Task: 28077
2018-12-20 09:48:21 +00:00
Mark Goddard
1a0d953737 Support ocata release of ironic
In the Ocata release, the physical_network field of ports did not exist.
The safest thing to do is to simply ignore it in this case.

It is also possible for the local_link_connection fields to not have switch_id,
switch_info or port_id attributes, so we now use .get(attr) to avoid an
attribute lookup error.

Change-Id: Ib4829dbd89fcedc121f493d6af76702421b399f7
TrivialFix
2018-12-19 18:55:36 +00:00
Mark Goddard
a30ac7de48 Fix ansible-lint nits
Ansible lint has become more fussy about its nit picking, blocking CI.

This change makes it happy again.

Change-Id: Ifb86c5e071697acda014bb543cab7ebf2b648dc9
2018-12-19 18:55:36 +00:00
Mark Goddard
347ee1cc7f Fix skipping glance check if deploy images not defined
Somewhere along the line, the default None value for deploy_kernel and
deploy_ramdisk gets converted to a string. Allow for both possibilities.

Change-Id: Ia06bff344262f82956da1d6548bae9a30fcdffd9
TrivialFix
2018-11-26 10:43:57 +00:00
Mark Goddard
1e2bd2cc2f Fail nicely if ironic port lookup fails
Change-Id: I7e1a937b2870af08a6748adf9dcfa71d49be9957
TrivialFix
2018-11-26 10:38:29 +00:00
Mark Goddard
6a2fb44a78 Fix deploy and teardown without node enrolment
If the ironic_config field is not present in a node definition, then
that node should not be registered with ironic. In this case we also
don't need to query glance for images or wait for resources to appear
in placement.

If nova_flavors is empty, we do not need to register flavors, so no need
to install the client or check for OS_USERNAME.

Also fixes an issue in the action plugin where it would fail if
ironic_config field is not present in a node definition.

Finally, in CI deploy/teardown tests, rather than skipping tasks, we now
remove the ironic_config field from the node definition, and set
nova_flavors to empty, such that we exercise these code paths.

Change-Id: I29b42665f1609c99e80f12ab6f3815d0e0918dae
Story: 2004412
Task: 28056
2018-11-22 19:20:59 +00:00
Zuul
6545bf3fa2 Merge "Add support for setting the libvirt connection uri" 2018-11-20 17:17:38 +00:00
Will Szumski
ffcdee61dd Add support for setting the libvirt connection uri
This, for example, allows you to run libvirt with non-default
socket path.

Change-Id: Ia01f39f425cccc6acebd31f77b46b1948e24d215
Story: 2004344
Task: 27935
2018-11-19 17:41:01 +00:00
Will Szumski
d4e7e58619 Wait for resources to become available
This will wait for any resources that are created to become available
before exiting the script. This allows you to avoid a race condition
where a server could be created before the resource tracker had been
updated with the new resources; server creation would fail.

Change-Id: I57f8c93cb1ebbc284b96ef1ced2c4edd59b27795
Story: 2004274
Task: 27823
Depends-On: https://review.openstack.org/617642
2018-11-19 16:40:43 +00:00
Will Szumski
602fdfa26b Remove dependency on bridge-utils
bridge-utils is considered legacy and many distributions do
not ship it as default.

Change-Id: Id2f9d779d12a5135d7d7e7a4783c6f3a0c8647ca
Story: 2004302
Task: 27861
2018-11-08 15:15:30 +00:00
Will Szumski
a5e1b65756 Only set Ironic port attributes when changed
This fixes a lint issue:

[301] Commands should not change things if nothing needs doing
/home/will/code/tenks/ansible/roles/ironic-enrolment/tasks/port.yml:20
Task/Handler: Set Ironic port attributes

TrivialFix

Change-Id: I7940fe25d3518daf268484e292e337abc925080d
2018-11-02 17:27:10 +00:00
jovial
7a04432226
Merge pull request #25 from jovial/usr-bin
Use /usr/bin/virsh instead of /bin/virsh
2018-10-03 17:40:30 +01:00
Will Szumski
bc66151567 Use /usr/bin/virsh instead of /bin/virsh
On RedHat based distros /bin/ is a symlink to /usr/bin:

[will@dev-director ~]$ ls -lia /bin
410146 lrwxrwxrwx. 1 root root 7 Jun 11 12:07 /bin -> usr/bin

Whereas on the Ubuntu it is seperate directory. Using
/usr/bin/virsh should work on both.

ubuntu:

stack@ubuntu:~/ansible-role-libvirt-vm$ whereis virsh
virsh: /usr/bin/virsh /usr/share/man/man1/virsh.1

centos:

[will@dev-director ~]$ whereis virsh
virsh: /usr/bin/virsh /usr/share/man/man1/virsh.1.gz

Also removed a misleading comment. QEMU uses differnt
"instances" for privaleged and user access i.e the
"system" and "session" instances. The comment seemed
to suggest using /bin/virsh would connect to the
system instance (at least that is how I read it).
2018-10-01 13:47:18 +01:00
Will Szumski
7ef64ff974 Support Debian based GNU/Linux distributions
- use package module instead of yum
- libvirt-devel is called libvirt-dev on debian based
  distributions
2018-10-01 09:49:34 +01:00
Mark Goddard
14e508588b
Merge pull request #18 from w-miller/veth-up
Bring each end of veth pair up after creation
2018-09-21 17:58:33 +01:00
Will Miller
f0adf96145 Bring each end of veth pair up after creation 2018-09-21 16:49:45 +00:00
Will Miller
e81eb6d6ca Move deploy image ID finding to enrolment role
The OpenStack client Python package is not necessarily installed in the
Tenks virtualenv until the role is run, so we need to query OpenStack
for the image IDs inside the role.
2018-09-21 16:17:11 +00:00
Will Miller
5e21655f8b Allow deploy_kernel/ramdisk names to be specified
You can now use either a name or a UUID for these images. Also, remove
the unnecessary setting of node states, which is now handled by the
scheduling plugin.
2018-09-20 16:55:56 +00:00
Will Miller
99eaf48098 Persist physnet indices in state file
Instead of overwriting the physnet mappings specified in the Tenks
configuration, create a separate dict that maps physnet names to their
indices. Like physnet_mappings, this will be present for each
hypervisor.
2018-09-14 10:27:21 +00:00
Will Miller
a9250954b4 Allow teardown in Ironic enrolment 2018-09-10 15:47:48 +00:00
Will Miller
ee0600fab6 Allow teardown of Nova flavors 2018-09-10 15:33:43 +00:00
Will Miller
fbd489dddf Rename virtualbmc-domain internal variable
The variable 'cmd' conflicts with the Tenks global variable.
2018-09-10 14:46:53 +00:00
Will Miller
956351629f Fix veth-pair role for teardown
* Don't delete the OVS bridge specified, as it will already be deleted
  when the role is called.
* Clarify the behaviour of the role for each value of `cmd` in the
  README.
* Succintify main.yml.
2018-09-10 14:45:37 +00:00
Will Miller
39bc329cd1 Add 'teardown' action to virtualbmc-domain role 2018-09-10 14:19:06 +00:00
Will Miller
24f47ca36a Add 'teardown' action to veth-pair role 2018-09-10 14:19:06 +00:00
Will Miller
d391312d12 Merge branch 'master' into resource-classes
Conflicts:
	ansible/action_plugins/tenks_schedule.py
2018-09-07 14:54:19 +00:00
Will Miller
2789a56ef7 Extract Ironic node extra specs dicts
It improves readability to have each dict defined separately.
2018-09-07 14:36:24 +00:00
Will Miller
94aee5d0ce Set interfaces and properties on Ironic nodes
Pass any interface that was specified through to Ironic; otherwise, let
Ironic decide a default for it. Also, pass through any property
key-value pairs we get.
2018-09-07 14:36:22 +00:00
Will Miller
0fdd4ec011 Remove 'bmc type' concept
We can directly refer to a node's Ironic driver rather than having an
abstraction for a BMC type.
2018-09-07 13:03:58 +00:00
Will Miller
7f21b4c8c1 Copy requirements file to remote host
The pip module requires that the requirements.txt file exists on the
remote host, so copy it to a temporary location.
2018-09-07 13:24:01 +01:00
Will Miller
af98a20249 Fix upper constraints typo 2018-09-07 13:21:29 +01:00
Will Miller
8d02c28e5a Add Nova flavor registration 2018-09-06 16:53:20 +00:00
Will Miller
c8e4681c28 Use node ironic_config details during enrolment 2018-09-06 14:52:36 +00:00
Will Miller
c89a70bd94 Remove properties from Ironic nodes
These are no longer used, in favour of resource classes.
2018-09-06 09:29:37 +00:00
Will Miller
666f294c20 Merge remote-tracking branch 'origin/master' into ironic-enrolment
Conflicts:
	ansible/deploy.yml
2018-09-06 08:38:08 +00:00
Will Miller
84ef8cd8ee Fix PEP8 and ansible-lint warnings 2018-09-06 08:31:24 +00:00
Will Miller
0b340a1bae Fix IPMI address typo 2018-09-05 14:05:26 +00:00
Will Miller
81f1696263 Add Ironic enrolment Ansible role 2018-08-31 16:57:34 +00:00
Mark Goddard
32fcca4a06
Use loop rather than with_items 2018-08-30 14:35:31 +01:00
Mark Goddard
e007012859 Install package dependencies for virtualbmc daemon
These are required for installation of the virtualbmc package on CentOS.

TODO: Support for other platforms.
2018-08-30 13:22:07 +00:00
Will Miller
2d214adef3 Extract IPMI configuration out of role
This is required for Ironic enrolment as well as Virtual BMC
configuration.
2018-08-30 11:29:49 +00:00
Will Miller
b4dfab2557 Merge branch 'master' into s-vm-node
Conflicts:
	ansible/deploy.yml
2018-08-30 10:08:38 +00:00
Will Miller
0d88c38c1b Move VBMCD service name into vars file 2018-08-30 09:15:13 +00:00
Will Miller
317bcf964c Merge branch 'vbmc' into s-vm-node
Conflicts:
	ansible/deploy.yml
	ansible/roles/virtualbmc/tasks/main.yml
2018-08-29 11:36:04 +00:00
Will Miller
855a2c2c7c Split Virtual BMC role into two
Create a role to configure a host for Virtual BMC, and another to add
domains to it.

Also add some checking to make the roles more robust.

Conflicts:
	ansible/deploy.yml
	ansible/libvirt_create_vms.yml
	ansible/roles/virtualbmc/tasks/main.yml
2018-08-29 10:45:52 +00:00
Will Miller
34ebd92cad Refer to nodes, rather than VMs
The fact that the Libvirt provider is using VMs is an implementation
detail, so we should word Tenks such that it deploys clusters of nodes.
2018-08-28 16:50:02 +00:00
Will Miller
b36f95a04f Extract Virtual BMC tasks into a role
The role will:
* Install VBMC requirements in virtualenv
* Set up VBMC daemon
* Add domains to VBMC
2018-08-28 15:21:43 +00:00
Will Miller
3bd8e05732 Fix veth-pair role README typos 2018-08-28 12:30:23 +00:00
Will Miller
56fb19d4c1 Formatting fixes
Fix multi-line string variables. Also use subelements filter with loop.
2018-08-23 12:36:07 +00:00
Will Miller
4c79cfa10b Add veth-pair role
This role configures a veth pair between an OVS bridge and another
device.
2018-08-22 16:56:36 +00:00