Browse Source

Role to install setup repos using tripleo-repos

For basic CI jobs, we should leverage tripleo-repos to do the yum
repository configurations for us.

Change-Id: I49ad22c44883b516bd9c8b76f71b7afeb24be20c
changes/07/615207/2
Alex Schultz 1 year ago
parent
commit
45a61bd2c1
8 changed files with 172 additions and 0 deletions
  1. +54
    -0
      roles/tripleo-repos/README.rst
  2. +6
    -0
      roles/tripleo-repos/defaults/main.yml
  3. +2
    -0
      roles/tripleo-repos/handlers/main.yml
  4. +56
    -0
      roles/tripleo-repos/meta/main.yml
  5. +45
    -0
      roles/tripleo-repos/tasks/main.yml
  6. +2
    -0
      roles/tripleo-repos/tests/inventory
  7. +5
    -0
      roles/tripleo-repos/tests/test.yml
  8. +2
    -0
      roles/tripleo-repos/vars/main.yml

+ 54
- 0
roles/tripleo-repos/README.rst View File

@@ -0,0 +1,54 @@
tripleo-repos
=============

A role to install and run tripleo-repos to setup the CentOS and RDO yum
repositories.

Role Variables
--------------

.. list-table:: Variables used for chrony
:widths: auto
:header-rows: 1

* - Name
- Default Value
- Description
* - `tripleo_repos_repository`
- `git+https://git.openstack.org/openstack/tripleo-repos`
- Git repository to pip install tripleo-repos from
* - `workspace`
- `ansible_user_dir`
- Workspace directory to put the venv into
* - `centos_mirror_host`
- `http://mirror.centos.org`
- Mirror host for CentOS repositories
* - `rdo_mirror_host`
- `https://trunk.rdoproject.org`
- Mirror host for RDO repositories

Requirements
------------

- ansible >= 2.4
- python >= 2.6

Dependencies
------------

None

Example Playbooks
-----------------

.. code-block::

- hosts: localhost
become: true
roles:
- tripleo-repos

License
-------

Apache 2.0

+ 6
- 0
roles/tripleo-repos/defaults/main.yml View File

@@ -0,0 +1,6 @@
---
# defaults file for tripleo-repos
tripleo_repos_repository: "git+https://git.openstack.org/openstack/tripleo-repos"
workspace: "{{ ansible_user_dir }}"
centos_mirror_host: "http://mirror.centos.org"
rdo_mirror_host: "https://trunk.rdoproject.org"

+ 2
- 0
roles/tripleo-repos/handlers/main.yml View File

@@ -0,0 +1,2 @@
---
# handlers file for tripleo-repos

+ 56
- 0
roles/tripleo-repos/meta/main.yml View File

@@ -0,0 +1,56 @@
galaxy_info:
author: Alex Schultz
description: Role to run tripleo-repos

# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker

# Some suggested licenses:
# - BSD (default)
# - MIT
# - GPLv2
# - GPLv3
# - Apache
# - CC-BY
license: Apache

min_ansible_version: 2.4

# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:

# Optionally specify the branch Galaxy will use when accessing the GitHub
# repo for this role. During role install, if no tags are available,
# Galaxy will use this branch. During import Galaxy will access files on
# this branch. If Travis integration is configured, only notifications for this
# branch will be accepted. Otherwise, in all cases, the repo's default branch
# (usually master) will be used.
#github_branch:

#
# platforms is a list of platforms, and each platform has a name and a list of versions.
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99

galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.

dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.

+ 45
- 0
roles/tripleo-repos/tasks/main.yml View File

@@ -0,0 +1,45 @@
---
- name: Install pip
become: true
package:
name: python-pip
state: present

- name: Install virtualenv
become: true
package:
name: python-virtualenv
state: present

- name: pip install tripleo-repos
become: true
pip:
name: "{{ tripleo_repos_repository }}"
virtualenv: "{{ workspace }}/venv"

- name: Get branch
set_fact:
ci_branch: "{{ zuul.branch | default('master') | replace('stable/','') }}"
when: zuul is defined

- name: Install repos
become: true
shell: |
set -ex
source {{ workspace }}/venv/bin/activate
if [ -f /etc/ci/mirror_info.sh ]; then
source /etc/ci/mirror_info.sh
CENTOS_MIRROR_HOST="http://${NODEPOOL_MIRROR_HOST}"
fi
CENTOS_MIRROR_HOST=${CENTOS_MIRROR_HOST:-"{{ centos_mirror_host }}"}
RDO_MIRROR_HOST=${NODEPOOL_RDO_PROXY:-"{{ rdo_mirror_host }}"}

if [ "{{ ci_branch | default('master') }}" == "master" ]; then
REPO=current-tripleo
else
REPO=current
fi

tripleo-repos -b "{{ ci_branch | default('master') }}" \
--centos-mirror $CENTOS_MIRROR_HOST \
--rdo-mirror $RDO_MIRROR_HOST $REPO

+ 2
- 0
roles/tripleo-repos/tests/inventory View File

@@ -0,0 +1,2 @@
localhost


+ 5
- 0
roles/tripleo-repos/tests/test.yml View File

@@ -0,0 +1,5 @@
---
- hosts: localhost
remote_user: root
roles:
- tripleo-repos

+ 2
- 0
roles/tripleo-repos/vars/main.yml View File

@@ -0,0 +1,2 @@
---
# vars file for tripleo-repos

Loading…
Cancel
Save