Skip to content
Snippets Groups Projects
main.yml 494 B
Newer Older
  • Learn to ignore specific revisions
  • jurgenhaas's avatar
    jurgenhaas committed
    ---
    # file: roles/haproxy/handler/main.yml
    
    
    - name: "Check HAProxy Config"
      command: haproxy -c -f /etc/haproxy/haproxy.cfg
      register: haproxy_config_check
      changed_when: '"Configuration file is valid" in haproxy_config_check.stdout_lines'
      failed_when: '"Configuration file is valid" not in haproxy_config_check.stdout_lines'
      notify: "Restart HAProxy"
    
    - name: "Restart HAProxy"
    
    jurgenhaas's avatar
    jurgenhaas committed
      service: name={{item.name}} state={{item.state}}
      with_items:
        - name: haproxy
          state: restarted