| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- ---
- - name: Ensure Varnish is deployed
- hosts: web_servers
- gather_facts: false
- become: true
- tasks:
- - name: the varnish package is installed
- yum:
- name: varnish
- state: present
- - name: the systemd drop-in directory exists
- file:
- path: /etc/systemd/system/varnish.service.d
- state: directory
- - name: the varnish systemd service configuration file is deployed
- copy:
- src: files/port.conf
- dest: /etc/systemd/system/varnish.service.d/port.conf
- notify:
- - reload systemd
- - restart varnish
- - name: the varnish service is started and enabled
- service:
- name: varnish
- state: started
- enabled: yes
- - name: the port 6081 is opened in the firewall
- firewalld:
- port: 6081/tcp
- state: enabled
- immediate: yes
- permanent: yes
- handlers:
- - name: reload systemd
- systemd:
- daemon_reload: yes
- - name: restart varnish
- service:
- name: varnish
- state: restarted
|