diff --git a/roles/msmtp/tasks/dispatcher.yml b/roles/msmtp/tasks/dispatcher.yml new file mode 100644 index 0000000..51e4ee8 --- /dev/null +++ b/roles/msmtp/tasks/dispatcher.yml @@ -0,0 +1,23 @@ +--- + - name: Gather instance facts + setup: + - block: + - name: Generate msmtp configuration file + template: + src: msmtprc + dest: "/opt/misc/msmtprc" + owner: root + group: root + mode: 0644 + tags: + - msmtp-config + - name: Generate aliases configuration file + template: + src: aliases + dest: "/opt/misc/aliases" + owner: root + group: root + mode: 0644 + tags: + - msmtp-config + \ No newline at end of file diff --git a/roles/msmtp/tasks/frame.yml b/roles/msmtp/tasks/frame.yml new file mode 100644 index 0000000..a8d220a --- /dev/null +++ b/roles/msmtp/tasks/frame.yml @@ -0,0 +1,41 @@ +--- + - name: Gather instance facts + setup: + - name: Update APT package cache + apt: + update_cache: "true" + cache_valid_time: "3600" + tags: + - msmtp-install + - name: Install msmtp + package: + name: "{{ packages }}" + state: present + vars: + packages: + - msmtp + - msmtp-mta + - ca-certificates + tags: + - msmtp-install + + - block: + - name: Generate msmtp configuration file + template: + src: msmtprc + dest: "/etc/msmtprc" + owner: root + group: root + mode: 0644 + tags: + - msmtp-config + - name: Generate aliases configuration file + template: + src: aliases + dest: "/etc/aliases" + owner: root + group: root + mode: 0644 + tags: + - msmtp-config + \ No newline at end of file diff --git a/roles/msmtp/tasks/main.yml b/roles/msmtp/tasks/main.yml index 29598dc..d9c2aa7 100644 --- a/roles/msmtp/tasks/main.yml +++ b/roles/msmtp/tasks/main.yml @@ -1,40 +1,5 @@ --- - - name: Gather instance facts - setup: - - name: Update APT package cache - apt: - update_cache: "true" - cache_valid_time: "3600" - tags: - - msmtp-install - - name: Install msmtp - package: - name: "{{ packages }}" - state: present - vars: - packages: - - msmtp - - msmtp-mta - - ca-certificates - tags: - - msmtp-install - - - block: - - name: Generate msmtp configuration file - template: - src: msmtprc - dest: "/etc/msmtprc" - owner: root - group: root - mode: 0644 - tags: - - msmtp-config - - name: Generate aliases configuration file - template: - src: aliases - dest: "/etc/aliases" - owner: root - group: root - mode: 0644 - tags: - - msmtp-config + - include_tasks: "frame.yml" + when: not msmtp_containerized + - include_tasks: "dispatcher.yml" + when: msmtp_containerized