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 #1

Closed
wants to merge 1 commit into from
Closed
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
fix(package.install): proper package for CentOS and Rocky Linux 8
fixes saltstack-formulas#3

Squashed commit of the following:

commit f07bf84
Author: Ewout van Mansom <ewout@vanmansom.name>
Date:   Fri May 20 19:06:29 2022 +0200

    fix(osfingermap): support CentOS 8

commit 7220f67
Author: Ewout van Mansom <ewout@vanmansom.name>
Date:   Fri May 20 18:56:59 2022 +0200

    fix(osfingermap): set service name to wg-quick for Rocky Linux 8

commit aeb7ac7
Author: Ewout van Mansom <ewout@vanmansom.name>
Date:   Fri May 20 18:48:57 2022 +0200

    fix(package.install): set name to pkgrepo state call

commit 311851a
Author: Ewout van Mansom <ewout@vanmansom.name>
Date:   Fri May 20 18:44:47 2022 +0200

    fix(package.install): indent wireguard-package-install-pkg-{{ pkg_name }} correctly

commit 2793a10
Author: Ewout van Mansom <ewout@vanmansom.name>
Date:   Fri May 20 18:41:38 2022 +0200

    fix(package.install): resolve conflicting state ID

commit 59d9982
Author: Ewout van Mansom <ewout@vanmansom.name>
Date:   Fri May 20 18:40:20 2022 +0200

    fix(package.install): iterate over all pkgs instead

commit 773e53a
Author: Ewout van Mansom <ewout@vanmansom.name>
Date:   Fri May 20 18:37:18 2022 +0200

    fix(package.install): support CentOS and Rocky Linux 8

commit 6e0d328
Author: Ewout van Mansom <ewout@vanmansom.name>
Date:   Fri May 20 18:36:19 2022 +0200

    chore(precommit): update
emansom committed May 21, 2022
commit 4959e4eafeb91381362ccb4a802a5838a7d029c6
29 changes: 20 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -17,32 +17,31 @@ repos:
stages: [manual]
additional_dependencies: ['@commitlint/config-conventional@8.3.4']
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
@@ -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|

@@ -73,7 +73,7 @@ Available states
:local:

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

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

@@ -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)*.

@@ -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.
2 changes: 2 additions & 0 deletions wireguard/defaults.yaml
Original file line number Diff line number Diff line change
@@ -4,6 +4,8 @@
wireguard:
pkg:
name: wireguard
pkgs: {}
repos: {}
rootgroup: root
config: '/etc/wireguard'
service:
52 changes: 51 additions & 1 deletion wireguard/osfingermap.yaml
Original file line number Diff line number Diff line change
@@ -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: {}
26 changes: 26 additions & 0 deletions wireguard/package/install.sls
Original file line number Diff line number Diff line change
@@ -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 %}