Skip to content

Commit

Permalink
feat(arch): add archlinux support
Browse files Browse the repository at this point in the history
  • Loading branch information
noelmcloughlin committed Oct 1, 2020
1 parent 3759b66 commit 7b1b09d
Show file tree
Hide file tree
Showing 14 changed files with 678 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
# - env: INSTANCE=modules-fedora-30-2017-7-py2
# - env: INSTANCE=modules-opensuse-leap-151-2017-7-py2
# - env: INSTANCE=modules-amazonlinux-1-2017-7-py2
# env: INSTANCE=modules-arch-base-latest-2017-7-py2
- env: INSTANCE=default-arch-base-latest-2017-7-py2

## Define the release stage that runs `semantic-release`
- stage: 'release'
Expand Down
1 change: 1 addition & 0 deletions .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ignore: |
test/**/states/**/*.sls
.kitchen/
test/salt/pillar/modules.sls
test/salt/pillar/default.sls
yaml-files:
# Default settings
Expand Down
1 change: 1 addition & 0 deletions apache/config/clean.sls
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ apache-config-clean-file-absent:
- /etc/apache2/global.conf
- /etc/httpd/conf.modules.d
- /etc/httpd/sites-enabled
- /etc/httpd/var
- {{ apache.confdir }}/server-status{{ apache.confext }}
- require:
- sls: {{ sls_service_clean }}
22 changes: 21 additions & 1 deletion apache/config/file.sls
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,25 @@ apache-config-file-directory-moddir:
- require_in:
- service: apache-service-running
{%- if apache.davlockdbdir %}
apache-config-file-directory-davlockdbdir:
file.directory:
- name: {{ apache.davlockdbdir }}
- makedirs: True
- user: {{ apache.user }}
- group: {{ apache.group }}
- recurse:
- user
- group
- require:
- sls: {{ sls_package_install }}
- require_in:
- service: apache-service-running
{%- endif %}
{%- if 'sitesdir' in apache and apache.sitesdir %}
apache-config-file-directory-sites-enabled:
file.directory:
- name: {{ apache.sitesdir }}
Expand All @@ -52,9 +70,10 @@ apache-config-file-directory-sites-enabled:
- sls: {{ sls_package_install }}
- require_in:
- service: apache-service-running
{%- endif %}
{%- endif %}
{%- if grains.os_family in ('Debian',) and 'confdir' in apache and apache.confdir %}
apache-config-file-directory-conf-enabled:
file.directory:
- name: {{ apache.confdir }}
Expand All @@ -63,6 +82,7 @@ apache-config-file-directory-conf-enabled:
- sls: {{ sls_package_install }}
- require_in:
- service: apache-service-running
{%- endif %}
apache-config-file-managed:
Expand Down
9 changes: 6 additions & 3 deletions apache/config/modules/clean.sls
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@

{%- set tplroot = tpldir.split('/')[0] %}
{%- set sls_package_clean = tplroot ~ '.package.clean' %}
{%- set sls_service_dead = tplroot ~ '.service.dead' %}
{%- from tplroot ~ "/map.jinja" import apache with context %}
include:
- {{ sls_package_clean }}
- {{ sls_service_dead }}
{%- set existing_states = salt['cp.list_states']() %}
{%- for module in salt['pillar.get']('apache:modules:disabled', []) %}
Expand All @@ -18,11 +19,11 @@ apache-config-modules-{{ module }}-disable:
- name: a2dismod -f {{ module }}
- onlyif: ls {{ apache.moddir }}/{{ module }}.load
{%- elif grains['os_family']=="RedHat" %}
{%- elif grains.os_family in ('Redhat', 'Arch') %}
cmd.run:
- name: find /etc/httpd/ -name '*.conf' -type f -exec sed -i -e 's/\(^\s*LoadModule.{{ module }}_module\)/#\1/g' {} \;
- onlyif: httpd -M 2> /dev/null | grep "[[:space:]]{{ module }}_module"
- onlyif: {{ grains.os_family in ('Arch',) and 'true' }} || (httpd -M 2> /dev/null |grep "[[:space:]]{{ module }}_module")
file.absent:
- name: /etc/httpd/conf.modules.d/*{{ module }}.conf
Expand All @@ -41,6 +42,8 @@ apache-config-modules-{{ module }}-disable:
{%- endif %}
- order: 225
- require:
- sls: {{ sls_service_dead }}
- require_in:
- pkg: apache-package-clean-pkg-removed
Expand Down
12 changes: 6 additions & 6 deletions apache/config/modules/install.sls
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

{%- set tplroot = tpldir.split('/')[0] %}
{%- set sls_service_running = tplroot ~ '.service.running' %}
{%- set sls_package_install = tplroot ~ '.package.install' %}
{%- set sls_config_file = tplroot ~ '.config.file' %}
{%- from tplroot ~ "/map.jinja" import apache with context %}
include:
- {{ sls_service_running }}
- {{ sls_package_install }}
- {{ sls_config_file }}
{% set existing_states = salt['cp.list_states']() %}
{% for module in salt['pillar.get']('apache:modules:enabled', []) %}
Expand All @@ -20,11 +20,11 @@ apache-config-modules-{{ module }}-enable:
- name: a2enmod -f {{ module }}
- onlyif: ls {{ apache.moddir }}/{{ module }}.load
{% elif grains['os_family']=="RedHat" %}
{% elif grains.os_family in ('RedHat', 'Arch') %}
cmd.run:
- name: find /etc/httpd/ -name '*.conf' -type f -exec sed -i -e 's/\(^\s*LoadModule.{{ module }}_module\)/\1/g' {} \;
- onlyif: httpd -M 2> /dev/null |grep "[[:space:]]{{ module }}_module"
- name: find /etc/httpd/ -name '*.conf' -type f -exec sed -i -e 's/\(^#\)\(\s*LoadModule.{{ module }}_module\)/\2/g' {} \;
- onlyif: {{ grains.os_family in ('Arch',) and 'true' }} || (httpd -M 2> /dev/null |grep "[[:space:]]{{ module }}_module")
{% elif salt['grains.get']('os_family') == 'Suse' %}
Expand All @@ -41,7 +41,7 @@ apache-config-modules-{{ module }}-enable:
{%- endif %}
- order: 225
- require:
- pkg: apache-package-install-pkg-installed
- sls: {{ sls_config_file }}
- watch_in:
- module: apache-service-running-restart
- require_in:
Expand Down
11 changes: 6 additions & 5 deletions apache/config/modules/mod_security/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ include:
- {{ sls_service_running }}
- {{ sls_package_install }}
{%- if grains.os_family not in ('Arch',) %}
apache-config-modules-security-pkg:
pkg.installed:
- name: {{ apache.mod_security.package }}
Expand All @@ -23,7 +25,7 @@ apache-config-modules-security-pkg:
- module: apache-service-running-reload
- service: apache-service-running
{%- if apache.mod_security.crs_install and 'crs_package' in apache.mod_security %}
{%- if apache.mod_security.crs_install and 'crs_package' in apache.mod_security %}
apache-config-modules-security-crs-pkg:
pkg.installed:
Expand All @@ -38,8 +40,8 @@ apache-config-modules-security-crs-pkg:
- module: apache-service-running-reload
- service: apache-service-running
{%- endif %}
{%- if apache.mod_security.manage_config and 'config_file' in apache.mod_security %}
{%- endif %}
{%- if apache.mod_security.manage_config and 'config_file' in apache.mod_security %}
apache-config-modules-security-main-config-file-managed:
file.managed:
Expand All @@ -61,8 +63,7 @@ apache-config-modules-security-main-config-file-managed:
- module: apache-service-running-reload
- service: apache-service-running
{%- endif %}
{%- if grains.os_family not in ('Arch',) %}
{%- endif %}
{%- if grains['os_family'] in ('Suse', 'Debian',) %}
apache-config-modules-security-cmd-run-a2en-security2:
Expand Down
1 change: 1 addition & 0 deletions apache/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ apache:
group: www-data
vhostdir: /etc/apache2/sites-available
confdir: /etc/apache2/conf.d
davlockdbdir: null
logdir: /var/log/apache2
wwwdir: /srv/apache2
document_root_user: null # Do not enforce group
Expand Down
Loading

0 comments on commit 7b1b09d

Please sign in to comment.