Add tripleo-repos role
Add a role to install/run tripleo-repos Change-Id: Ic75fb5bbdaaafb30dc90637edbbc169196ed8886
This commit is contained in:
44
roles/tripleo-repos/README.md
Normal file
44
roles/tripleo-repos/README.md
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
tripleo-repos
|
||||||
|
=============
|
||||||
|
|
||||||
|
Role to install tripleo-repos and use it to manage tripleo yum repos.
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
|
||||||
|
None
|
||||||
|
|
||||||
|
Role Variables
|
||||||
|
--------------
|
||||||
|
|
||||||
|
* `tripleo_repos_branch`: (String) Repo branch to configure (master|train|stein|etc)
|
||||||
|
* `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)
|
||||||
|
|
||||||
|
Dependencies
|
||||||
|
------------
|
||||||
|
|
||||||
|
None
|
||||||
|
|
||||||
|
Example Playbook
|
||||||
|
----------------
|
||||||
|
|
||||||
|
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||||
|
|
||||||
|
- hosts: servers
|
||||||
|
roles:
|
||||||
|
- name: Setup tripleo-repos
|
||||||
|
include_role:
|
||||||
|
name: tripleo-repos
|
||||||
|
vars:
|
||||||
|
tripleo_repos_extra_repos:
|
||||||
|
- ceph
|
||||||
|
tripleo_repos_extra_args:
|
||||||
|
- "--rdo-mirror https://my.awesome.mirror/"
|
||||||
|
|
||||||
|
License
|
||||||
|
-------
|
||||||
|
|
||||||
|
Apache-2.0
|
||||||
7
roles/tripleo-repos/defaults/main.yml
Normal file
7
roles/tripleo-repos/defaults/main.yml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
# defaults file for tripleo-repos
|
||||||
|
tripleo_repos_branch: master
|
||||||
|
tripleo_repos_extra_args: []
|
||||||
|
tripleo_repos_extra_repos: []
|
||||||
|
tripleo_repos_repo_base: https://trunk.rdoproject.org
|
||||||
|
tripleo_repos_version: current-tripleo-dev
|
||||||
2
roles/tripleo-repos/handlers/main.yml
Normal file
2
roles/tripleo-repos/handlers/main.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# handlers file for tripleo-repos
|
||||||
42
roles/tripleo-repos/meta/main.yml
Normal file
42
roles/tripleo-repos/meta/main.yml
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
---
|
||||||
|
# Copyright 2019 Red Hat, Inc.
|
||||||
|
# All Rights Reserved.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
|
||||||
|
galaxy_info:
|
||||||
|
author: OpenStack
|
||||||
|
description: TripleO Operator Role -- tripleo-repos
|
||||||
|
company: Red Hat
|
||||||
|
license: Apache-2.0
|
||||||
|
min_ansible_version: 2.8
|
||||||
|
#
|
||||||
|
# Provide a list of supported platforms, and for each platform a list of versions.
|
||||||
|
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
|
||||||
|
# To view available platforms and versions (or releases), visit:
|
||||||
|
# https://galaxy.ansible.com/api/v1/platforms/
|
||||||
|
#
|
||||||
|
platforms:
|
||||||
|
- name: CentOS
|
||||||
|
versions:
|
||||||
|
- 7
|
||||||
|
- 8
|
||||||
|
|
||||||
|
galaxy_tags:
|
||||||
|
- tripleo
|
||||||
|
|
||||||
|
|
||||||
|
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||||
|
# if you add dependencies to this list.
|
||||||
|
dependencies: []
|
||||||
31
roles/tripleo-repos/tasks/install.yml
Normal file
31
roles/tripleo-repos/tasks/install.yml
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
---
|
||||||
|
- name: Build distro string
|
||||||
|
set_fact:
|
||||||
|
_tripleo_repos_distro: "{{ (ansible_facts.distribution == 'RedHat') | ternary('rhel', 'centos') }}{{ ansible_facts.distribution_major_version }}"
|
||||||
|
|
||||||
|
- name: Build RDO repo url
|
||||||
|
set_fact:
|
||||||
|
_tripleo_repos_repo_url: "{{ tripleo_repos_repo_base }}/{{ _tripleo_repos_distro }}-{{ tripleo_repos_branch }}/current/"
|
||||||
|
|
||||||
|
- name: Find available tripleo-repos rpm
|
||||||
|
block:
|
||||||
|
- name: Grab repo package list
|
||||||
|
uri:
|
||||||
|
url: "{{ _tripleo_repos_repo_url }}"
|
||||||
|
return_content:
|
||||||
|
retries: 10
|
||||||
|
delay: 3
|
||||||
|
register: _tripleo_repos_repo_data
|
||||||
|
- name: Find rpm name
|
||||||
|
set_fact:
|
||||||
|
_tripleo_repos_rpm: "{{ _tripleo_repos_repo_data.content | regex_search('python[0-9]-tripleo-repos-[a-z0-9-.]+\\.rpm') }}"
|
||||||
|
- name: Fail if rpm is missing
|
||||||
|
fail:
|
||||||
|
msg: Unable to find tripleo-repos rpm
|
||||||
|
when: _tripleo_repos_rpm|length == 0
|
||||||
|
|
||||||
|
- name: Install tripleo-repos
|
||||||
|
yum:
|
||||||
|
name: "{{ _tripleo_repos_repo_url }}{{ _tripleo_repos_rpm }}"
|
||||||
|
state: present
|
||||||
|
become: true
|
||||||
27
roles/tripleo-repos/tasks/main.yml
Normal file
27
roles/tripleo-repos/tasks/main.yml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
---
|
||||||
|
# tasks file for tripleo-repos
|
||||||
|
|
||||||
|
# TODO(mwhahaha): uncomment this once we have a version of ansible with
|
||||||
|
# https://github.com/ansible/ansible/pull/65776
|
||||||
|
#
|
||||||
|
# - name: Gather distribution facts
|
||||||
|
# setup:
|
||||||
|
# gather_subset: "!all,!min,distribution,distribution_major_version"
|
||||||
|
|
||||||
|
- name: Gather the rpm package facts
|
||||||
|
package_facts:
|
||||||
|
|
||||||
|
- name: Install tripleo-repos
|
||||||
|
include_tasks: install.yml
|
||||||
|
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: Run tripleo-repos
|
||||||
|
command: >-
|
||||||
|
tripleo-repos
|
||||||
|
-b {{ tripleo_repos_branch }}
|
||||||
|
{{ tripleo_repos_extra_args | join(' ') }}
|
||||||
|
{{ tripleo_repos_version }}
|
||||||
|
{{ tripleo_repos_extra_repos | join(' ') }}
|
||||||
|
become: true
|
||||||
|
changed_when: true
|
||||||
2
roles/tripleo-repos/tests/inventory
Normal file
2
roles/tripleo-repos/tests/inventory
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
localhost
|
||||||
|
|
||||||
5
roles/tripleo-repos/tests/test.yml
Normal file
5
roles/tripleo-repos/tests/test.yml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
remote_user: root
|
||||||
|
roles:
|
||||||
|
- tripleo-repos
|
||||||
2
roles/tripleo-repos/vars/main.yml
Normal file
2
roles/tripleo-repos/vars/main.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# vars file for tripleo-repos
|
||||||
Reference in New Issue
Block a user