Commit Graph

43 Commits

Author SHA1 Message Date
Jonathan Rosser 9c585b7257 Use ansible_facts[] instead of fact variables
See https://github.com/ansible/ansible/issues/73654

Change-Id: I949a17a8e77e96b6933e625914ea337eb94e53c2
2021-02-25 12:26:09 +00:00
Jonathan Rosser a2b8d6c759 Fix linter errors
Change-Id: Ie1760e1fb18891d59f355fce6154d183c5c621e6
2020-10-02 10:34:37 +00:00
Dmitriy Rabotyagov 5f6362fa5c Enable PowerTools repository for distro installs
RDO repo relies on some libraties that are present in PowerTools
repository. This repo exists in base image, however is disabled.
From the other side, zuul adds this repo with base jobs and enable it
in CI by default.
So not to deal with getting right URL and etc, we're just running command

Change-Id: I028dce38a4b7dbdd3683b4ad07bd2f5cd19ed1b5
2020-06-25 14:30:35 +00:00
Dmitriy Rabotyagov 002362ba6b Fix CentOS functional test
Change-Id: I0bbe42a86a0fc37700e789584acae564297e0bc8
2020-06-24 21:24:50 +03:00
Jonathan Rosser 9259628ead CentOS 8 support
Dependant patch [1] passes openstack_hosts step, so we're good to merge
even with failing functional test not to make circular dependency.

[1] https://review.opendev.org/#/c/689629/

Depens-On: https://review.opendev.org/#/c/728259/
Change-Id: If33ce6f55939ee7722bbab98d134f182cba0eb25
2020-05-21 14:33:54 +03:00
Dmitriy Rabotyagov c64e1caf72 Use blockinfile for hosts file generation
This patch aims to simplify generation of hosts
file content as it's now generated purely with ansible.

As a result upgrade jobs should be fixed afterwards

Change-Id: I7961115f215153515ba3f3a00bbbeeb9fb4568f1
2020-02-26 18:46:27 +00:00
Zuul 67a267c20c Merge "Do not add /etc/hosts entry for 127.0.1.1" 2019-07-23 09:11:58 +00:00
Zuul 506a8532aa Merge "Replace git.openstack.org URLs with opendev.org URLs" 2019-07-16 17:16:54 +00:00
Jonathan Rosser a71523f7c3 Do not add /etc/hosts entry for 127.0.1.1
This patch removes a task which adds an entry to /etc/hosts for
the hostname / 127.0.1.1.

Some services, such as rabbitmq, require that the ip address they
are configured to listen on resolves to a hostname with the same
ip. Before this patch there were two /etc/hosts entries for the
hostname of each host, 127.0.1.1 and the mgmt network address.

This patch ensures that the /etc/hosts file is unambiguous and
always resolves the hostname to the mgmt network ip address.

Change-Id: I5c9bf4cd0a3a416447f6f1797df4657402a64382
2019-07-14 09:20:41 +01:00
melissaml 1f47550a7c Replace git.openstack.org URLs with opendev.org URLs
Change-Id: I1032668072bb65d4fb31a31c4949b555b317155d
2019-07-10 22:01:58 +08:00
Jonathan Rosser 1498d0d61d Install user supplied CA certificates into system trust store
This functionality can be used to install any CA certificates that
the deployer requires into any combination of hosts/containers.

Change-Id: Ic1292e18c8add78e8cb30f624be96292b153d4fe
2019-06-26 11:42:12 +01:00
Jonathan Rosser a72e8b9aac Allow user-defined extra distro packages
This change allows the deployer to specify lists of distro packages
which will be installed in addition to those specified by this role.

Rather than simply concatenate the lists of installed packages, extra
tasks are added to make the install ordering be as follows:

 * install initial packages for repo/gpg keys
 * configure repos
 * install user defined extra packages

It is possible to install packages from the newly configured repos, as
the user defined package list is installed last.

Change-Id: I86e541e0c7d38460c697807c4f6ae5b6e7310a15
2019-03-26 08:45:05 +00:00
Vadim Kuznetsov 5b9cf44498 use ansible_hostname to construct canonical_hostname in /etc/hosts
inventory_hostname is ansible alias of the host. It may be
equal to hostname in most cases, but also can be short alias for
convenience.
ansible_hostname is discovered hostname, i.e. real hostname.
It make more sense to use real hostname to construct fqdn
and use inventory_hostname as an alias.

Change-Id: If980f67da27035aa81b554ef59dedaf5a34357f4
2018-11-27 15:33:02 -05:00
ZhijunWei 211e765512 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: Ib5787752cdfae9147968289f2f02026b499b765e
2018-08-19 11:06:09 -04:00
fpxie 0894c91063 Trivial: Fix the pep8 warning
The yaml should start with "---"

Change-Id: Ibb810c8cbbf129d99250879584c19fab5f5ec3da
2018-05-08 17:23:18 +08:00
Jesse Pretorius 97a1c4534c Remove tests-repo-clone.sh
Now that run_tests.sh handles the tests repo clone, we can
remove the use of the older tests-repo-clone.sh script.

Change-Id: I5eb9cd47b128cbc7617279777c5da8b357795eae
2018-03-28 10:12:23 +01:00
Major Hayden 72ae290e10
Make role idempotent
This patch makes the openstack_hosts role idempotent.

Depends-On: Ie414d32d39fdeeedd77fe94b57a09ba344084ec1
Change-Id: Ie6537eeb923ae868b0ebc23057b34f0750781161
Signed-off-by: Major Hayden <major@mhtx.net>
2018-03-08 08:38:39 -06:00
Major Hayden dcadc2a1fe
Fix openstack_host_module_file typo
The variable name had a typo and appeared as
`openstask_host_module_file` when it should have been
`openstack_host_module_file`.

Change-Id: I0c94ad7e4a0779edd522a34ed3520db27c5a9550
Signed-off-by: Major Hayden <major@mhtx.net>
2018-03-07 11:24:50 -06:00
OpenStack Proposal Bot 4ec33e5f02 Updated from OpenStack Ansible Tests
Change-Id: Ic37f29fa645706f8f14703a468ab818147ea2af7
2018-02-14 20:04:24 +00:00
Major Hayden 6b2131e864
Ensure openstack_hosts sets nodepool variables
This patch ensures that openstack_hosts gate jobs use the nodepool
variables set within openstack-ansible-tests.

Closes-Bug: 1748253
Change-Id: I343eea459aa8992e80291486decb03db4e224202
2018-02-08 15:18:05 -06:00
Markos Chandras 9de38169a4 tests: Add missing pip_install role dependency
This fixes the following problem:

ERROR! the role 'pip_install' was not found in
/vagrant/tests/common/roles:/home/vagrant/.ansible/roles:/home/vagrant/.ansible/testing-role:/vagrant/tests/common
The error appears to have been in '/vagrant/tasks/main.yml': line 74,
column 11, but may be elsewhere in the file depending on the exact
syntax problem.

The offending line appears to be:
  include_role:
    name: pip_install
          ^ here
        to retry, use: --limit @/vagrant/tests/test.retry

Change-Id: I960e9c4e0e060dbbd65ecd2fee5e56d394fe6e88
2018-01-22 12:40:51 +00:00
Jean-Philippe Evrard f8a150cc76 Add the ability to run the role on all hosts
We currently have spread out package/host management to multiple
roles, sometimes repeating ourselves in the process (see
pip_install and openstack_hosts overlap)

That is against Ansible principles, and we should have one role
that configures the minimum (to run openstack), applying it to
all the nodes, maybe behaving slightly differently depending on
some parameters. Here that parameter is if the host is a container
or not. If the host is a container, all the physical host
configuration (kernel and sysctl) is be skipped, the
rest of the configuration (packages/repos) still applies.

This needed a refactor to split the tasks into those two group
while remaining efficient and avoid multiple back and forth
of package installs/removal. For that last point, new defaults
variables were introduced, allowing overrides per host/group.
A node now member of a group x can now directly use this role
to setup all its necessary repos and keys.

Last, but not least, this override mechanism can now easily
trigger pip_install role, which can from now on, be removed
from every role. On top of that pip_install role can now
remove its repo management, and focus on installing pip on
hosts that don't have a proper version of pip installed.

Change-Id: Ibf145e561c80a12055bd4d5dca3914c4d495a748
2017-11-24 14:50:40 +00:00
Jean-Philippe Evrard ad1d712889 Initial OSA zuul v3 role jobs
This patch implements an initial set of jobs intended to match
the current job execution method. It does not intend to improve
how the jobs are executed - only to replicate what is currently
in openstack-infra/openstack-zuul-jobs and provide the platform
to iterate on.

Change-Id: If38825e721ca099fd13b51e87fcb8dbb9714c99e
2017-10-17 18:20:51 +00:00
OpenStack Proposal Bot c2ebdb7939 Updated from OpenStack Ansible Tests
Change-Id: I7f60f761938e54aabbf24844d4c006650ee00ee0
2017-10-12 20:43:57 +00:00
OpenStack Proposal Bot 49aa89fc64 Updated from OpenStack Ansible Tests
Change-Id: Ib839bd4fbc2a09a324a78b9b1b675bd7bef40be2
2017-06-22 15:19:06 +00:00
Jesse Pretorius 9d88b9499c Use zuul-cloner for tests repo in OpenStack-CI
When executing the tests repo clone in OpenStack-CI,
use zuul-cloner instead of git to enable cross-repo
testing. This ensures that if a dependent patch from
the tests repo is noted using 'Depends-On: <change-id>'
in the commit message, that patch will be included.

Change-Id: Ie83136aacc9291dc9e76014c061b05f070142cbf
Depends-On: Idce7abebf32f24c356a27e099fbca954d917402b
2017-05-04 16:49:56 +01:00
Jesse Pretorius cb8eae6e54 Fix role gate tests for Ansible 2.3
Add 'become' and root 'user' options to the playbook instead of using
'ansible_become' through an inventory variable.

Change-Id: Ifc29eba5fe3de8b29a322a35501919074e948be9
2017-05-03 15:38:48 +01:00
Jimmy McCrory a91449ff59 Refactor host specific kernel module tasks
Update the 'openstack_host_specific_kernel_modules' tasks so that they
no longer need to skip ansible lint checking. The kernel configuration
file is now slurped and searched through to find out if the provided
list of modules are valid and loadable.

For testing, a 'openstack_host_specific_kernel_modules' test var and
assertion has been added.

Change-Id: I5d26b055fe8582b29ff40e0daa896bf1b7207161
2017-04-11 16:34:23 -07:00
Gaudenz Steinlin ed8e4ca621 Reorder hostfile insertion to support upgrades
When upgrading from a /etc/hosts file created before commit
ae02667b84 the old entries were not
removed on the first run. The hostname generation had to be run again to
remove them.

Reordering the if statement ensures that existing entries are changed
instead of adding new entries for the same IP address and that
duplicate entries are removed in all cases.

Change-Id: I2a21d13310b457e91a090541ae7f02f974413965
2016-10-11 09:18:06 +02:00
Jesse Pretorius c6b8a66817 Use centralised test scripts
This patch consumes the test scripts implemented by
https://review.openstack.org/375061 to ensure that
the tests and test preparation is consistent and
more maintainable.

Change-Id: I3a509b4ca28900715be51df40b0b9a2d40e2bcf7
2016-09-27 17:08:37 +01:00
Travis Truman 098cab2ae8 Convert role testing to use Ansible 2.1.1
Change-Id: Ia923ae1a3be0e4aea821c70f7bb0744c900aaa77
2016-09-13 12:58:29 -04:00
Jenkins 94afa972a0 Merge "Updated to use the openstack-ansible-tests repo" 2016-09-06 18:38:08 +00:00
Marc Gariepy a440f167ba Fix module loading on centos hosts.
Introducing a new var: {{ openstask_host_module_file }} that contain
the path to the file containing module list.

Centos will use systemd-modules-load.service:
- http://www.unix.com/man-page/centos/8/systemd-modules-load.service/
- http://www.unix.com/man-page/centos/5/modules-load.d/

Change-Id: I9ce294045259752e48c47ed036a9550565f05bc5
2016-09-06 08:59:36 -05:00
Marc Gariepy 85ecc37e11 Only configure systat on debian based system.
template systat cron for centos

only install /etc/default/systat on ubuntu
/etc/default/sysstat only configure debian-sa1 which is not on centos

introduce 2 vars :
 openstack_host_sysstat_file
 openstack_host_cron_template

Change-Id: Ib4fde6e4b9d3ce23524a5b5a17dbf15065bbeb4c
2016-09-02 11:15:15 -04:00
Kevin Carter ee409f4aac
Updated to use the openstack-ansible-tests repo
This change moves the role run and pre-steps to the tests
repo.

Depends-On: Ib2ec8840966aea574fef7387cee2ffabd597b4cb
Change-Id: Ib27bc814b14e3584450423d6a7f0e6842fd3fd98
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2016-08-29 19:28:43 -05:00
Kevin Carter ae02667b84
Updated the hostname generation
The change simply adds a more complete hostname within the
"/etc/hosts" file for all nodes within inventory which
ensures all hosts are reachable and have a proper host entry
for itself and all other hosts. Additionally the hostname
insert script has been made idempotent and tests have been
added to ensure functionality.

Partial-Bug: #1577245
Change-Id: Ib1e3b6f02758906e3ec7ab35737c1a58fcbca216
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2016-06-29 10:09:44 -05:00
Kevin Carter 79acae2254 Updated role using the Multi-Distro framework
* The default apt packages have been moved into a var file
  that is only loaded when the detected OS is matched.
* The Install task file has had the apt specific tasks moved
  into a named install task file.
* Ubuntu 16.04 and CentOS 7 support have been added

Implements: blueprint multi-platform-host
Change-Id: I469081671415df23a35108abf4452722ba011f9b
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2016-05-19 22:08:15 +00:00
Travis Truman bc21adddac Template /etc/environment rather than use lineinfile
The existing lineinfile implementation is buggy when changing and removing
entries from the global_environment_variables dict

Change-Id: Ic9899b1a4a72e72d0bac26eb8f650681186332e1
Partial-Bug: #1573131
2016-04-21 13:49:57 -04:00
Jesse Pretorius fdd067d887 Tests: Ensure that the apt cache is always refreshed
Change-Id: Ia59123aca3c56ffd09337a17d2630432c945356b
2016-03-04 10:10:56 +00:00
Jesse Pretorius 7648d32009 Update tox config and add bashate E006, E040 exceptions
This patch updates the tox.ini the same bashate exceptions as are
currently in the OpenStack-Ansible playbook repo.

It also ensures that the linters and all lint targets work
appropriately and normalises the tox.ini configuration to use
uniform formatting.

The use of ansible.cfg is removed as there is no way of being
certain which paths can be used without reverting to an ugly
sed hack in the commands. This is why it is preferred to make
use of environment variables which make use of tox's default
substitutions instead. It's a more reliable way of achieving
the goal for the purpose of gating and testing.

The switch to using a git clone instead of ansible-galaxy to
download the plugins is due to the path spec not being able to
work in Ansible 2.x. [1]

[1] https://github.com/ansible/ansible/issues/13563

Change-Id: I995bd1d365c978e475047d26744f19adf94be3ee
2016-02-12 12:18:14 +00:00
Kevin Carter 1ccea20641
Updates for typos
This change updates a few things that were missed when the role
was cut over.

Change-Id: I91b9354e70e072d8c878905605afdbf4b7736841
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2015-12-09 11:46:54 -06:00
Jean-Philippe Evrard 82f0126248 Use sudo for role testing
There are 2 ways to realize the privilege escalation
needed for the gate jobs.

1) Editing the playbooks (and hope to not forget to
write the sudo/become lines for every role)
2) Editing the inventory and set the variable there.

I'm taking the second approach with the minimum set
of variables (become_method is sudo by default and
become_user is root by default).

Change-Id: I54b8c1489bfc46d4a03c907f4a86f0313c7778ff
2015-11-25 19:15:25 +01:00
Kevin Carter 335b5be62c
IRR for openstack_hosts
The change moves the role out from the main repo openstack-ansible
repository and into its own standalone repository.

Items within this change:
  * The role has been updated to ensure it runs standalone.
  * Tests added to the role within tox.
  * Functional tests added to the role that can either be run
    via the run_tests.sh script or using tox.
  * dev requirements have been updated for testing usecases.
  * Docs added to both the README.rst file as well as the docs
    folder.

Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2015-11-03 02:57:54 -06:00