diff --git a/roles/tripleo-repos/README.rst b/roles/tripleo-repos/README.rst new file mode 100644 index 000000000..118bdfe26 --- /dev/null +++ b/roles/tripleo-repos/README.rst @@ -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 diff --git a/roles/tripleo-repos/defaults/main.yml b/roles/tripleo-repos/defaults/main.yml new file mode 100644 index 000000000..0d3efc887 --- /dev/null +++ b/roles/tripleo-repos/defaults/main.yml @@ -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" diff --git a/roles/tripleo-repos/handlers/main.yml b/roles/tripleo-repos/handlers/main.yml new file mode 100644 index 000000000..98393f7c6 --- /dev/null +++ b/roles/tripleo-repos/handlers/main.yml @@ -0,0 +1,2 @@ +--- +# handlers file for tripleo-repos \ No newline at end of file diff --git a/roles/tripleo-repos/meta/main.yml b/roles/tripleo-repos/meta/main.yml new file mode 100644 index 000000000..5f857da2d --- /dev/null +++ b/roles/tripleo-repos/meta/main.yml @@ -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. diff --git a/roles/tripleo-repos/tasks/main.yml b/roles/tripleo-repos/tasks/main.yml new file mode 100644 index 000000000..264787566 --- /dev/null +++ b/roles/tripleo-repos/tasks/main.yml @@ -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 diff --git a/roles/tripleo-repos/tests/inventory b/roles/tripleo-repos/tests/inventory new file mode 100644 index 000000000..878877b07 --- /dev/null +++ b/roles/tripleo-repos/tests/inventory @@ -0,0 +1,2 @@ +localhost + diff --git a/roles/tripleo-repos/tests/test.yml b/roles/tripleo-repos/tests/test.yml new file mode 100644 index 000000000..099016259 --- /dev/null +++ b/roles/tripleo-repos/tests/test.yml @@ -0,0 +1,5 @@ +--- +- hosts: localhost + remote_user: root + roles: + - tripleo-repos \ No newline at end of file diff --git a/roles/tripleo-repos/vars/main.yml b/roles/tripleo-repos/vars/main.yml new file mode 100644 index 000000000..ad3af5a55 --- /dev/null +++ b/roles/tripleo-repos/vars/main.yml @@ -0,0 +1,2 @@ +--- +# vars file for tripleo-repos \ No newline at end of file