cd "`dirname \"$0\"`" &&
ANSIBLE_ROLES_PATH=debian/roles \
- exec ./run-role add-apache-vhost "$@" -e virtual_host="$vhost"
+ exec ./run-role add-apache-vhost "$@" \
+ -e virtual_host="$vhost" -e gather_facts=true
cd "`dirname \"$0\"`" &&
ANSIBLE_ROLES_PATH=debian/roles \
- exec ./run-role add-dns-domain "$@" -e domain="$domain"
+ exec ./run-role add-dns-domain "$@" \
+ -e domain="$domain" -e gather_facts=true
-<VirtualHost 127.0.0.1:80 {{ virtual_host }}:80>
+<VirtualHost 127.0.0.1:80 {{ ansible_facts.default_ipv4.address }}:80>
ServerName {{ virtual_host }}
Redirect permanent / https://{{ virtual_host }}/
ErrorLog /var/log/apache2/{{ virtual_host }}/error_log
CustomLog /var/log/apache2/{{ virtual_host }}/access_log common
</VirtualHost>
-<VirtualHost 127.0.0.1:80 {{ virtual_host }}:80>
+<VirtualHost 127.0.0.1:80 {{ ansible_facts.default_ipv4.address }}:80>
ServerName www.{{ virtual_host }}
Redirect permanent / https://{{ virtual_host }}/
ErrorLog /var/log/apache2/{{ virtual_host }}/error_log
CustomLog /var/log/apache2/{{ virtual_host }}/access_log common
</VirtualHost>
-<VirtualHost 127.0.0.1:443 {{ virtual_host }}:443>
+<VirtualHost 127.0.0.1:443 {{ ansible_facts.default_ipv4.address }}:443>
ServerName {{ virtual_host }}
DocumentRoot /home/phd/Internet/WWW/htdocs/{{ virtual_host }}
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
</VirtualHost>
-<VirtualHost 127.0.0.1:443 {{ virtual_host }}:443>
+<VirtualHost 127.0.0.1:443 {{ ansible_facts.default_ipv4.address }}:443>
ServerName www.{{ virtual_host }}
Redirect permanent / https://{{ virtual_host }}/
ErrorLog /var/log/apache2/{{ virtual_host }}/error_log
- name: Update config
become: true
shell: |
-echo '
+ echo '
-zone "{{ domain }}" {
- type master;
- file "/etc/bind/{{ domain }}";
- allow-query { any; };
- notify yes;
-};
-' >> /etc/bind/named.conf.local
+ zone "{{ domain }}" {
+ type master;
+ file "/etc/bind/{{ domain }}";
+ allow-query { any; };
+ notify yes;
+ };' >> /etc/bind/named.conf.local
when: not domain_exists.stat.exists
86400) ; Default TTL 1d
IN NS ns1.{{ domain }}.
- IN A ???
-ns1 IN A ???
+ IN A {{ ansible_facts.default_ipv4.address }}
+ns1 IN A {{ ansible_facts.default_ipv4.address }}
www IN CNAME {{ domain }}.
AuthName Apache
AuthUserFile /usr/local/apache2/data/apache.passwd
<RequireAll>
- Require ip 127.0.0.1 {{ inventory_hostname }}
+ Require ip 127.0.0.1 {{ ansible_facts.default_ipv4.address }}
Require user phd
</RequireAll>
</Location>
<IfModule mod_info.c>
<Location /server-info>
SetHandler server-info
- Require ip 127.0.0.1 {{ inventory_hostname }}
+ Require ip 127.0.0.1 {{ ansible_facts.default_ipv4.address }}
</Location>
</IfModule>
<IfModule mod_status.c>
<Location /server-status>
SetHandler server-status
- Require ip 127.0.0.1 {{ inventory_hostname }}
+ Require ip 127.0.0.1 {{ ansible_facts.default_ipv4.address }}
</Location>
ExtendedStatus On
</IfModule>
<Location /printenv.shtml>
- Require ip 127.0.0.1 {{ inventory_hostname }}
+ Require ip 127.0.0.1 {{ ansible_facts.default_ipv4.address }}
</Location>
<IfModule mod_env.c>
ErrorDocument 404 /~phd/Bookmarks/notfound.html
</Location>
-<VirtualHost {{ inventory_hostname }}:80>
+<VirtualHost {{ ansible_facts.default_ipv4.address }}:80>
ServerName unknown.invalid
DocumentRoot /home/phd/Internet/WWW/htdocs/_default_/
ErrorDocument 404 /nothing.html
- name: Check named.conf.options
- shell: "grep -c '^[ \\t]\\+allow-query' /etc/bind/named.conf.options || :"
+ shell: "grep -c '^[ \\t]\\+allow-query' /etc/bind/named.conf.options || echo 0"
register: named_conf
changed_when: named_conf.stdout == "0"
- name: "Run role {{ role }}"
hosts: "{{ hosts | default('all') }}"
- gather_facts: false
+ gather_facts: "{{ gather_facts | default('false') }}"
roles:
- "{{ role }}"