make it possible to disable inclusions and split out mailer role

This commit is contained in:
Farhad Shahbazi
2016-11-24 16:36:45 +01:00
parent 3ed4105c79
commit 75fcfd3a0e
4 changed files with 30 additions and 20 deletions

View File

@@ -1,4 +1,5 @@
---
common_apt: True
common_apt_keys: []
common_apt_repositories:
- "deb http://cdn.debian.net/debian {{ ansible_distribution_release }} main contrib non-free"
@@ -12,10 +13,14 @@ common_hostname_hosts_additional: []
common_locales: []
common_locales_default:
common_ntp: True
common_resolvconf: True
common_resolvconf_hnfqdn: true
common_resolvconf_nameservers: []
common_resolvconf_domain: ""
common_resolvconf_search: []
common_rsyslog: True
common_rsyslog_forwards: []
common_basic_packages:
@@ -42,6 +47,8 @@ common_basic_packages:
common_scripts:
- { dest: "/usr/local/bin/zombies", src: "scripts/zombies" }
common_openssh: True
common_openssh_keys_root: []
common_aliases:
@@ -58,7 +65,8 @@ common_aliases:
- "noc: root"
- "security: root"
common_mailer: "postfix"
common_mailer: True
common_mailer_mailer: "postfix"
common_mailname: "{{ ansible_fqdn }}"
common_postfix_debug_peer_list: ""

View File

@@ -16,10 +16,10 @@
service: name=resolvconf state=restarted
- name: reload mailer
service: name="{{ common_mailer }}" state=reloaded
service: name="{{ common_mailer_mailer }}" state=reloaded
- name: restart mailer
service: name="{{ common_mailer }}" state=restarted
service: name="{{ common_mailer_mailer }}" state=restarted
- name: newaliases
command: newaliases

13
tasks/mailer.yml Normal file
View File

@@ -0,0 +1,13 @@
---
- name: /etc/mailname
copy: dest=/etc/mailname content="{{ common_mailname }}\n" owner=root group=root mode=0644
notify: restart mailer
- name: /etc/aliases
template: dest=/etc/aliases src=aliases.j2 owner=root group=root mode=0644
notify:
- newaliases
- restart mailer
- include: "{{ common_mailer_mailer }}.yml"
when: common_mailer_mailer != False

View File

@@ -1,6 +1,6 @@
---
- include: resolvconf.yml
when: common_resolvconf
tags: ['common', 'resolvconf']
- include: hostname.yml
@@ -8,6 +8,7 @@
tags: ['common', 'hostname']
- include: apt.yml
when: common_apt
tags: ['common', 'apt']
- include: locales.yml
@@ -24,30 +25,18 @@
with_items: "{{ common_scripts }}"
tags: common
- name: /etc/mailname
copy: dest=/etc/mailname content="{{ common_mailname }}\n" owner=root group=root mode=0644
notify: restart mailer
when: common_mailer != False
tags: ['common', 'mailer']
- name: /etc/aliases
template: dest=/etc/aliases src=aliases.j2 owner=root group=root mode=0644
notify:
- newaliases
- restart mailer
when: common_mailer != False
- include: mailer.yml
when: common_mailer
tags: ['common', 'mailer']
- include: ntp.yml
when: common_ntp
tags: ['common', 'ntp']
- include: openssh.yml
when: common_openssh
tags: ['common', 'openssh']
- include: rsyslog.yml
when: common_rsyslog
tags: ['common', 'rsyslog']
- include: "{{ common_mailer }}.yml"
when: common_mailer != False
tags: ['common', 'mailer']