Initial Import

This commit is contained in:
2021-05-06 07:04:29 +12:00
commit 42d8e11fc5
20 changed files with 555 additions and 0 deletions

29
.travis.yml Normal file
View File

@@ -0,0 +1,29 @@
---
language: python
python: "2.7"
# Use the new container infrastructure
sudo: false
# Install ansible
addons:
apt:
packages:
- python-pip
install:
# Install ansible
- pip install ansible
# Check ansible version
- ansible --version
# Create ansible.cfg with correct roles_path
- printf '[defaults]\nroles_path=../' >ansible.cfg
script:
# Basic role syntax check
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/

33
.yamllint Normal file
View File

@@ -0,0 +1,33 @@
---
# Based on ansible-lint config
extends: default
rules:
braces:
max-spaces-inside: 1
level: error
brackets:
max-spaces-inside: 1
level: error
colons:
max-spaces-after: -1
level: error
commas:
max-spaces-after: -1
level: error
comments: disable
comments-indentation: disable
document-start: disable
empty-lines:
max: 3
level: error
hyphens:
level: error
indentation: disable
key-duplicates: enable
line-length: disable
new-line-at-end-of-file: disable
new-lines:
type: unix
trailing-spaces: disable
truthy: disable

38
README.md Normal file
View File

@@ -0,0 +1,38 @@
Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
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:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).

2
defaults/main.yml Normal file
View File

@@ -0,0 +1,2 @@
almalinux_specify_mirror: false
almalinux_mirror_url: https://repo.almalinux.org

2
handlers/main.yml Normal file
View File

@@ -0,0 +1,2 @@
---
# handlers file for repo-almalinux

37
meta/main.yml Normal file
View File

@@ -0,0 +1,37 @@
galaxy_info:
author: Aaron Guise
description: Manage yum repository config on AlmaLinux
company: CyberCinch
# 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
license: BSD-3-Clause
min_ansible_version: 2.9
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
#
# 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: AlmaLinux
versions:
- all
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: []

View File

@@ -0,0 +1,22 @@
*******
Docker driver installation guide
*******
Requirements
============
* Docker Engine
Install
=======
Please refer to the `Virtual environment`_ documentation for installation best
practices. If not using a virtual environment, please consider passing the
widely recommended `'--user' flag`_ when invoking ``pip``.
.. _Virtual environment: https://virtualenv.pypa.io/en/latest/
.. _'--user' flag: https://packaging.python.org/tutorials/installing-packages/#installing-to-the-user-site
.. code-block:: bash
$ pip install 'molecule[docker]'

View File

@@ -0,0 +1,7 @@
---
- name: Converge
hosts: all
tasks:
- name: "Include repo-almalinux"
include_role:
name: "repo-almalinux"

View File

@@ -0,0 +1,13 @@
---
dependency:
name: galaxy
driver:
name: docker
platforms:
- name: alma
image: docker.io/guisea/py-almalinux
pre_build_image: true
provisioner:
name: ansible
verifier:
name: ansible

View File

@@ -0,0 +1,20 @@
---
# This is an example playbook to execute Ansible tests.
- name: Verify
hosts: all
tasks:
- name: Retrieve yum repofile
shell: cat /etc/yum.repos.d/almalinux.repo
ignore_errors: true
register: repofile
- name: baseurl is not defined
assert:
that:
- "'baseurl=' not in repofile.stdout"
- name: baseurl is defined
assert:
that:
- "'mirrorlist=' in repofile.stdout"

View File

@@ -0,0 +1,22 @@
*******
Docker driver installation guide
*******
Requirements
============
* Docker Engine
Install
=======
Please refer to the `Virtual environment`_ documentation for installation best
practices. If not using a virtual environment, please consider passing the
widely recommended `'--user' flag`_ when invoking ``pip``.
.. _Virtual environment: https://virtualenv.pypa.io/en/latest/
.. _'--user' flag: https://packaging.python.org/tutorials/installing-packages/#installing-to-the-user-site
.. code-block:: bash
$ pip install 'molecule[docker]'

View File

@@ -0,0 +1,10 @@
---
- name: Converge
hosts: all
tasks:
- name: "Include repo-almalinux"
include_role:
name: "repo-almalinux"
vars:
almalinux_specify_mirror: true
almalinux_mirror_url: https://someproxyormirror.org.nz

View File

@@ -0,0 +1,13 @@
---
dependency:
name: galaxy
driver:
name: docker
platforms:
- name: alma
image: docker.io/guisea/py-almalinux
pre_build_image: true
provisioner:
name: ansible
verifier:
name: ansible

View File

@@ -0,0 +1,25 @@
---
# This is an example playbook to execute Ansible tests.
- name: Verify
hosts: all
tasks:
- name: Retrieve yum repofile
shell: cat /etc/yum.repos.d/almalinux.repo
ignore_errors: true
register: repofile
- name: mirrorlist is not present
assert:
that:
- "'mirrorlist=' not in repofile.stdout"
- name: baseurl is defined
assert:
that:
- "'baseurl=' in repofile.stdout"
- name: mirror is specified correctly
assert:
that:
- "'https://someproxyormirror.org.nz' in repofile.stdout"

87
tasks/main.yml Normal file
View File

@@ -0,0 +1,87 @@
---
- name: configure repository settings
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
with_items:
- src: almalinux.repo.j2
dest: /etc/yum.repos.d/almalinux.repo
- src: almalinux-ha.repo.j2
dest: /etc/yum.repos.d/almalinux-ha.repo
when: ansible_distribution == "AlmaLinux"
# - name: ensure mirrorlist options removed (almalinux)
# ini_file:
# path: /etc/yum.repos.d/almalinux.repo
# section: "{{ item }}"
# option: mirrorlist
# state: absent
# with_items:
# - baseos
# - appstream
# - powertools
# - extras
# - baseos-source
# - appstream-source
# - powertools-source
# - extras-source
# - baseos-debuginfo
# - appstream-debuginfo
# - powertools-debuginfo
# - extras-debuginfo
# - name: ensure mirrorlist options removed (almalinux-ha)
# ini_file:
# path: /etc/yum.repos.d/almalinux-ha.repo
# section: "{{ item }}"
# option: mirrorlist
# state: absent
# with_items:
# - ha
# - ha-source
# - ha-debuginfo
# - name: ensure baseurl is set (almalinux)
# ini_file:
# path: /etc/yum.repos.d/almalinux.repo
# section: "{{ item.section }}"
# option: baseurl
# value: "{{ almalinux_mirror_url }}/$releasever/{{ item.directory }}/$basearch/"
# state: present
# with_items:
# - section: baseos
# directory: BaseOS
# - section: appstream
# directory: AppStream
# - section: powertools
# directory: PowerTools
# - section: extras
# directory: extras
# - section: baseos-source
# directory: BaseOS/Source
# - section: appstream-source
# directory: AppStream/Source
# - section: powertools-source
# directory: PowerTools/Source
# - section: extras-source
# directory: extras/Source
# - section: baseos-debuginfo
# directory: BaseOS/debug
# - section: appstream-debuginfo
# directory: AppStream/debug
# - section: powertools-debuginfo
# directory: PowerTools/debug
# - section: extras-debuginfo
# directory: extras/debug
# # - name: ensure baseurl is set (almalinux-ha)
# # ini_file:
# # path: /etc/yum.repos.d/almalinux.repo
# # section: "{{ item.section }}"
# # option: baseurl
# # value: "{{ almalinux_mirror_url }}/$releasever/{{ item.directory }}/$basearch/"
# # state: present
# # with_items:
# # - section: ha
# # directory: HighAvailability/
# # - section: ha-source
# # - section: ha-debuginfo

View File

@@ -0,0 +1,39 @@
# almalinux-ha.repo
[ha]
name=AlmaLinux $releasever - HighAvailability
{% if almalinux_specify_mirror is sameas true %}
baseurl={{ almalinux_mirror_url }}/almalinux/$releasever/HighAvailability/$basearch/os/
{% else %}
mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/ha
{% endif %}
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
fastestmirror=1
## Sources
[ha-source]
name=AlmaLinux $releasever - HighAvailability Source
{% if almalinux_specify_mirror is sameas true %}
baseurl={{ almalinux_mirror_url }}/almalinux/$releasever/HighAvailability/Source/
{% else %}
mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/ha-source
{% endif %}
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
fastestmirror=1
## Debuginfo
[ha-debuginfo]
name=AlmaLinux $releasever - HighAvailability debuginfo
{% if almalinux_specify_mirror is sameas true %}
baseurl={{ almalinux_mirror_url }}/almalinux/$releasever/HighAvailability/debug/$basearch/
{% else %}
mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/ha-debuginfo
{% endif %}
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
fastestmirror=1

147
templates/almalinux.repo.j2 Normal file
View File

@@ -0,0 +1,147 @@
# almalinux.repo
[baseos]
name=AlmaLinux $releasever - BaseOS
{% if almalinux_specify_mirror is sameas true %}
baseurl={{ almalinux_mirror_url }}/almalinux/$releasever/BaseOS/$basearch/os/
{% else %}
mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/baseos
{% endif %}
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
fastestmirror=1
[appstream]
name=AlmaLinux $releasever - AppStream
{% if almalinux_specify_mirror is sameas true %}
baseurl={{ almalinux_mirror_url }}/almalinux/$releasever/AppStream/$basearch/os/
{% else %}
mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/appstream
{% endif %}
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
fastestmirror=1
[powertools]
name=AlmaLinux $releasever - PowerTools
{% if almalinux_specify_mirror is sameas true %}
baseurl={{ almalinux_mirror_url }}/almalinux/$releasever/PowerTools/$basearch/os/
{% else %}
mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/powertools
{% endif %}
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
fastestmirror=1
[extras]
name=AlmaLinux $releasever - Extras
{% if almalinux_specify_mirror is sameas true %}
baseurl={{ almalinux_mirror_url }}/almalinux/$releasever/extras/$basearch/os/
{% else %}
mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/extras
{% endif %}
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
fastestmirror=1
## Sources
[baseos-source]
name=AlmaLinux $releasever - BaseOS Source
{% if almalinux_specify_mirror is sameas true %}
baseurl={{ almalinux_mirror_url }}/almalinux/$releasever/BaseOS/Source/
{% else %}
mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/baseos-source
{% endif %}
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
fastestmirror=1
[appstream-source]
name=AlmaLinux $releasever - AppStream Source
{% if almalinux_specify_mirror is sameas true %}
baseurl={{ almalinux_mirror_url }}/almalinux/$releasever/AppStream/Source/
{% else %}
mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/appstream-source
{% endif %}
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
fastestmirror=1
[powertools-source]
name=AlmaLinux $releasever - PowerTools Source
{% if almalinux_specify_mirror is sameas true %}
baseurl={{ almalinux_mirror_url }}/almalinux/$releasever/PowerTools/Source/
{% else %}
mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/powertools-source
{% endif %}
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
fastestmirror=1
[extras-source]
name=AlmaLinux $releasever - Extras Source
{% if almalinux_specify_mirror is sameas true %}
baseurl={{ almalinux_mirror_url }}/almalinux/$releasever/extras/Source/
{% else %}
mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/extras-source
{% endif %}
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
fastestmirror=1
## Debuginfo
[baseos-debuginfo]
name=AlmaLinux $releasever - BaseOS debuginfo
{% if almalinux_specify_mirror is sameas true %}
baseurl={{ almalinux_mirror_url }}/almalinux/$releasever/BaseOS/debug/$basearch/
{% else %}
mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/baseos-debuginfo
{% endif %}
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
fastestmirror=1
[appstream-debuginfo]
name=AlmaLinux $releasever - AppStream debuginfo
{% if almalinux_specify_mirror is sameas true %}
baseurl={{ almalinux_mirror_url }}/almalinux/$releasever/AppStream/debug/$basearch/
{% else %}
mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/appstream-debuginfo
{% endif %}
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
fastestmirror=1
[powertools-debuginfo]
name=AlmaLinux $releasever - PowerTools debuginfo
{% if almalinux_specify_mirror is sameas true %}
baseurl={{ almalinux_mirror_url }}/almalinux/$releasever/PowerTools/debug/$basearch/
{% else %}
mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/powertools-debuginfo
{% endif %}
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
fastestmirror=1
[extras-debuginfo]
name=AlmaLinux $releasever - Extras debuginfo
{% if almalinux_specify_mirror is sameas true %}
baseurl={{ almalinux_mirror_url }}/almalinux/$releasever/extras/debug/$basearch/
{% else %}
mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/extras-debuginfo
{% endif %}
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
fastestmirror=1

2
tests/inventory Normal file
View File

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

5
tests/test.yml Normal file
View File

@@ -0,0 +1,5 @@
---
- hosts: localhost
remote_user: root
roles:
- repo-almalinux

2
vars/main.yml Normal file
View File

@@ -0,0 +1,2 @@
---
# vars file for repo-almalinux