You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
545 B
15 lines
545 B
---
|
|
# This Playbook does utility stuff's like adding a webserver into the pool, etc..
|
|
|
|
- name: Add server to LB
|
|
lineinfile: dest=/etc/haproxy/haproxy.cfg state=present regexp="${ansible_hostname}" line="server ${ansible_hostname} ${hostvars.{$inventory_hostname}.ansible_$iface.ipv4.address}:${httpd_port}"
|
|
delegate_to: $item
|
|
with_items: ${groups.lbservers}
|
|
register: last_run
|
|
|
|
- name: Reload the haproxy
|
|
service: name=haproxy state=reloaded
|
|
delegate_to: $item
|
|
with_items: ${groups.lbservers}
|
|
only_if: ${last_run.changed}
|
|
|
|
|