diff --git a/defaults/main.yml b/defaults/main.yml index 81e8029..2ba12d5 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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: "" diff --git a/handlers/main.yml b/handlers/main.yml index b6ee1a9..07f4e20 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -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 diff --git a/tasks/mailer.yml b/tasks/mailer.yml new file mode 100644 index 0000000..23b168b --- /dev/null +++ b/tasks/mailer.yml @@ -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 diff --git a/tasks/main.yml b/tasks/main.yml index 120ae4b..6ea0119 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -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']