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


Loading…
Cancel
Save