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
Alex Schultz 5 months ago
parent
commit
45a61bd2c1

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

@@ -0,0 +1,54 @@
1
+tripleo-repos
2
+=============
3
+
4
+A role to install and run tripleo-repos to setup the CentOS and RDO yum
5
+repositories.
6
+
7
+Role Variables
8
+--------------
9
+
10
+.. list-table:: Variables used for chrony
11
+   :widths: auto
12
+   :header-rows: 1
13
+
14
+   * - Name
15
+     - Default Value
16
+     - Description
17
+   * - `tripleo_repos_repository`
18
+     - `git+https://git.openstack.org/openstack/tripleo-repos`
19
+     - Git repository to pip install tripleo-repos from
20
+   * - `workspace`
21
+     - `ansible_user_dir`
22
+     - Workspace directory to put the venv into
23
+   * - `centos_mirror_host`
24
+     - `http://mirror.centos.org`
25
+     - Mirror host for CentOS repositories
26
+   * - `rdo_mirror_host`
27
+     - `https://trunk.rdoproject.org`
28
+     - Mirror host for RDO repositories
29
+
30
+Requirements
31
+------------
32
+
33
+ - ansible >= 2.4
34
+ - python >= 2.6
35
+
36
+Dependencies
37
+------------
38
+
39
+None
40
+
41
+Example Playbooks
42
+-----------------
43
+
44
+.. code-block::
45
+
46
+    - hosts: localhost
47
+      become: true
48
+      roles:
49
+        - tripleo-repos
50
+
51
+License
52
+-------
53
+
54
+Apache 2.0

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

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

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

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

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

@@ -0,0 +1,56 @@
1
+galaxy_info:
2
+  author: Alex Schultz
3
+  description: Role to run tripleo-repos
4
+
5
+  # If the issue tracker for your role is not on github, uncomment the
6
+  # next line and provide a value
7
+  # issue_tracker_url: http://example.com/issue/tracker
8
+
9
+  # Some suggested licenses:
10
+  # - BSD (default)
11
+  # - MIT
12
+  # - GPLv2
13
+  # - GPLv3
14
+  # - Apache
15
+  # - CC-BY
16
+  license: Apache
17
+
18
+  min_ansible_version: 2.4
19
+
20
+  # If this a Container Enabled role, provide the minimum Ansible Container version.
21
+  # min_ansible_container_version:
22
+
23
+  # Optionally specify the branch Galaxy will use when accessing the GitHub
24
+  # repo for this role. During role install, if no tags are available,
25
+  # Galaxy will use this branch. During import Galaxy will access files on
26
+  # this branch. If Travis integration is configured, only notifications for this
27
+  # branch will be accepted. Otherwise, in all cases, the repo's default branch
28
+  # (usually master) will be used.
29
+  #github_branch:
30
+
31
+  #
32
+  # platforms is a list of platforms, and each platform has a name and a list of versions.
33
+  #
34
+  # platforms:
35
+  # - name: Fedora
36
+  #   versions:
37
+  #   - all
38
+  #   - 25
39
+  # - name: SomePlatform
40
+  #   versions:
41
+  #   - all
42
+  #   - 1.0
43
+  #   - 7
44
+  #   - 99.99
45
+
46
+  galaxy_tags: []
47
+    # List tags for your role here, one per line. A tag is a keyword that describes
48
+    # and categorizes the role. Users find roles by searching for tags. Be sure to
49
+    # remove the '[]' above, if you add tags to this list.
50
+    #
51
+    # NOTE: A tag is limited to a single word comprised of alphanumeric characters.
52
+    #       Maximum 20 tags per role.
53
+
54
+dependencies: []
55
+  # List your role dependencies here, one per line. Be sure to remove the '[]' above,
56
+  # if you add dependencies to this list.

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

@@ -0,0 +1,45 @@
1
+---
2
+- name: Install pip
3
+  become: true
4
+  package:
5
+    name: python-pip
6
+    state: present
7
+
8
+- name: Install virtualenv
9
+  become: true
10
+  package:
11
+    name: python-virtualenv
12
+    state: present
13
+
14
+- name: pip install tripleo-repos
15
+  become: true
16
+  pip:
17
+    name: "{{ tripleo_repos_repository }}"
18
+    virtualenv: "{{ workspace }}/venv"
19
+
20
+- name: Get branch
21
+  set_fact:
22
+    ci_branch: "{{ zuul.branch | default('master') | replace('stable/','') }}"
23
+  when: zuul is defined
24
+
25
+- name: Install repos
26
+  become: true
27
+  shell: |
28
+    set -ex
29
+    source {{ workspace }}/venv/bin/activate
30
+    if [ -f /etc/ci/mirror_info.sh ]; then
31
+      source /etc/ci/mirror_info.sh
32
+      CENTOS_MIRROR_HOST="http://${NODEPOOL_MIRROR_HOST}"
33
+    fi
34
+    CENTOS_MIRROR_HOST=${CENTOS_MIRROR_HOST:-"{{ centos_mirror_host }}"}
35
+    RDO_MIRROR_HOST=${NODEPOOL_RDO_PROXY:-"{{ rdo_mirror_host }}"}
36
+
37
+    if [ "{{ ci_branch | default('master') }}" == "master" ]; then
38
+      REPO=current-tripleo
39
+    else
40
+      REPO=current
41
+    fi
42
+
43
+    tripleo-repos -b "{{ ci_branch | default('master') }}" \
44
+                  --centos-mirror $CENTOS_MIRROR_HOST \
45
+                  --rdo-mirror $RDO_MIRROR_HOST $REPO

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

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

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

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

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

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

Loading…
Cancel
Save