---
- name: create a directory to store post scripts for controller nodes
  file:
    path: "{{working_dir}}/{{ node_name | splitext | first }}_post"
    state: directory

- name: create post scripts for {{ node_name }}
  template:
    src: "check_service_{{ item }}.sh.j2"
    dest: "{{working_dir}}/{{ node_name | splitext | first }}_post/{{ item }}.sh"
    mode: 0775
  with_items:
    - 'haproxy'
    - 'haproxy_backend'
    - 'rabbitmq'
    - 'redis'
