--- # This Playbook implements a rolling update on the infrastructure, change the value of the serial keyword to specify the number of servers the update should happen. - name: Remove the code from server command: rm -rf /var/www/html/* - name: disable nagios alerts for this host's 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} - name: Copy the code from repository git: repo=${repository} dest=/var/www/html/ - name: Create's the index.php file template: src=index.php.j2 dest=/var/www/html/index.php - 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}