Update tripleo-repos to match pattern

This change updates tripleo-repos to work like the other roles in
tripleo-operator-ansible and expose all the cli options as direct
vars rather than hide them. This change maintains backwards
compatibility for the version/extra_repos vars but that usages should be
dropped by anyone consuming this role.

Change-Id: I00503563af0a6b8174169157d9da06a06f95ef0f
This commit is contained in:
Alex Schultz
2020-04-07 08:40:08 -06:00
parent be6b38c4d5
commit 2b8f053a93
3 changed files with 37 additions and 13 deletions

View File

@@ -12,10 +12,13 @@ Role Variables
--------------
* `tripleo_repos_branch`: (String) Repo branch to configure (master|train|stein|etc)
* `tripleo_repos_debug`: (Boolean) Flag to print out the tripleo-repos command being executed
* `tripleo_repos_extra_args`: (List) List of extra arguments to pass to tripleo_repos
* `tripleo_repos_extra_repos`: (List) List of extra repos to configure (e.g. ceph)
* `tripleo_repos_repo_base`: (String) Url base to RDO (default: <https://trunk.rdoproject.org>)
* `tripleo_repos_version`: (String) Version to configure (current-tripleo-dev|current-tripleo|current)
* `tripleo_repos_repos`: (List) List of repos to install
* `tripleo_repos_mirror`: (String) Base OS mirror to use
* `tripleo_repos_rdo_mirror`: (String) RDO mirror to use
* `tripleo_repos_output_path`: (String) Directory to save the repos in
Dependencies
------------
@@ -34,10 +37,10 @@ Including an example of how to use your role (for instance, with variables passe
include_role:
name: tripleo_repos
vars:
tripleo_repos_extra_repos:
tripleo_repos_repos:
- current
- ceph
tripleo_repos_extra_args:
- "--rdo-mirror https://my.awesome.mirror/"
tripleo_repos_branch: train
```
License

View File

@@ -1,7 +1,12 @@
---
# defaults file for tripleo_repos
tripleo_repos_branch: master
tripleo_repos_debug: false
tripleo_repos_distro:
tripleo_repos_extra_args: []
tripleo_repos_extra_repos: []
tripleo_repos_mirror:
tripleo_repos_output_path:
tripleo_repos_rdo_mirror:
tripleo_repos_repo_base: https://trunk.rdoproject.org
tripleo_repos_version: current-tripleo-dev
tripleo_repos_repos:
- current-tripleo-dev

View File

@@ -16,12 +16,28 @@
when: (ansible_facts.distribution_major_version|int <= 7 and not 'python2-tripleo-repos' in ansible_facts.packages) or
(ansible_facts.distribution_major_version|int >= 8 and not 'python3-tripleo-repos' in ansible_facts.packages)
- name: Setup tripleo repos ansible facts
set_fact:
_repos_cmd: >-
tripleo-repos
{{ tripleo_repos_branch | ternary('-b ' ~ tripleo_repos_branch, '') }}
{{ tripleo_repos_distro | ternary('-d ' ~ tripleo_repos_distro, '') }}
{{ tripleo_repos_output_path | ternary('-o ' ~ tripleo_repos_output_path, '') }}
{{ tripleo_repos_mirror | ternary('--mirror ' ~ tripleo_repos_mirror, '') }}
{{ tripleo_repos_rdo_mirror | ternary('--rdo-mirror ' ~ tripleo_repos_rdo_mirror, '') }}
{{ tripleo_repos_extra_args | join(' ') }}
{{ tripleo_repos_repos | join( ' ') }}
- name: Show debug information
when: tripleo_repos_debug|bool
block:
- name: Show the tripleo repos command
debug:
var: _repos_cmd
- name: Run tripleo-repos
command: >-
tripleo-repos
-b {{ tripleo_repos_branch }}
{{ tripleo_repos_extra_args | join(' ') }}
{{ tripleo_repos_version }}
{{ tripleo_repos_extra_repos | join(' ') }}
shell: "{{ _repos_cmd }}"
args:
warn: false
become: true
changed_when: true