Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
apache-formula
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
salt
apache-formula
Commits
00b437aa
Unverified
Commit
00b437aa
authored
6 years ago
by
Niels Abspoel
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #232 from ze42/vhosts_cleanup
vhosts/cleanup: clean non-salted sites
parents
760cadeb
fdaa62d7
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
apache/vhosts/cleanup.sls
+37
-0
37 additions, 0 deletions
apache/vhosts/cleanup.sls
with
37 additions
and
0 deletions
apache/vhosts/cleanup.sls
0 → 100644
+
37
−
0
View file @
00b437aa
{% from "apache/map.jinja" import apache with context %}
include:
- apache
{% if grains.os_family == 'Debian' %}
{% set dirpath = '/etc/apache2/sites-enabled' %}
{# Add . and .. to make it easier to not clean those #}
{% set valid_sites = ['.', '..', ] %}
{# Take sites from apache.vhosts.standard #}
{% for id, site in salt['pillar.get']('apache:sites', {}).items() %}
{% do valid_sites.append('{}{}'.format(id, apache.confext)) %}
{% endfor %}
{# Take sites from apache.register_site #}
{% for id, site in salt['pillar.get']('apache:register-site', {}) %}
{% do valid_sites.append('{}{}'.format(site.name, apache.confext)) %}
{% endfor %}
{% for filename in salt['file.readdir']('/etc/apache2/sites-enabled/') %}
{% if filename not in valid_sites %}
a2dissite {{ filename }}:
cmd.run:
- onlyif: "test -L {{ dirpath}}/{{ filename }} || test -f {{ dirpath}}/{{ filename }}"
- watch_in:
- module: apache-reload
{% endif %}
{% endfor %}
{% endif %}{# Debian #}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment