123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- ---
- - name: make sure required software is installed
- hosts: all
- become: yes
- gather_facts: no
- tasks:
- - name: ensure the software is there
- yum:
- name: "{{ packages }}"
- state: latest
- - name: deploy corresponding dns service and configuration
- hosts: dnsservers,caching_ns
- become: yes
- gather_facts: no
- tasks:
- - name: process any templates and publish them
- template:
- src: "{{ item.src }}"
- dest: "{{ item.dest }}"
- owner: "{{ item.owner }}"
- group: "{{ item.group }}"
- mode: "{{ item.mode }}"
- notify:
- - test configuration validity
- - restart the service
- loop: "{{ configs }}"
- when: configs is defined
- - name: deploy the static files as well
- copy:
- src: "{{ item.src }}"
- dest: "{{ item.dest }}"
- owner: "{{ item.owner }}"
- group: "{{ item.group }}"
- mode: "{{ item.mode }}"
- notify: them handlerz
- loop: "{{ staticfiles }}"
- when: staticfiles is defined
- - name: execute handlers if necessary
- meta: flush_handlers
- - name: ensure the service is started and enabled to start automatically
- service:
- name: "{{ service }}"
- state: started
- enabled: yes
- - name: ensure firewall is open for the service
- firewalld:
- service: "{{ fwsvc }}"
- state: enabled
- immediate: yes
- permanent: yes
- handlers:
- - name: test configuration validity
- listen: them handlerz
- command: "{{ item }}"
- changed_when: false
- loop: "{{ test_programs }}"
- - name: restart the service
- listen: them handlerz
- service:
- name: "{{ service }}"
- state: restarted
|