Make tripleo-repos be an ansible collection
- assures ansible modules are not included in sdist/wheel - makes tripleo-repos a collection with tripleo_repos python being vendored inside module_utils - use a symlink from triple_repo to plugins/module_utils/triple_repos for convenience. Note that we cannot do the other way around because galaxy build does not follow symlinks, but pbr does not have any problem following the symlink. - extend packaging testing to install collection and test Ansible can find the new modules - updates the excludes inside galaxy.yml to avoid accidental inclusion of undesired files when building the collection. - ensure we have consistent and logic names, making easy to use fully qualified ansible module names: tripleo.repos.get_hash and triple.repos.yum_config. Change-Id: I743552a149513868de77cad0855a5c0dc0ae0f71
This commit is contained in:
1 parent
0ecc6e0bbb
commit
77dc5794ac
28 files changed
+87
-42
No files matched your search
@@ -19,3 +19,7 @@ develop-eggs
|
||||
.installed.cfg
|
||||
lib
|
||||
lib64
|
||||
|
||||
# built ansible collection
|
||||
*.tar.gz
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
global-exclude *.py[cod]
|
||||
global-exclude __pycache__
|
||||
recursive-exclude plugins *
|
||||
+7
-12
@@ -1,6 +1,6 @@
|
||||
# tripleo-get-hash
|
||||
# tripleo.repos.get_hash
|
||||
|
||||
## What is tripleo-get-hash
|
||||
## What is tripleo.repos.get_hash
|
||||
|
||||
This utility is meant for use by TripleO deployments, particularly in zuul
|
||||
continuous integration jobs. Given an [RDO named tag](https://docs.openstack.org/tripleo-docs/latest/ci/stages-overview.html#rdo-dlrn-promotion-criteria),
|
||||
@@ -59,20 +59,15 @@ all of constants.CONFIG_KEYS to avoid explosions.
|
||||
|
||||
## Ansible Module
|
||||
|
||||
The tripleo-get-hash utility can be invoked from ansible using the
|
||||
[tripleo_get_hash.py](https://opendev.org/openstack/tripleo-repos/src/branch/master/tripleo-get-hash/tripleo_get_hash.py) ansible module from the source tree.
|
||||
If you install tripleo-get-hash using python setup.py, the module will be
|
||||
installed for you at /usr/share/ansible/plugins/modules/ and is ready to use.
|
||||
Otherwise you will need to copy this file to somewhere that your ansible
|
||||
installation can find it. It is required that you install tripleo-get-hash either
|
||||
via pip or via setup.py before you can use the ansible module.
|
||||
It is required that you install `tripleo.repos` collection to use the ansible
|
||||
module.
|
||||
|
||||
See the [example playbook](https://opendev.org/openstack/tripleo-repos/src/branch/master/tripleo-get-hash/example_playbook.yaml) included here for examples of
|
||||
See the [example playbook](https://opendev.org/openstack/tripleo-repos/src/branch/master/playbooks/example_get_hash.yaml) included here for examples of
|
||||
usage. You can also test the ansible module is available and working correctly
|
||||
from the bash shell:
|
||||
from using shell:
|
||||
|
||||
```
|
||||
$ ansible localhost -m tripleo_get_hash -a "component=compute release=victoria"
|
||||
$ ansible localhost -m tripleo.repos.get_hash -a "component=compute release=victoria"
|
||||
localhost | SUCCESS => {
|
||||
"changed": false,
|
||||
"commit_hash": "e954a56fec69637ebd671643d41bb0ecc85a2656",
|
||||
|
||||
+9
-9
@@ -1,4 +1,4 @@
|
||||
# tripleo_repos.yum_config
|
||||
# tripleo.repos.yum_config
|
||||
|
||||
*tripleo-yum-config* utility was designed to simplify the way that TripleO
|
||||
deployments manage their yum configuration. This tool helps on updating
|
||||
@@ -75,11 +75,11 @@ tripleo-yum-config --help
|
||||
|
||||
## Ansible Module
|
||||
|
||||
An ansible module [tripleo_yum_config](https://opendev.org/openstack/tripleo-repos/src/branch/master/tripleo-yum-config/tripleo_yum_config.py)
|
||||
is available for you when you install tripleo-yum-config, either by using
|
||||
setup.py or pip. The module is installed at the relative path
|
||||
*share/ansible/plugins/modules*, which may land on a different directory,
|
||||
depending on how you are installing this package. Check your ansible
|
||||
configuration to see if the directory is included in your ansible library path.
|
||||
An [example playbook](https://opendev.org/openstack/tripleo-repos/src/branch/master/tripleo-yum-config/example_playbook.yaml)
|
||||
is available to assist on module usage.
|
||||
It is required that you install `tripleo.repos` collection to use the ansible
|
||||
module.
|
||||
|
||||
An ansible module [tripleo.repos.yum_config](https://opendev.org/openstack/tripleo-repos/src/branch/master/modules/module/modules/yum_config.py)
|
||||
is available for you when you install `tripleo.repos` collection.
|
||||
|
||||
An [example playbook](https://opendev.org/openstack/tripleo-repos/src/branch/master/playbooks/example_yum_config.yaml)
|
||||
is available to assist with module usage.
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
name: repos
|
||||
namespace: tripleo
|
||||
version: 0.0.2
|
||||
readme: README.md
|
||||
authors:
|
||||
- Red Hat
|
||||
description: TripleO Repos
|
||||
build_ignore:
|
||||
- "*.egg-info"
|
||||
- .DS_Store
|
||||
- .eggs
|
||||
- .gitignore
|
||||
- .gitreview
|
||||
- .mypy_cache
|
||||
- .pytest_cache
|
||||
- .stestr
|
||||
- .stestr.conf
|
||||
- .tox
|
||||
- .vscode
|
||||
- MANIFEST.in
|
||||
- build
|
||||
- dist
|
||||
- doc
|
||||
- report.html
|
||||
- setup.cfg
|
||||
- setup.py
|
||||
- tests
|
||||
- tox.ini
|
||||
- tripleo_repos
|
||||
- zuul.d
|
||||
# excluded because galaxy server refuses uploads with __main___ inside
|
||||
- plugins/module_utils/tripleo_repos/get_hash/__main__.py
|
||||
- plugins/module_utils/tripleo_repos/yum_config/__main__.py
|
||||
|
||||
repository: https://opendev.org/openstack/tripleo-repos
|
||||
license_file: LICENSE
|
||||
@@ -0,0 +1 @@
|
||||
requires_ansible: 2.9.0
|
||||
@@ -3,7 +3,7 @@
|
||||
hosts: localhost
|
||||
tasks:
|
||||
- name: get component-ci-testing for victoria compute component
|
||||
tripleo_get_hash:
|
||||
tripleo.repos.get_hash:
|
||||
os_version: centos8 # default: centos8
|
||||
release: victoria # default: master
|
||||
component: compute # default: None
|
||||
@@ -17,7 +17,7 @@
|
||||
var: component_ci_testing_victoria_compute
|
||||
|
||||
- name: get centos7 tripleo-ci-testing for train
|
||||
tripleo_get_hash:
|
||||
tripleo.repos.get_hash:
|
||||
os_version: centos7
|
||||
release: train
|
||||
tag: tripleo-ci-testing
|
||||
@@ -30,7 +30,7 @@
|
||||
var: centos7_tripleo_ci_testing_train
|
||||
|
||||
- name: get current-tripleo centos8 for master branch
|
||||
tripleo_get_hash:
|
||||
tripleo.repos.get_hash:
|
||||
register: centos8_current_tripleo_master
|
||||
|
||||
- debug:
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
---
|
||||
- name: Example usage for tripleo_yum_config python module
|
||||
- name: Example usage for tripleo.repos.yum_config ansible module
|
||||
hosts: localhost
|
||||
tasks:
|
||||
- name: Enable fake yum repo and set exclude dirs
|
||||
become: true
|
||||
tripleo_yum_config:
|
||||
tripleo.repos.yum_config:
|
||||
type: repo
|
||||
name: appstream
|
||||
enabled: true
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
- name: Enable and install nginx module
|
||||
become: true
|
||||
tripleo_yum_config:
|
||||
tripleo.repos.yum_config:
|
||||
type: module
|
||||
name: nginx
|
||||
enabled: true
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
- name: Set yum global options in dnf.conf
|
||||
become: true
|
||||
tripleo_yum_config:
|
||||
tripleo.repos.yum_config:
|
||||
type: global
|
||||
file_path: /etc/dnf/dnf.conf
|
||||
set_options:
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -26,9 +26,6 @@ packages =
|
||||
tripleo_repos
|
||||
data_files =
|
||||
etc/tripleo_get_hash/ = tripleo_repos/get_hash/config.yaml
|
||||
# Temporary until we get a proper Ansible collection:
|
||||
share/ansible/plugins/modules/ = tripleo_repos/yum_config/tripleo_yum_config.py
|
||||
share/ansible/plugins/modules/ = tripleo_repos/get_hash/tripleo_get_hash.py
|
||||
|
||||
[entry_points]
|
||||
console_scripts =
|
||||
|
||||
@@ -6,19 +6,22 @@ envlist = py,pep8,packaging
|
||||
[testenv]
|
||||
usedevelop = True
|
||||
setenv = VIRTUAL_ENV={envdir}
|
||||
passenv =
|
||||
HOME
|
||||
deps =
|
||||
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
-r{toxinidir}/requirements.txt
|
||||
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
-r{toxinidir}/requirements.txt
|
||||
commands =
|
||||
stestr run --slowest {posargs}
|
||||
stestr run --slowest {posargs}
|
||||
|
||||
[testenv:venv]
|
||||
commands = {posargs}
|
||||
|
||||
[testenv:docs]
|
||||
deps = -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
|
||||
-r{toxinidir}/doc/requirements.txt
|
||||
deps =
|
||||
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
|
||||
-r{toxinidir}/doc/requirements.txt
|
||||
whitelist_externals =
|
||||
rm
|
||||
commands =
|
||||
@@ -31,12 +34,12 @@ commands = flake8
|
||||
|
||||
[testenv:cover]
|
||||
setenv =
|
||||
PYTHON=coverage run --source tripleo_repos --parallel-mode
|
||||
PYTHON=coverage run --source tripleo_repos --parallel-mode
|
||||
commands =
|
||||
stestr run {posargs}
|
||||
coverage combine
|
||||
coverage html -d cover
|
||||
coverage xml -o cover/coverage.xml
|
||||
stestr run {posargs}
|
||||
coverage combine
|
||||
coverage html -d cover
|
||||
coverage xml -o cover/coverage.xml
|
||||
|
||||
[testenv:packaging]
|
||||
description =
|
||||
@@ -44,6 +47,7 @@ description =
|
||||
deps =
|
||||
build
|
||||
twine
|
||||
ansible-core # used for ansible-galaxy command
|
||||
skip_install = true
|
||||
commands =
|
||||
# build wheel and sdist using PEP-517
|
||||
@@ -65,6 +69,11 @@ commands =
|
||||
tripleo-repos --help
|
||||
tripleo-get-hash --help
|
||||
tripleo-yum-config --help
|
||||
# Validate collection installation
|
||||
ansible-galaxy collection install --force .
|
||||
# Ensure that ansible is able to load the modules, as syntax check will fail
|
||||
# if modules cannot be loaded.
|
||||
sh -c "ansible-playbook --syntax-check playbooks/*.yaml"
|
||||
|
||||
whitelist_externals =
|
||||
sh
|
||||
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
plugins/module_utils/tripleo_repos
|
||||
Reference in new issue
Block a user