Browse Source

move service task and handler to a separate role (see ansible issue 23389, 20603, 15902)

Resolves #13
python3
Andrea Cimbalo 7 years ago
parent
commit
16db54b0e2
23 changed files with 27 additions and 77 deletions
  1. +0
    -5
      roles/apache2/handlers/main.yaml
  2. +2
    -1
      roles/apache2/tasks/main.yaml
  3. +0
    -8
      roles/dovecot/handlers/main.yml
  4. +2
    -1
      roles/dovecot/tasks/main.yaml
  5. +0
    -4
      roles/exim4/handlers/main.yml
  6. +2
    -1
      roles/exim4/tasks/main.yaml
  7. +0
    -5
      roles/fail2ban/handlers/main.yaml
  8. +2
    -1
      roles/fail2ban/tasks/main.yaml
  9. +0
    -4
      roles/ldap/handlers/main.yaml
  10. +2
    -1
      roles/ldap/tasks/main.yaml
  11. +0
    -4
      roles/mysql/handlers/main.yaml
  12. +2
    -1
      roles/mysql/tasks/main.yaml
  13. +0
    -7
      roles/nginx/handlers/main.yaml
  14. +2
    -1
      roles/nginx/tasks/main.yaml
  15. +0
    -4
      roles/pam-ldap/handlers/main.yaml
  16. +0
    -13
      roles/postfix/handlers/main.yml
  17. +6
    -3
      roles/postfix/tasks/antispam.yaml
  18. +3
    -2
      roles/postfix/tasks/main.yaml
  19. +0
    -4
      roles/postgresql/handlers/main.yaml
  20. +2
    -1
      roles/postgresql/tasks/main.yaml
  21. +0
    -0
      roles/service/handlers/main.yaml
  22. +0
    -0
      roles/service/tasks/main.yaml
  23. +2
    -6
      roles/ssh_server/handlers/main.yaml

+ 0
- 5
roles/apache2/handlers/main.yaml View File

@ -1,5 +0,0 @@
---
- include: service.yaml
# static: yes # see static include issue: https://github.com/ansible/ansible/issues/13485
vars:
service_name: apache2

+ 2
- 1
roles/apache2/tasks/main.yaml View File

@ -1,5 +1,6 @@
---
- include: service.yaml
- include_role:
name: service
# static: yes # see static include issue: https://github.com/ansible/ansible/issues/13485
vars:
service_name: apache2


+ 0
- 8
roles/dovecot/handlers/main.yml View File

@ -1,8 +0,0 @@
---
- include: service.yaml
vars:
service_name: postfix
- include: service.yaml
vars:
service_name: dovecot

+ 2
- 1
roles/dovecot/tasks/main.yaml View File

@ -1,4 +1,5 @@
- include: service.yaml
- include_role:
name: service
# static: yes # see static include issue: https://github.com/ansible/ansible/issues/13485
vars:
service_name: dovecot


+ 0
- 4
roles/exim4/handlers/main.yml View File

@ -5,7 +5,3 @@
- name: update-exim4.conf
shell: /usr/sbin/update-exim4.conf
notify: restart exim4
- include: service.yaml
vars:
service_name: exim4

+ 2
- 1
roles/exim4/tasks/main.yaml View File

@ -53,7 +53,8 @@
- restart exim4
- block:
- include: service.yaml
- include_role:
name: service
# static: yes # see static include issue: https://github.com/ansible/ansible/issues/13485
vars:
service_name: exim4


+ 0
- 5
roles/fail2ban/handlers/main.yaml View File

@ -1,5 +0,0 @@
---
- include: service.yaml
# static: yes # see static include issue: https://github.com/ansible/ansible/issues/13485
vars:
service_name: fail2ban

+ 2
- 1
roles/fail2ban/tasks/main.yaml View File

@ -1,5 +1,6 @@
---
- include: service.yaml
- include_role:
name: service
# static: yes # see static include issue: https://github.com/ansible/ansible/issues/13485
vars:
service_name: fail2ban


+ 0
- 4
roles/ldap/handlers/main.yaml View File

@ -1,4 +0,0 @@
---
- include: service.yaml
vars:
service_name: slapd

+ 2
- 1
roles/ldap/tasks/main.yaml View File

@ -37,7 +37,8 @@
question: 'phamm-ldap/init_base_ldap'
vtype: 'boolean'
value: false
- include: service.yaml
- include_role:
name: service
vars:
service_name: slapd
service_packages:


+ 0
- 4
roles/mysql/handlers/main.yaml View File

@ -1,4 +0,0 @@
---
- include: service.yaml
vars:
service_name: mysql

+ 2
- 1
roles/mysql/tasks/main.yaml View File

@ -1,5 +1,6 @@
---
- include: service.yaml
- include_role:
name: service
vars:
service_name: mysql
service_packages:


+ 0
- 7
roles/nginx/handlers/main.yaml View File

@ -1,11 +1,4 @@
---
- include: service.yaml
# static: yes # see static include issue: https://github.com/ansible/ansible/issues/13485
vars:
service_name: nginx
service_packages:
- nginx
- name: validate nginx configuration
command: nginx -t -c /etc/nginx/nginx.conf
changed_when: False

+ 2
- 1
roles/nginx/tasks/main.yaml View File

@ -1,5 +1,6 @@
---
- include: service.yaml
- include_role:
name: service
# static: yes # see static include issue: https://github.com/ansible/ansible/issues/13485
vars:
service_name: nginx


+ 0
- 4
roles/pam-ldap/handlers/main.yaml View File

@ -8,7 +8,3 @@
- name: update libnss-ldap configuration
shell: rm /etc/libnss_ldap.conf || true; dpkg-reconfigure libnss-ldap -f noninteractive
notify: restart nscd
- include: service.yaml
vars:
service_name: nscd

+ 0
- 13
roles/postfix/handlers/main.yml View File

@ -1,13 +0,0 @@
---
- include: service.yaml
vars:
service_name: postfix
- include: service.yaml
vars:
service_name: clamav-daemon
- include: service.yaml
vars:
service_name: amavisd-milter

+ 6
- 3
roles/postfix/tasks/antispam.yaml View File

@ -1,11 +1,13 @@
- include: service.yaml
- include_role:
name: service
vars:
service_name: clamav-daemon
service_packages:
- clamav-daemon
install_recommends: yes
- include: service.yaml
- include_role:
name: service
vars:
service_name: amavisd-milter
service_packages:
@ -41,7 +43,8 @@
regexp: '^non_smtpd_milters='
notify: restart postfix
- include: service.yaml
- include_role:
name: service
vars:
service_name: postgrey
service_packages:


+ 3
- 2
roles/postfix/tasks/main.yaml View File

@ -11,7 +11,8 @@
vtype: 'string'
value: 'lilik.it'
- include: service.yaml
- include_role:
name: service
vars:
service_name: postfix
service_packages:
@ -20,7 +21,7 @@
# TODO: log, add a centralized log server
- rsyslog
- name: configure ldap-aliases for postfix
- name: configure ldap-aliases for postfix
template:
src: ldap-aliases.cf.j2
dest: "/etc/postfix/ldap-aliases.cf"


+ 0
- 4
roles/postgresql/handlers/main.yaml View File

@ -1,4 +0,0 @@
---
- include: service.yaml
vars:
service_name: postgresql

+ 2
- 1
roles/postgresql/tasks/main.yaml View File

@ -1,6 +1,7 @@
---
# include tasks from task/service.yaml
- include: service.yaml
- include_role:
name: service
vars:
service_name: postgresql
service_packages:


handlers/service.yaml → roles/service/handlers/main.yaml View File


tasks/service.yaml → roles/service/tasks/main.yaml View File


+ 2
- 6
roles/ssh_server/handlers/main.yaml View File

@ -1,8 +1,4 @@
---
- include: service.yaml
# static: yes # see static include issue: https://github.com/ansible/ansible/issues/13485
# We can not use include_role here since it not share thje connection with the current role
- include: roles/service/handlers/main.yaml
vars:
service_name: ssh
service_packages:
- openssh

Loading…
Cancel
Save