Browse Source

Update salt_pillar_apache_sample.sh

master
Pekka Helenius 6 years ago
committed by GitHub
parent
commit
8c44e79603
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 4 deletions
  1. +10
    -4
      scripts/salt_pillar_apache_sample.sh

+ 10
- 4
scripts/salt_pillar_apache_sample.sh View File

@ -34,8 +34,8 @@ SITE_DATA
tee /srv/salt/apache/samplesite.conf <<SAMPLE_SITE
<VirtualHost *:80>
ServerName {{ (grains['os'].lower() + '.' + grains['id'] + '.com') }}
ServerAlias {{ ('www.' + grains['os'].lower() + '.' + grains['id'] + '.com') }}
ServerName {{ servername }}
ServerAlias {{ serveralias }}
ServerAdmin webmaster@localhost
DocumentRoot {{ ('/var/www/html/' + grains['id'] + '/') }}
ErrorLog ${APACHE_LOG_DIR}/error.log
@ -49,6 +49,9 @@ SAMPLE_HTML
tee /srv/salt/apache/init.sls <<APACHE_DATA
{% set servername = grains['os'].lower() + '.' + grains['id'] + '.com' %}
{% set serveralias = 'www.' + grains['os'].lower() + '.' + grains['id'] + '.com' %}
apache_install:
pkg.installed:
- pkgs:
@ -63,6 +66,9 @@ sample_page_conf:
- user: root
- group: root
- template: jinja
- context:
servername: {{ servername }}
serveralias: {{ serveralias }}
- require:
- pkg: apache_install
@ -87,7 +93,7 @@ sample_page_content:
add_vhost_domain:
file.append:
- name: /etc/hosts
- text: 127.0.0.1 {{ grains['os'].lower() }}.{{ grains['id'] }}.com
- text: 127.0.0.1 {{ servername }}
- require:
- file: sample_page_content
@ -100,7 +106,7 @@ restart_httpd:
test_page:
cmd.run:
- name: 'curl {{ grains['os'].lower() }}.{{ grains['id'] }}.com'
- name: 'curl -s {{ servername }}'
- require:
- service: restart_httpd


Loading…
Cancel
Save