Преглед изворни кода

Use only "inventory_hostname"

Sven Velt пре 7 година
родитељ
комит
0cf850beb2

+ 1 - 1
roles/web_lb/templates/haproxy.cfg.j2

@@ -46,7 +46,7 @@ backend		nodes
 	option		httpchk HEAD / HTTP/1.1\r\nHost:localhost
 	#server		worker_01 172.22.244.81:80 check
 	{% for host in groups['worker'] %}
-	  server  {{ hostvars[host]['ansible_hostname'] }}  {{ hostvars[host]['ansible_default_ipv4'].address }}:80 check
+	  server  {{ hostvars[host]['inventory_hostname'] }}  {{ hostvars[host]['ansible_default_ipv4'].address }}:80 check
 	{% endfor %}
 
 listen stats

+ 3 - 3
roles/web_worker/templates/etc/apache2/sites-available/worker.conf.j2

@@ -1,11 +1,11 @@
 <VirtualHost *:80>
-	ServerName	{{ ansible_hostname }}
+	ServerName	{{ inventory_hostname }}
 	DocumentRoot	/var/www/worker
 
 	ProxyPassMatch	^/(.*\.php(/.*)?)$	fcgi://127.0.0.1:4001/var/www/worker/$1
 
 	DirectoryIndex	index.php index.xhtml index.html
 
-	ErrorLog	${APACHE_LOG_DIR}/worker_{{ ansible_hostname }}.error.log
-	CustomLog	${APACHE_LOG_DIR}/worker_{{ ansible_hostname }}.access.log combined
+	ErrorLog	${APACHE_LOG_DIR}/worker_{{ inventory_hostname }}.error.log
+	CustomLog	${APACHE_LOG_DIR}/worker_{{ inventory_hostname }}.access.log combined
 </VirtualHost>

+ 1 - 1
roles/web_worker/templates/var/www/worker/index.html.j2

@@ -1 +1 @@
-<h1>{{ ansible_hostname }}</h1>
+<h1>{{ inventory_hostname }}</h1>