Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(package.install): proper package for CentOS and Rocky Linux 8 #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 20 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,31 @@ repos:
stages: [manual]
additional_dependencies: ['@commitlint/[email protected]']
always_run: true
- repo: https://github.com/adithyabsk/mirrors-rubocop
rev: v0.91.0
- repo: https://github.com/rubocop-hq/rubocop
rev: v1.25.1
hooks:
- id: rubocop
name: Check Ruby files with rubocop
args: [--debug]
always_run: true
pass_filenames: false
- repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: 2.1.3
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.8.0.4
hooks:
- id: shellcheck
name: Check shell scripts with shellcheck
files: ^.*\.(sh|bash|ksh)$
types: []
args: []
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.23.0
- repo: https://github.com/adrienverge/yamllint
rev: v1.26.3
hooks:
- id: yamllint
name: Check YAML syntax with yamllint
args: [--strict, '.']
always_run: true
pass_filenames: false
- repo: https://github.com/warpnet/salt-lint
rev: v0.3.0
rev: v0.8.0
hooks:
- id: salt-lint
name: Check Salt files using salt-lint
Expand All @@ -53,4 +52,16 @@ repos:
- id: rstcheck
name: Check reST files using rstcheck
exclude: 'docs/CHANGELOG.rst'
args: [--report=warning]
- repo: https://github.com/saltstack-formulas/mirrors-rst-lint
rev: v1.3.2
hooks:
- id: rst-lint
name: Check reST files using rst-lint
exclude: |
(?x)^(
docs/CHANGELOG.rst|
docs/TOFS_pattern.rst|
docs/CONTRIBUTING_DOCS.rst|
docs/index.rst|
)$
additional_dependencies: [pygments==2.9.0]
18 changes: 9 additions & 9 deletions docs/README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. _readme:

wireguard-formula
================
=================

|img_travis| |img_sr| |img_pc|

Expand Down Expand Up @@ -73,7 +73,7 @@ Available states
:local:

``wireguard``
^^^^^^^^^^^^
^^^^^^^^^^^^^

*Meta-state (This is a state that includes other states)*.

Expand All @@ -82,24 +82,24 @@ manages the wireguard configuration file and then
starts the associated wireguard service.

``wireguard.package``
^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^

This state will install the wireguard package only.

``wireguard.config``
^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^

This state will configure the wireguard service and has a dependency on ``wireguard.install``
via include list.

``wireguard.service``
^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^

This state will start the wireguard service and has a dependency on ``wireguard.config``
via include list.

``wireguard.clean``
^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^

*Meta-state (This is a state that includes other states)*.

Expand All @@ -109,18 +109,18 @@ removes the configuration file and
then uninstalls the package.

``wireguard.service.clean``
^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^

This state will stop the wireguard service and disable it at boot time.

``wireguard.config.clean``
^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^

This state will remove the configuration of the wireguard service and has a
dependency on ``wireguard.service.clean`` via include list.

``wireguard.package.clean``
^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^

This state will remove the wireguard package and has a depency on
``wireguard.config.clean`` via include list.
Expand Down
2 changes: 2 additions & 0 deletions wireguard/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
wireguard:
pkg:
name: wireguard
pkgs: {}
repos: {}
rootgroup: root
config: '/etc/wireguard'
service:
Expand Down
52 changes: 51 additions & 1 deletion wireguard/osfingermap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,63 @@ Fedora-31: {}
Fedora-30: {}

# os: CentOS
CentOS Linux-8: {}
CentOS Linux-8:
service:
name: wg-quick
pkg:
repos:
epel:
humanname: Extra Packages for Enterprise Linux 8 - $basearch
mirrorlist: |-
https://mirrors.fedoraproject.org/metalink?repo=epel-8&arch=$basearch&
infra=$infra&content=$contentdir
enabled: 1
gpgcheck: 1
gpgkey: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
elrepo:
humanname: ELRepo.org Community Enterprise Linux Repository - el8
mirrorlist: http://mirrors.elrepo.org/mirrors-elrepo.el8
enabled: 1
gpgcheck: 1
gpgkey: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-elrepo.org
pkgs:
wireguard-tools:
fromrepo: epel
kmod-wireguard:
fromrepo: elrepo

CentOS Linux-7: {}
CentOS-6:
pkg:
name: wireguard-centos-6
config: /etc/wireguard.d/custom-centos-6.conf

# os: Rocky
Rocky Linux-8:
service:
name: wg-quick
pkg:
repos:
epel:
humanname: Extra Packages for Enterprise Linux 8 - $basearch
mirrorlist: |-
https://mirrors.fedoraproject.org/metalink?repo=epel-8&arch=$basearch&
infra=$infra&content=$contentdir
enabled: 1
gpgcheck: 1
gpgkey: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
elrepo:
humanname: ELRepo.org Community Enterprise Linux Repository - el8
mirrorlist: http://mirrors.elrepo.org/mirrors-elrepo.el8
enabled: 1
gpgcheck: 1
gpgkey: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-elrepo.org
pkgs:
wireguard-tools:
fromrepo: epel
kmod-wireguard:
fromrepo: elrepo

# os: Amazon
Amazon Linux-2: {}
Amazon Linux AMI-2018: {}
Expand Down
26 changes: 26 additions & 0 deletions wireguard/package/install.sls
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,32 @@
{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ "/map.jinja" import wireguard with context %}

{%- for repo_name, repo in wireguard.pkg.repos.items() %}
wireguard-package-install-repo-{{ repo_name }}:
pkgrepo.managed:
- name: {{ repo_name }}
{%- for key, value in repo.items() %}
{%- if value is string %}
- {{ key }}: {{ value | replace('\n', '') }}
{%- else %}
- {{ key }}: {{ value }}
{%- endif %}
{%- endfor %}
{%- endfor %}

{%- if wireguard.pkg.pkgs|length > 0 %}
{%- for pkg_name, pkg in wireguard.pkg.pkgs.items() %}
wireguard-package-install-pkg-{{ pkg_name }}-installed:
pkg.installed:
- name: {{ pkg_name }}
{%- if pkg.fromrepo is defined %}
- fromrepo: {{ pkg.fromrepo }}
- require:
- pkgrepo: wireguard-package-install-repo-{{ pkg.fromrepo }}
{%- endif %}
{%- endfor %}
{%- else %}
wireguard-package-install-pkg-installed:
pkg.installed:
- name: {{ wireguard.pkg.name }}
{%- endif %}