Commit Graph

16 Commits

Author SHA1 Message Date
ZhijunWei b2bce755e0 use include_tasks instead of include
include is marked as deprecated since ansible 2.4[0]

Switch to include_tasks or import_playbook as necessary

[0] https://docs.ansible.com/ansible/2.4/include_module.html#deprecated

Change-Id: I55394d053218016be20fa9b2c92cefc1473d5c64
2018-09-09 08:04:47 +00:00
Jesse Pretorius 85b51389cc Use local connection and become for localhost plays
When targeting localhost with 'remote_user: root' and
using 'become: yes' we lose the environment variables
for the user running the playbook (eg: USER, HOME).

However, if we use 'connection: local' and 'become: yes'
together, it works properly.

To ensure these plays have the correct access to change
things on the host, we apply this change to them all.

We also ensure that 'become: no' is explicitly set on
any local connection plays to make the intent more
obvious. Finally, we also use 'yes' and 'no' uniformly.

Change-Id: I6e4607dd4aaffa0bfcda254103697bf9b28eca1a
2018-07-14 14:37:06 +01:00
Jesse Pretorius 839aec5abe Ensure remote_user and become are consistently implemented
It makes no sense to use become when you're connecting to a
host via the root remote_user. As such, we remove all uses of
'become: true' from the test plays with the exception of the
'test-prepare-keys.yml' playbook which uses a local connection
rather than a remote one and it therefore needs to use become.

We also transition all plays to use 'remote_user' which is the
correct parameter to replace 'user' (since ansible 1.4).

Finally, we switch the horizon nova service setup to its own
playbook using a local connection and the upstream keystone
modules.

Change-Id: I20517c22f07b1bb811a51d8c63741604360fe7f8
2018-07-06 09:45:29 +01:00
Kevin Carter 54930c0048
Remove the serialization in tests
The lxc container create process were running in serial as it sets up
the test environment. Being this is setting up a test environment
there's no need for it to be executed in serial. The original reason
these container creates were running in serial was due to SSH issues
however the integrated repo has been creating containers in parallel for
sometime now so it is believed the original control path issues have
been resolved.

Change-Id: I59d563549b288e634338474aed45011e94b85c47
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2017-12-12 17:52:01 -06:00
Jean-Philippe Evrard 5eea959ca9 Prepare containers with openstack-hosts role
The commit [1] allowed repo management for all
hosts where openstack_hosts is applied, and commit [2] removed
UCA from pip install, which applies to all the hosts,
whether they are containers or not.
We should therefore add UCA to containers back.

[1]: https://review.openstack.org/#/c/515399
[2]: https://review.openstack.org/#/c/515400

Change-Id: I79ff70c438b44753be2a93f004ebbc46de0a963d
2017-12-04 10:13:22 +00:00
Jesse Pretorius dad9515c35 Implement any_errors_fatal for all test playbooks
Sometimes a test will result in a failure, but it
takes more time than necessary to find the failure
due to Ansible continuing to execute on other hosts
after removing one from the play execution.

This patch ensures that any error will result in
an immediate failure so that the fatal error is
easier to find.

Change-Id: I4e89bfdb1e48d0ac65f9fb8549e55a19ab773f9f
2017-07-17 10:09:11 +00:00
Jesse Pretorius fa4937e52e Remove connection: local usage
In Ansible 2.3 the local connection plugin overrides
the host vars for the ansible_python_interpreter,
causing tests to use the wrong interpreter and
install python packages into unexpected locations.
This is especially visible when using host
delegation to localhost instead of the targeting
localhost directly.

To ensure that the behaviour remains consistent with
our expectations all local connection usage for
localhost is removed and localhost is targeted as
a remote host.

Change-Id: Ifcccf3c25aa10085b35017b01644354e10eca15a
2017-05-02 15:39:36 +01:00
Jesse Pretorius b575dc7951 Use wait_for_connection instead of wait_for to check container
After configuring the bind mounts in the container, we used a
task to wait for SSH to respond on the container, using the
Ansible wait_for module trying to connect to port 22.

When managing containers in Ansible using other connection plugins
that use LXC commands on the physical host to execute modules,
there may not be an SSH daemon running within the container. In
these situations we can accomplish the same check without SSH by
using the wait_for_connection module (new in ansible 2.3) to verify
that Ansible has a working execution path into the container, but
not necessarily via SSH.

Change-Id: I25978a3043af1df1613f41e479b7f058d64f685d
2017-04-28 13:12:32 +01:00
Rick Box c8790db909 Bugfix for wait_for_ssh for waiting for connectivity
Bug: https://bugs.launchpad.net/openstack-ansible/+bug/1682481 this
causes issues when using an SSH gateway yet this is simply doing a basic
check for port 22 connectivity.

Change-Id: Ia3c82fcef553b6a53f66d22b9cfdcf5d69e8694d
2017-04-27 18:10:39 +01:00
Markos Chandras 57c582149f tests-prepare-*: Use local connection to perform actions on localhost
Use 'connection: local' in the test-prepare-containers.yml and
test-prepare-host.yml playbooks similar to the test-prepare-keys.yml
playbook one.

Change-Id: I1e69b72121ac07f23a467c61b9ab5888fc57c275
2017-04-25 14:28:43 +01:00
Jean-Philippe Evrard 5ad3a27798 Add container logs to the build
Currently we don't have logs of what happened in the containers.

This commit changes the lxc_container_create default bind mounts
to ensure that the /var/log directory from the containers is
bind mounted to /var/log/{{ inventory_hostname }} on the host.

The tox configuration is also changed to ensure that links are
not dereferenced in the log copy, and that the layout of the log
storage is the same as that of the integrated gate.

Change-Id: I56f5e422313c405d4f65feb8e445d4f4b0700566
Co-Authored-By: Jesse Pretorius <jesse.pretorius@rackspace.co.uk>
Signed-off-by: Jean-Philippe Evrard <jean-philippe.evrard@rackspace.co.uk>
2016-09-27 17:35:29 -05:00
Travis Truman 1943251152 Address ansible_ssh_* var deprecation
Replacing usage of ansible_ssh_host, ansible_ssh_user,
ansible_ssh_port with ansible_host, ansible_user and ansible_port
Depends-On: I35371879a87c115f219cd181245fe59f6d7d3f77
Change-Id: I97c3958c406b44b271d361860516d0b903438a83
2016-09-19 11:06:48 +01:00
Kevin Carter 75ad9983f4
Fix container destroy/create
The container destroy playbook was attempting to ssh to the targets
it was destroying instead of simply connecting to the localhost and
removing them. This change allows the connection to be local allowing
the destroy to go through.

This also changes the container create and destroy tasks to be done
in serial. This is being done due to potential control path issues.

Change-Id: Ide0fa39bfef917abd8b0abf1b5c9991beae9c10b
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2016-09-16 12:47:42 -05:00
Kevin Carter f136720898 Remove pinned vars and set become:true
This patch removes the following pinned vars for test execution:

lxc_container_release:
This variable is set based on the host platform and should not
be fixed to this value in the playbook.

lxc_container_backing_store:
This value is dynamically set based on the host configuration
and 'dir' is the fallback value so it does not need to be set.

global_environment_variables:
This value is an *optional* variable. It was only ever set in
order to test that the functionality to apply the contents of
this variable work.

This patch also sets 'become: true' for the playbook to ensure
that the execution of the container creation/deletion is executed
as the root user.

Change-Id: Id6f35e1b9fef5096c06dffb1900c2d144bc5ece4
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2016-09-12 18:19:27 +01:00
Shashank Tavildar d7a3cad5e9 Separated operations of creating and destroying test containers from test-prepare-container.yml
test-prepare-container.yml is seperated into:
test-prepare-container.yml: Creation of test containers.
destroy-containers.yml: Deletion of test container.

Change-Id: I2e42debeaca0a3a8c837fd34c11ad7e6cbcf151b
2016-08-17 19:11:26 +00:00
Andy McCrae 7f97581e0b Fix up syntax and dir structure 2016-05-19 16:37:18 +01:00