|
@ -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 |
|
|
|
|
|
|
|
|