main.yml 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. ---
  2. - name: setup firewall
  3. import_tasks: firewall.yml
  4. - name: Install haproxy
  5. package:
  6. name: haproxy
  7. state: present
  8. register: result
  9. until: result is succeeded
  10. - name: Configure systemd service directory for haproxy
  11. file:
  12. path: /etc/systemd/system/haproxy.service.d
  13. state: directory
  14. # Work around ini_file create option in 2.2 which defaults to no
  15. - name: Create limits.conf file
  16. file:
  17. dest: /etc/systemd/system/haproxy.service.d/limits.conf
  18. state: touch
  19. mode: 0660
  20. owner: root
  21. group: root
  22. changed_when: false
  23. - name: Configure the nofile limits for haproxy
  24. ini_file:
  25. dest: /etc/systemd/system/haproxy.service.d/limits.conf
  26. section: Service
  27. option: LimitNOFILE
  28. value: "{{ openshift_loadbalancer_limit_nofile | default(100000) }}"
  29. notify: restart haproxy
  30. - name: Configure haproxy
  31. template:
  32. src: haproxy.cfg.j2
  33. dest: /etc/haproxy/haproxy.cfg
  34. owner: root
  35. group: root
  36. mode: 0644
  37. notify: restart haproxy
  38. - name: Enable and start haproxy
  39. systemd:
  40. name: haproxy
  41. state: started
  42. enabled: yes
  43. daemon_reload: yes
  44. register: start_result
  45. - set_fact:
  46. haproxy_start_result_changed: "{{ start_result is changed }}"