ansible-role-apache/lamp_haproxy/rolling_update.yml

46 lines
1.4 KiB
YAML
Raw Normal View History

2013-03-12 17:35:25 +01:00
---
# This playbook does a rolling update for all webservers serially (one at a time).
# Change the value of serial: to adjust the number of server to be updated.
#
# The three roles that apply to the webserver hosts will be applied: common,
# base-apache, and web. So any changes to configuration, package updates, etc,
# will be applied as part of the rolling update process.
#
# gather facts from monitoring nodes for iptables rules
- hosts: monitoring
tasks:
2013-03-12 17:35:25 +01:00
- hosts: webservers
user: root
serial: 1
# These are the tasks to run before applying updates:
pre_tasks:
2013-04-17 04:41:43 +02:00
- name: disable nagios alerts for this host webserver service
nagios: action=disable_alerts host=$ansible_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
delegate_to: $item
with_items: ${groups.lbservers}
roles:
- common
- base-apache
- web
# These tasks run after the roles:
post_tasks:
- name: Enable the server in haproxy
shell: echo "enable server myapplb/${ansible_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
delegate_to: $item
with_items: ${groups.monitoring}