Commit Graph

17 Commits

Author SHA1 Message Date
Steven Hardy ac39a918f8 Move tripleo ansible inventory code to tripleo-common
This moves the main code/class to tripleo-common, as there is a need
to use this in tripleoclient (which already depends on tripleo-common)

Note we don't move the tripleo-ansible-inventory at this time, since
it's not needed for the tripleoclient use-case and it will require
packaging changes.

Depends-On: I03f609b8ff9f36c95a8382aa1705147d99cb973b
Change-Id: Idd6e8f69788e857bc5a81dae344fb41d5be68846
2017-12-19 09:50:17 +00:00
Juan Antonio Osorio Robles 5dfad9e890 Add VipMap to inventory variables
This adds the VipMap as a variable that's accessible for all roles.

bp ipsec

Change-Id: I9aebf40a17efc21d9055acaf8e4fda6ae8d65cc4
2017-11-21 08:49:42 +00:00
Juan Antonio Osorio Robles 5a0ae09a21 Add enabled networks in the role as part of the inventory
This adds a list containing the enabled networks for the role as part of
the inventory.

Change-Id: I379bdea1499bef90ffab0f105c21743451516c89
2017-11-16 10:54:39 +02:00
Steven Hardy 8d86b0dbfb Add per-network bind ips to inventory
This adds the per-node per-network ips for each network so we
can e.g set the bind ips for services deployed via ansible.

Change-Id: I6085df4741d944875afbe02d71b9e9a85c406024
2017-11-06 15:58:13 +01:00
Ben Nemec 0dec2d8afa Lazy load the entire stack instead of single outputs
Each call to output_show is taking around 15 seconds for me, which
causes the entire inventory process to take 90 seconds or more.
Loading the entire stack with outputs resolved only takes around
20 seconds and keeps the total runtime of the dynamic inventory
much shorter overall because it only has to be done once.

The stack is lazy loaded at the first call to __getitem__ because it
seems that Ansible instantiates multiple copies of the class but
never actually looks anything up in some of them, so if we load the
stack in the constructor we just waste time retrieving it
unnecessarily.

This change has reduced the time it takes to run even simple ad-hoc
commands against a small 2 node inventory from 2.5-3 minutes to
45 seconds (which is still too long IMHO, but a step in the right
direction).

Change-Id: I0fcde3f7641ccc26f045fcc8146ec4067e45330c
2017-08-29 17:37:42 +00:00
James Slagle 3e9bc95b20 Configurable ansible_ssh_user for tripleo-ansible-inventory
The ansible_ssh_user in the generated inventory by
tripleo-ansible-inventory is now configurable instead
of hardcoded to heat-admin. The default is still heat-admin.

Change-Id: I137d303e0a5555a0c9e138b548560637c619b492
Closes-Bug: #1710240
2017-08-11 11:24:24 -04:00
Steven Hardy 25a20b672c Don't modify case of role names in inventory
When doing --limit <role> for ansible-playbook, it's quite unintuitive
as you need to know to change the case, I would prefer if we made
these groups match exactly with what is in the roles_data.yaml and
output by the heat RoleData outputs.

Change-Id: I2bba5f66e653d9ec4e26f74887261c8541054800
2017-07-21 17:51:25 +01:00
marios d931ecbb0e Fixup the undercloud service list used in the validation
In I50ecb16f924fc5afa327b842d3b2e1427e1351eb we added a service
status check validation for the undercloud. This removes the -api
services as these are being removed/replaced (e.g.httpd)

Change-Id: Ic91312d39a0e2661c9a23206385ccb059d176440
2017-07-11 18:56:27 +03:00
Steven Hardy dac042d6c9 Add role_name to inventory
Change-Id: Iba0471f962c500a14718b49ab3de913747103065
2017-07-07 11:31:33 +01:00
Steven Hardy 064a61c1a3 Add deploy_server_id and bootstrap_node_id to inventory
These variables match those provided by the heat-config hook when running
the ansible deploy steps in t-h-t, so adding them to the inventory will
enable also running the same tasks outside of heat in future, which may be
useful for manual upgrades and developer testing.

Change-Id: I433c9c1fad71d8713a74899268f19062ab368290
Depends-On: I2fc48eec77210805c0139fa4abcbf4dd721e7c37
2017-07-07 11:31:33 +01:00
Florian Fuchs b419de723d Add stack health check validation
This validation adds a basic health check for the current stack by
making sure all resources are in a *_COMPLETE state. The validation
should be run before an upgrade.

To look up the resources, a new lookup plugin is added as well.

Change-Id: I592ffe13f224dc5275f6bd89829c98a46d3a7472
Implements: blueprint pre-upgrade-validations
2017-06-15 12:30:40 +02:00
Jenkins 4e1bd7f9eb Merge "Validate undercloud service status before update/upgrade" 2017-06-08 17:22:18 +00:00
marios 7eabab7bfd Validate undercloud service status before update/upgrade
Run basic sanity check on the undercloud services state.
Intended for use before invoking a stack update, esp. a minor
update or major upgrade.

Adds a static list of undercloud services to the inventory
for use by other undercloud tasks as a first iteration

Change-Id: I50ecb16f924fc5afa327b842d3b2e1427e1351eb
2017-06-08 18:54:38 +03:00
Florian Fuchs 7fb11d24ad Fix inventory without existing stack
The inventory currently tries to fetch stack outputs without checking if
the stack exists, so the inventory breaks if the plan has no
corresponding stack.

This patch changes the StackOutputs class to hide heat API exceptions
and return an empty output list instead.

Change-Id: Icb9e6828aeb1f65d8707333fc1098942f1691204
Closes-Bug: #1694712
2017-06-06 17:52:49 +02:00
Steven Hardy 60f9257683 Add per host groups to dynamic inventory
Currently you can only run ad-hoc commands against roles, e.g
groups of nodes (unless, perhaps you have all the nodes in dns
or the undercloud hosts file).

We can add groups for each node, such that the nodes are accessible
via both the node name (as displayed e.g via nova list) and the IP,
e.g

ansible -i /usr/bin/tripleo-ansible-inventory  overcloud-controller-0 -m shell -a 'uname -a'

This may also be useful for performing rolling updates via ansible
in future.

Depends-On: I61efac5634e9b6fbb820e693c71a0adae5fa8b6a
Change-Id: I40192f009812ae9fa2bdc44d59d8b4e241318f39
2017-05-23 18:21:34 +01:00
Florian Fuchs ffc08f18d2 Add host list by service to inventory
This change adds additional host group sections for each enabled service
to the inventory. Each of these service-based sections contains a
`children` attribute that lists the roles which have the service
enabled. (The stack's `EnabledServices` output is used for this).

The change allows to target validations not just by role but by the
service name, such as "rabbitmq" or "keystone".

Change-Id: I3d1ad63a3d468980cd80685d898e9e7851c3ddb1
2017-05-15 12:55:28 +00:00
Florian Fuchs 9461adfa24 Show all roles in inventory
This patch updates the tripleo-ansible-inventory to show all roles in
the host list, not just compute and controller nodes.

The retrieval of IPs and stack outputs is slightly refactored: Instead of
retrieving them from Nova, the host IPs are now read from the stacks new
RoleNetIpMap output. The stack outputs are fetched from heat via a new
`StackOutputs` class that ensures outputs are only fetched when needed.

Closes-Bug: #1685544
Closes-Bug: #1689789
Change-Id: Ic8a19f15dd45b383a3f3d403653e3eaef2c1865b
2017-05-10 13:12:39 +00:00