mirror of
https://github.com/geerlingguy/ansible-role-apache
synced 2025-01-10 11:50:18 +01:00
Merge pull request #74 from tgerla/varsfixes
use inventory_hostname instead of ansible_hostname
This commit is contained in:
commit
deab84fa0a
3 changed files with 7 additions and 7 deletions
|
@ -35,5 +35,5 @@ backend app
|
|||
{% endfor %}
|
||||
balance {{ balance }}
|
||||
{% for host in groups['webservers'] %}
|
||||
server {{ hostvars[host].ansible_hostname }} {{ hostvars[host]['ansible_' + iface].ipv4.address }}:{{ httpd_port }}
|
||||
server {{ host }} {{ hostvars[host]['ansible_' + iface].ipv4.address }}:{{ httpd_port }}
|
||||
{% endfor %}
|
||||
|
|
|
@ -18,12 +18,12 @@
|
|||
# These are the tasks to run before applying updates:
|
||||
pre_tasks:
|
||||
- name: disable nagios alerts for this host webserver service
|
||||
nagios: action=disable_alerts host={{ ansible_hostname }} services=webserver
|
||||
nagios: action=disable_alerts host={{ inventory_hostname }} services=webserver
|
||||
delegate_to: "{{ item }}"
|
||||
with_items: groups.monitoring
|
||||
|
||||
- name: disable the server in haproxy
|
||||
shell: echo "disable server myapplb/{{ ansible_hostname }}" | socat stdio /var/lib/haproxy/stats
|
||||
shell: echo "disable server myapplb/{{ inventory_hostname }}" | socat stdio /var/lib/haproxy/stats
|
||||
delegate_to: "{{ item }}"
|
||||
with_items: groups.lbservers
|
||||
|
||||
|
@ -38,11 +38,11 @@
|
|||
wait_for: host={{ inventory_hostname }} port=80 state=started timeout=80
|
||||
|
||||
- name: Enable the server in haproxy
|
||||
shell: echo "enable server myapplb/{{ ansible_hostname }}" | socat stdio /var/lib/haproxy/stats
|
||||
shell: echo "enable server myapplb/{{ inventory_hostname }}" | socat stdio /var/lib/haproxy/stats
|
||||
delegate_to: "{{ item }}"
|
||||
with_items: groups.lbservers
|
||||
|
||||
- name: re-enable nagios alerts
|
||||
nagios: action=enable_alerts host={{ ansible_hostname }} services=webserver
|
||||
nagios: action=enable_alerts host={{ inventory_hostname }} services=webserver
|
||||
delegate_to: "{{ item }}"
|
||||
with_items: groups.monitoring
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
- c
|
||||
|
||||
tasks:
|
||||
- shell: echo hello {{ ansible_hostname.upper() }}
|
||||
- debug: msg="hello {{ ansible_hostname.upper() }}"
|
||||
|
||||
- shell: echo match
|
||||
when: 2 == 2
|
||||
|
@ -19,7 +19,7 @@
|
|||
- shell: echo no match
|
||||
when: 2 == 2 + 1
|
||||
|
||||
- shell: echo {{ ansible_os_family }}
|
||||
- debug: msg="{{ ansible_os_family }}"
|
||||
|
||||
- shell: echo {{ item }}
|
||||
with_items: a_list
|
||||
|
|
Loading…
Reference in a new issue