deploy_varnish.yml 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. ---
  2. - name: Ensure Varnish is deployed
  3. hosts: web_servers
  4. gather_facts: false
  5. become: true
  6. tasks:
  7. - name: the varnish package is installed
  8. yum:
  9. name: varnish
  10. state: present
  11. - name: the systemd drop-in directory exists
  12. file:
  13. path: /etc/systemd/system/varnish.service.d
  14. state: directory
  15. - name: the varnish systemd service configuration file is deployed
  16. copy:
  17. src: files/port.conf
  18. dest: /etc/systemd/system/varnish.service.d/port.conf
  19. notify:
  20. - reload systemd
  21. - restart varnish
  22. - name: the varnish service is started and enabled
  23. service:
  24. name: varnish
  25. state: started
  26. enabled: yes
  27. - name: the port 6081 is opened in the firewall
  28. firewalld:
  29. port: 6081/tcp
  30. state: enabled
  31. immediate: yes
  32. permanent: yes
  33. handlers:
  34. - name: reload systemd
  35. systemd:
  36. daemon_reload: yes
  37. - name: restart varnish
  38. service:
  39. name: varnish
  40. state: restarted