main.yml 1.3 KB

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