Commit Graph

79 Commits

Author SHA1 Message Date
Riccardo Pittau c64f6ba5c1 Uplift default Ansible version to 8.x
Change-Id: Iabb9f55b8dacc7ef9965ac60d67e70b60dd723c5
2024-01-09 09:35:18 +01:00
Riccardo Pittau 35c3d51dc4 Update default ansible version
Uplift default Ansible version to 7.x

Change-Id: I98d240e2ec2c61e662647dc8b0159934ada18431
2023-12-15 09:53:20 +01:00
Riccardo Pittau 786f891749 Use ansible 6.x
Use tags instead of numerical ids for better compatibility
with latest ansible-lint versions.

Change-Id: I87431617eacf380aada94c5c3ed534476ddfb1ce
2022-11-29 14:32:56 +01:00
Riccardo Pittau 969a5e623f Use Ansible 5.x
Support most recent version of Ansible up to 5.x as default.

Change-Id: Ia2e9c78c56f6d0314471973e71de0b45e3309d71
2022-06-01 11:27:21 +02:00
Dmitry Tantsur 4cb0395d75 Make virtual environment owned by root
It's dangerous to allow a regular user to write into the source code of
the services. The repositories are still writable, so that the
development workflow can still use the ``--develop`` flag to make
modifications.

While here, remove the horribly outdated and broken ANSIBLE_INSTALL_ROOT.

Change-Id: Id2e25dd57668d24a11dc2cd16eea2b607b7a3f16
2022-01-25 15:59:42 +01:00
Michal Nasiadka 72ad77f914 Bump up Ansible to 4.x
As per [1] and [2] - Ansible versions prior to 4 are not maintained.

[1]: https://docs.ansible.com/ansible/devel/reference_appendices/release_and_maintenance.html#ansible-community-package-release-cycle
[2]: https://docs.ansible.com/ansible/devel/reference_appendices/release_and_maintenance.html#ansible-core-release-cycle

Change-Id: I06cf6723361010e0a7c6eb07f2d9e570192cd9a4
2021-10-22 08:05:07 +00:00
Riccardo Pittau 0f79637041 Remove ansible-base when upgrading ansible
The remaining ansible-base package can also block clean ansible upgrade.

Change-Id: I8cda293b52c164c77678fc3b0535b01b57623e62
2021-07-21 11:18:48 +02:00
Riccardo Pittau 645ac1ca5f Perform upgrade by default when installing ansible
We don't upgrade ansible in the upgrade jobs because the requirement is
already satisfied according to pip.
Although, we should upgrade ansible as it may differ between releases.
Also perform a clean install if ansible is already present to avoid
conflicts.

Change-Id: I3cb1059408ef069001cde91474c68768315ff784
2021-07-19 14:50:41 +00:00
Dmitry Tantsur d048a5f4c4 Restore the conditional verbosity in bash scripts
Became unconditional in 422bafd6ea

Change-Id: I6e9b32d1ca4651daea26330c96c63d40e63cec00
2021-02-15 17:44:54 +01:00
Riccardo Pittau 422bafd6ea Exit on all errors in bash scripts when possible
Except for the collect-test-info script, the other bash scripts should
just exit on error.

Change-Id: Ia68bef56edd7edec14f678155220b6e4e15e57f6
2021-02-09 12:05:11 +01:00
Dmitry Tantsur fd530ac5aa Support Ansible 2.10
No code changes required, but the linters job needed fixing since now
it tries to automagically load the collections in playbooks/collections
and fails with "relative resource paths not supported".

Change-Id: Ifa99a4bccc52f095c057a082fbe3d15a1633de9f
2020-11-03 11:31:14 +01:00
Dmitry Tantsur a874c7ac73 Always setup environment in bifrost-cli and make it less verbose
For upgrades we need bifrost-cli to always try to setup environment
(e.g. in case of a different ansible version). To avoid polluting
the output, make `set -x` conditional on a new variable BIFROST_TRACE.

Change-Id: I8caea6be0962db0e7019d0aa1484ef2424b7629e
2020-09-08 12:47:56 +02:00
Dmitry Tantsur 2cf21258af Remove support for non-venv deployments
It has been deprecated and untested since ussuri, time to move on.

Change-Id: Ieddda38b12d07a2a5c51650850b150dd82f332a9
2020-08-25 11:08:09 +02:00
Dmitry Tantsur 3b5278740f Remove env-vars
It's not always correct and has been replaced by clouds.yaml and openrc.

Change-Id: Ie6349502e8db1a68648258a88c7a9fb9d2a77d8a
2020-08-24 11:38:06 +02:00
Riccardo Pittau a52b831419 Change to "collections" where needed
We should keep the name "collections" for consistency.

Change-Id: I98aab593ffcaf688e9d94e4fa16794c6d313e6c8
2020-08-06 12:16:23 +02:00
Riccardo Pittau 42f6d94252 Consolidate env-setup
Consolidate variables in env-setup, use double-brackets when needed
to improve readability and portability.
Use the id command to set correct user and group for ansible install
directory.

Change-Id: I14b763890b670e3843c47cdccfb8d572917650ca
2020-07-27 14:42:47 +02:00
Dmitry Tantsur 29cbe1b362 Support installing the openstack collection from a local location
This is needed for a bifrost CI on the collections.

Change-Id: I6f5f08083782f162b6de2db4cc5832fa44d5c8ec
2020-07-27 10:44:35 +02:00
Jacob Anders c331093a3d Create symlink to ansible collections on install
Bifrost requires Ansible Collections for certain tasks including
enrollment of nodes. In order for bifrost playbooks to be able to
utilise Ansible Collections, a symlink or an environment variable
needs to point to their install path. This change adds creation of
the symlink to the setup script and a corresponding documentation
update.

Change-Id: I07804a88ed11b0adb6c398743905725c6cdb90d4
2020-07-24 10:33:23 +10:00
Iury Gregory Melo Ferreira fa1b8ea9a0 Add openstack collection
- add ansible-collection-requirements.yml so we
can specify the collections we need.
- Changed env-setup to install collections unsing
ansible-galaxy.

- Moved taks "Dynamic enrollment" to use the openstack.cloud
collection

Change-Id: I1cf21a505b923f333b6853944965593170cbe8cd
2020-06-19 10:36:53 +02:00
Iury Gregory Melo Ferreira 9c9c014908 Moving to ansible 2.9
Some code changes were necessary since the Ansible-provided jinja tests
as filters was removed in ansible 2.9, see [1]

[1] https://docs.ansible.com/ansible/latest/porting_guides/porting_guide_2.5.html#jinja-tests-used-as-filters

Co-authored-by: Kaio Oliveira <kaio.kassiano.oliveira@gmail.com>
Change-Id: I2f1c2ece0543eb60ac5ac5f9ad1465ffd2d66592
2020-06-05 12:34:22 +02:00
Riccardo Pittau 5182388b7c Fix pip3 path
The pip3 binary can be in a different location from python3.

Change-Id: I19f32c0a8316dc0fca452b7e8d36c777effcbeb5
Story: 2007694
Task: 39806
2020-05-28 14:39:22 +02:00
Dmitry Tantsur a381b0f9c0 install-deps: use system pip and bindep for installing dependencies
Updating pip was required long ago to work around Ubuntu and CentOS 7
problems. Now even CentOS 8 has pip 9.0 which should be enough for us.

Also moving binary dependencies to bindep and install them before
we try to install Python dependencies (to be able to compile them).

Workarounds is needed for segfault on Ubuntu because of cryptography:
remove python3-cryptography package and avoid --ignore-installed.

This change makes install-deps work on openSUSE again.

Change-Id: Ib9b81075f35068c046880de46b20f98ef71a8d8e
2020-05-26 12:17:53 +02:00
Riccardo Pittau eca5ce61b0 Remove unused check_get_module function
The check_get_module is not needed anymore.

Change-Id: I191fc04c8d56b34948118828315574a47375eb34
2020-03-06 14:50:33 +01:00
Riccardo Pittau adf964481e Explicitely set ansible version to use
Remove the outdated ansible-pip-str.py and rely directly on
ANSIBLE_PIP_VERSION to set the installed version of ansible.

Change-Id: I105b85595cfea101bdb747113721536f4a3ef93a
2020-03-06 14:49:24 +01:00
Riccardo Pittau 68ed2960e3 Set Ansible default version to 2.8
Ansible 2.6 is EOL, we should move to a more recent release that
has better support for Python 3.x and, above all, is maintained
with security and critical bug fixes.

Change-Id: I6aa80b4bc4a0c34ac919951cd940b2fc6b736bdc
2020-01-23 10:05:27 +01:00
Julia Kreger 3b859c83f5 remove legacy ansible environment setup hint
Our ansible installation changed quite some time ago,
and it is time to go ahead and remove the outdated reference.

Change-Id: I43c65b742616835662cf5bc3b87a22aa42b79185
2020-01-16 13:52:33 +00:00
Julia Kreger 44196ea91b Switch to use a venv by default for testing
Also updates the method to use the python3 native
venv module instead of the virtualenv module.

Change-Id: Iae4248acec0b3bdf48be62134f64356d40375dde
2020-01-15 17:18:54 +00:00
Julia Kreger 8a6cdf7d3a Change install-scripts for py3 with Ubuntu
Reworked the pip install logic so that we run the pypi
pip installer instead of trying to navigate through running
a pip install and upgrade with setuptools additionally.

These steps were orginally only done in order to force
us to a pip version >= 9.0.1, which is now the default
for Ubuntu Bionic.

Change-Id: Ic3a95973338bbd03061d5b3e4080c0d72d6b891a
2020-01-08 11:30:13 -08:00
Markos Chandras 4f0743fa6e Switch to Ansible 2.6
This updates the bifrost playbooks to be compatible with the Ansible
2.6 release.

Change-Id: I352fdccc8ddfce88feb2ea760273bf101eafcd65
2018-08-13 20:52:06 +03:00
Yolanda Robla 4df852b626 Bump ansible version to latest stable
Change-Id: Ic6558db777abbc02e7de686c3b5b30595cac347e
2017-10-30 11:16:57 +01:00
melissaml 9819720f78 Fix to use "." to source script files
Adhering to coding conventions. Refer to ``Code conventions`` at
https://docs.openstack.org/contributor-guide/ for details.

Change-Id: I54b2d7d84bdd651fb96a62b3af3244c6ab484059
2017-09-20 02:58:52 +08:00
Pavlo Shchelokovskyy 390414b2a7 Fix some virtualenv-related places
- on Ubuntu Xenial, `python-virtualenv` package no longer installs
  `virtualenv` shell script.
  Change all `virtualenv` invocations to 'python -m virtualenv',
  which is more portable.
  - in `pip_install.yml`, add `virtualenv_command` argument using
    the same portable invocation.
- in `install-deps.sh`, the condition to install `python-virtualenv`
  was missing the `not` part
- the venv is created with `sudo` elevation in `install-deps.sh`,
  thus in `env-setup.sh` Ansible must be installed into venv
  using `sudo` elevation as well.
- in `install.yml`, fix passing `bifrost_venv_dir` var to `pip_install.yml`

Change-Id: Ifaa54a0dc97ed59ca8360e62878b603a04105e46
2017-03-15 17:51:17 +02:00
Pavlo Shchelokovskyy 7a7f858ae2 Always install Ansible with pip
Instaling and using Ansible from source for bifrost has several
drawbacks, mainly due to how Ansible's 'ansible/hacking/env-setup'
script mangles with PATH and PYTHONPATH, which complicates running it as
part of other scripts. Besides, cloning the whole repo and it's
submodules is somewhat longer.

The main reason why we were doing that at all was a necessity to install
some additional Ansible modules from newer Ansible versions, which we
dropped right into the source of Ansible code - but this does not have to
be so.

Luckily for us, all Ansible versions we target to support can load
modules from 'library' directory next to playbooks/roles,
and we already use that for 'os_ironic_facts' module.
The need to install a particular module can be assessed by running
ad-hoc 'ansible' command against localhost with the module in question
and without any arguments ('ansible localhost -m <module>'):
- if the module is available in Ansible, the stderr will contain
  "changed" substring (as part of the standard module output)
- if the module is absent form Ansible, "changed" string will be absent
  from stderr too, in which case we can download the module from github
  directly into 'playbooks/library' directory.

This patch removes possibility of installing Ansible from source, and
always installs a released Ansible version via pip.
If not installed into venv, Ansible will be installed in user's ~/.local
directory via 'pip install --user'.
The missing but needed modules are downloaded as described above.

Some level of backward compatibility is provided:
- when the ANSIBLE_GIT_BRANCH has form of 'stable-X.Y', the
  env-setup.sh script will do the next best thing and install latest
  available Ansible version of X.Y.w.z

Also, ANSIBLE_PIP_VERSION can now accept a full pip version specifier:
- if ANSIBLE_PIP_VERSION starts with a digit, this exact version will be
  installed (as 'ansible==X.Y.W.Z')
- otherwize this whole variable is assigned as Ansible version specifier
  for pip, e.g

    env ANSIBLE_PIP_VERSION="<2.2" env-setup.sh

  will result in pip being called as

    pip install -U "ansible<2.2"

Closes-Bug: #1663562
Change-Id: I2c9f47abbbb6740d03978f684ad2c876749655b7
2017-02-13 13:10:54 +02:00
Pavlo Shchelokovskyy eb727f4a01 Allow installing Ansible from PyPI
As of Ansible v2.2 all the missing modules bifrost requires are included
in the pip-installable Ansible package.
Let's allow then for a possiibility for bifrost to install Ansible
directly from PyPI (into the system or in virtualenv) instead
of from cloned source repo.

This patsh first extracts the installation of binary/Python dependencies
and installation of Ansible itself from the "env-setup.sh" script to two
separate scripts "install-deps.sh" and "install-ansible-source.sh".

It also adds a third script "install-ansible-pip.sh" that is called when
environment variable ANSIBLE_FROM_PYPI is set to "True"
(default is "False" for backward compatibility).
It then looks up ANSIBLE_PIP_VERSION env variable (defaults to "2.2")
and pip-installs Ansible of that given version strictly.

Change-Id: Ia72e06d7bf127569d423fa521b8ddab87453809e
2016-12-05 15:17:06 +00:00
Julia Kreger a5c688a9ab Add keystone installation playbook
In order to support use of keystone, bifrost needs to be able to
install keystone in a minimalistic fashion alongside of ironic.

This commit adds the role, and required changes for that
configuration to be bootstrapped.

Change-Id: Icb1c5dfded5574d901444bbca72e5d74a336093f
2016-11-22 14:23:35 +00:00
Julia Kreger 2c60745fba Update Ansible version to stable-2.1
Updated the version to be installed to stable-2.1 as well
as updated some of the playbooks that were incorrectly
passing string arguments instead of dictionary arguments
for authentication since Ansible 2.1 has checks that
detect this.

Additionally, updated the task labels used for unsetting
authentiction parameters to be more consistent with the
state of the code.

Change-Id: I8c50cd2a722f2c8fee91fb6ef0761969dd3da138
2016-11-22 14:23:13 +00:00
stephane 5644b68a54 Refactor env-setup.sh
env-setup.sh got kind of unwieldy and out of sync
with itself. Refactor so we have relatively consistent
package lists, installation checks, etc. for each OS family.
This should be easier to maintain than what we have now
as it's easier to see where additional requirements should
be added.

Change-Id: I8a620a177efd8303bf30ebeb0f6a719a49eedf07
Closes-Bug: #1583803
2016-09-21 17:32:52 +00:00
Markos Chandras 92a2d2863f Install the net-tools package in scripts/env-setup.sh
A couple of playbooks use the 'netstat' utility which is present
in the net-tools package so install it if it's not already present.
It fixes the following problem on a clean CentOS installation:

fatal: [127.0.0.1]: FAILED! => {"changed": true, "cmd": "netstat -apn|grep
LISTEN", "delta": "0:00:00.005074", "end": "2016-08-24 17:14:48.614240",
"failed": true, "invocation": {"module_args": {"_raw_params": "netstat
-apn|grep LISTEN", "_uses_shell": true, "chdir": null, "creates": null,
"executable": null, "removes": null, "warn": true}, "module_name": "command"},
"rc": 1, "start": "2016-08-24 17:14:48.609166", "stderr": "/bin/sh: netstat:
command not found", "stdout": "", "stdout_lines": [], "warnings": []}

Change-Id: I1310f5848c7e71e8bdb91f6fcfaa26ebeeac45e7
Signed-off-by: Markos Chandras <mchandras@suse.de>
2016-08-24 17:26:51 +03:00
Jenkins 52b4d37495 Merge "Restore stable-2.0 as the default Ansible branch" 2016-08-19 16:52:13 +00:00
Markos Chandras 2b6cf52ae2 Restore stable-2.0 as the default Ansible branch
Bug https://github.com/ansible/ansible-modules-core/issues/2804 is
reported fixed since January 2016 so restore the Ansible branch to
stable-2.0 to get all the latest fixes.

Change-Id: Ibae26a4378713656e2480f3d4b73e670e5503ae8
Signed-off-by: Markos Chandras <mchandras@suse.de>
2016-08-18 17:51:46 +03:00
Markos Chandras 4d59ba5543 Add SUSE support in scripts/env-setup.sh
Add support for SUSE's zypper package manager in the env-setup.sh
script for deploying Ansible and bifrost's dependencies.

Change-Id: I14a23fe18ac18ee0c06a173015706769b69c5220
Signed-off-by: Markos Chandras <mchandras@suse.de>
2016-08-18 17:35:23 +03:00
Markos Chandras 292f3d60fb Fix typo when querying the python version in scripts/env-setup.sh
Change-Id: Icd4cdca11527c1f01191ee99e67722da0e39310b
Signed-off-by: Markos Chandras <mchandras@suse.de>
2016-08-15 17:12:43 +03:00
Ganesh Maharaj Mahalingam e7fc06aadc Make ansible installation directory configurable
This change helps with the remote problem where ansible is installed
on a machine using the same script by User A and User B is also
trying to use ansible using the same method. The change lets each
user have his own copy of ansible installed in a directory of
his/her choosing.

Change-Id: I8fddaaa8cad291da840ac44c4b1e9a7a93f92aee
Signed-off-by: Ganesh Maharaj Mahalingam <ganesh.mahalingam@intel.com>
Partial-Bug: #1589672
2016-06-06 13:24:46 -07:00
Jenkins d2eca085b1 Merge "Install libssl-dev and libffi-dev" 2016-06-02 19:06:28 +00:00
Bruno Cornec 995b7790c5 Fix Bug #1583539 - rpm part
Install required development packages for openssl and ffi support using
the yum package manager. This should be applied as a complement of the
patch proposed at https://review.openstack.org/#/c/318943/ which handles
the apt package manager.

Partial-Bug: 1583539
Change-Id: I987237d7e0b247875d7351bd79d387dcb98968a7
2016-05-26 12:54:44 +00:00
Ghe Rivero 7585b5c871 Install libssl-dev and libffi-dev
On official ubuntu docker images, those libs are not
installed by default and are needed to compile the
python crypto modules.

Change-Id: If73529d2c1f3702ec55ea5520510eaef5016c1ba
2016-05-19 22:45:08 +02:00
Jenkins 0d0e60b1a9 Merge "Cleanup inspection module location" 2016-03-21 15:32:02 +00:00
Julia Kreger 23fc7aefb4 Cleanup inspection module location
The inspection module has been submitted for inclusion in ansible,
and as such a duplicate is no longer required. Removing duplicate
and adding call to retreieve the module if missing.

Change-Id: Ib4b395bee5ae80c4cafc9628710b536db895d952
2016-03-20 14:21:11 -04:00
Jenkins d4e765189c Merge "Install python if it's not there" 2016-03-14 17:23:03 +00:00
Jenkins 789987dcc8 Merge "Fixing virtualenv issues" 2016-03-03 06:07:19 +00:00