Skip to content

Commit

Permalink
Merge pull request #11 from inverse-inc/feature/use-template-for-yum-…
Browse files Browse the repository at this point in the history
…repo

Switch from yum_repository module to template module
  • Loading branch information
nqb authored Jul 20, 2021
2 parents 2bae1f4 + 127ce5c commit 3bc26ba
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 23 deletions.
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ env:
CI_PAGES_URL=http://orange-opensource.gitlab.io/gitlab-buildpkg-tools
DEB_PACKAGES_NAME="['apt-add-gitlab','gitlab-buildpkg-tools']"

- MOLECULE_DISTRO=centos7
- MOLECULE_DISTRO=centos8
CI_PROJECT_NAME=gitlab-buildpkg-tools
CI_PAGES_URL=http://orange-opensource.gitlab.io/gitlab-buildpkg-tools
RPM_PACKAGES_NAME="['yum-add-gitlab','gitlab-buildpkg-tools']"
Expand All @@ -35,15 +35,15 @@ env:
- MOLECULE_DISTRO=debian10
MOLECULE_PLAYBOOK=playbook-additional.yml

- MOLECULE_DISTRO=centos7
- MOLECULE_DISTRO=centos8
MOLECULE_PLAYBOOK=playbook-additional.yml

# - MOLECULE_DISTRO=centos8
# MOLECULE_PLAYBOOK=playbook-additional.yml

# Test enable disable repos (only for EL because that didn't make sense
# for Debian)
- MOLECULE_DISTRO=centos7
- MOLECULE_DISTRO=centos8
MOLECULE_PLAYBOOK=playbook-enable-disable-repos.yml

# - MOLECULE_DISTRO=centos8
Expand All @@ -60,7 +60,7 @@ env:
CI_PROJECT_NAME=gitlab-buildpkg-tools
CI_PAGES_URL=http://orange-opensource.gitlab.io/gitlab-buildpkg-tools

- MOLECULE_DISTRO=centos7
- MOLECULE_DISTRO=centos8
MOLECULE_PLAYBOOK=playbook-ppa-and-additional.yml
CI_PROJECT_NAME=gitlab-buildpkg-tools
CI_PAGES_URL=http://orange-opensource.gitlab.io/gitlab-buildpkg-tools
Expand All @@ -72,7 +72,7 @@ env:

# Test priority (only for EL because that didn't make sense
# for Debian)
- MOLECULE_DISTRO=centos7
- MOLECULE_DISTRO=centos8
MOLECULE_PLAYBOOK=playbook-priority.yml

install:
Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.3.1] - 2021-07-20
### Changed
- Switch from yum_repository module to template module

## [1.3.0] - 2021-06-29
### Added
- Update cache before installing packages (Debian)
Expand Down Expand Up @@ -48,7 +52,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Role name in example playbook

[Unreleased]: https://github.com/inverse-inc/ansible-role-gitlab-buildpkg-tools/compare/v1.3.0...HEAD
[Unreleased]: https://github.com/inverse-inc/ansible-role-gitlab-buildpkg-tools/compare/v1.3.1...HEAD
[1.3.1]: https://github.com/inverse-inc/ansible-role-gitlab-buildpkg-tools/compare/v1.3.0...v1.3.1
[1.3.0]: https://github.com/inverse-inc/ansible-role-gitlab-buildpkg-tools/compare/v1.2.0...v1.3.0
[1.2.0]: https://github.com/inverse-inc/ansible-role-gitlab-buildpkg-tools/compare/v1.1.0...v1.2.0
[1.1.0]: https://github.com/inverse-inc/ansible-role-gitlab-buildpkg-tools/compare/v1.0.0...v1.1.0
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,12 @@ Prerequisites:

Examples:
```shell
$ MOLECULE_DISTRO=debian10 \
$ MOLECULE_DISTRO=debian11 \
CI_PROJECT_NAME=gitlab-buildpkg-tools \
CI_PAGES_URL=http://orange-opensource.gitlab.io/gitlab-buildpkg-tools \
MOLECULE_PLAYBOOK=playbook-ppa-and-additional.yml molecule test
$ MOLECULE_DISTRO=centos7 \
$ MOLECULE_DISTRO=centos8 \
CI_PROJECT_NAME=gitlab-buildpkg-tools \
CI_PAGES_URL=http://orange-opensource.gitlab.io/gitlab-buildpkg-tools \
MOLECULE_PLAYBOOK=playbook-ppa-and-additional.yml molecule test
Expand Down
1 change: 0 additions & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ gitlab_buildpkg_tools__deb_pkgs: '{{ lookup("env", "DEB_PACKAGES_NAME") }}'
## CentOS
gitlab_buildpkg_tools__rpm_deps_pkgs:
- gnupg2
- yum-priorities

gitlab_buildpkg_tools__rpm_keys: []

Expand Down
2 changes: 1 addition & 1 deletion molecule/default/playbook-additional.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
- name: perl-client
baseurl: https://inverse-inc.gitlab.io/perl-client/centos/$releasever/$basearch
- name: packetfence
baseurl: http://inverse.ca/downloads/PacketFence/centos/$releasever/$basearch
baseurl: http://inverse.ca/downloads/PacketFence/centos/$releasever/11.0/$basearch

gitlab_buildpkg_tools__deb_pkgs:
- lemonldap-ng
Expand Down
2 changes: 1 addition & 1 deletion molecule/default/playbook-ppa-and-additional.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
- name: perl-client
baseurl: https://inverse-inc.gitlab.io/perl-client/centos/$releasever/$basearch
- name: packetfence
baseurl: http://inverse.ca/downloads/PacketFence/centos/$releasever/$basearch
baseurl: http://inverse.ca/downloads/PacketFence/centos/$releasever/11.0/$basearch

gitlab_buildpkg_tools__deb_pkgs:
- apt-add-gitlab
Expand Down
2 changes: 1 addition & 1 deletion molecule/default/playbook-priority.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
baseurl: https://inverse-inc.gitlab.io/perl-client/centos/$releasever/$basearch
priority: 1
- name: packetfence
baseurl: http://inverse.ca/downloads/PacketFence/centos/$releasever/$basearch
baseurl: http://inverse.ca/downloads/PacketFence/centos/$releasever/11.0/$basearch
priority: 99

gitlab_buildpkg_tools__rpm_pkgs:
Expand Down
17 changes: 6 additions & 11 deletions tasks/redhat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,12 @@
loop: "{{ gitlab_buildpkg_tools__rpm_combined_keys }}"

- name: install repos
yum_repository:
name: "{{ item['name'] }}"
description: "{{ item['name'] }} repo"
baseurl: "{{ item['baseurl'] }}"
enabled: yes
gpgcheck: yes
metadata_expire: "900"
skip_if_unavailable: no
repo_gpgcheck: no
priority: "{{ item['priority'] | d(omit) }}"
modules_hotfixes: "{{ item['module_hotfixes'] | d(omit) }}"
template:
src: 'yum.repo.j2'
dest: "/etc/yum.repos.d/{{ item['name'] }}.repo"
mode: 0644
owner: 'root'
group: 'root'
loop: "{{ gitlab_buildpkg_tools__rpm_combined_repos }}"
loop_control:
label: "{{ item['name'] }}"
Expand Down
14 changes: 14 additions & 0 deletions templates/yum.repo.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[{{ item['name'] }}]
name = {{ item['name'] }} repo
baseurl = {{ item['baseurl'] }}
enabled = 1
gpgcheck = 1
metadata_expire = 900
skip_if_unavailable = 0
repo_gpgcheck = 0
{% if item['priority'] is defined %}
priority = {{ item['priority'] }}
{% endif %}
{% if item['module_hotfixes'] is defined %}
module_hotfixes = {{ item['module_hotfixes'] }}
{% endif %}

0 comments on commit 3bc26ba

Please sign in to comment.