2025-03-15 22:49:13 +01:00
|
|
|
---
|
|
|
|
|
- name: Mail Playbook (K8s)
|
|
|
|
|
hosts: mail
|
|
|
|
|
gather_facts: true
|
|
|
|
|
|
|
|
|
|
# Specific tasks for this playbook
|
|
|
|
|
tasks:
|
|
|
|
|
- name: Set required facts
|
|
|
|
|
ansible.builtin.set_fact:
|
|
|
|
|
mail_home: "{{ persistent_data | default('/var/lib') }}/mail"
|
|
|
|
|
mail_user_id: 1000
|
|
|
|
|
mail_group_id: 1000
|
2025-03-16 19:37:44 +01:00
|
|
|
postfix_user_id: 100
|
|
|
|
|
postfix_group_id: 101
|
2025-03-15 22:49:13 +01:00
|
|
|
tags: always
|
|
|
|
|
|
|
|
|
|
- name: Set required facts
|
|
|
|
|
ansible.builtin.set_fact:
|
2025-05-02 14:24:08 +02:00
|
|
|
mail_folders:
|
2025-03-15 22:49:13 +01:00
|
|
|
- "{{ mail_home }}/getmail"
|
|
|
|
|
- "{{ mail_home }}/mailboxes"
|
|
|
|
|
tags: always
|
|
|
|
|
|
|
|
|
|
- name: Create required mail home folder
|
|
|
|
|
become: true
|
|
|
|
|
ansible.builtin.file:
|
|
|
|
|
state: directory
|
|
|
|
|
path: "{{ mail_home }}"
|
|
|
|
|
mode: "0750"
|
|
|
|
|
owner: "{{ mail_user_id }}"
|
|
|
|
|
group: "{{ mail_group_id }}"
|
|
|
|
|
tags:
|
|
|
|
|
- tasks
|
|
|
|
|
- tasks::folders
|
|
|
|
|
|
|
|
|
|
- name: Create required mail folders
|
|
|
|
|
become: true
|
|
|
|
|
ansible.builtin.file:
|
|
|
|
|
state: directory
|
|
|
|
|
path: "{{ item }}"
|
|
|
|
|
mode: "0750"
|
|
|
|
|
owner: "{{ mail_user_id }}"
|
|
|
|
|
group: "{{ mail_group_id }}"
|
|
|
|
|
loop: "{{ mail_folders }}"
|
|
|
|
|
tags:
|
|
|
|
|
- tasks
|
|
|
|
|
- tasks::folders
|
2025-03-16 19:37:44 +01:00
|
|
|
|
|
|
|
|
- name: Create required postfix folders
|
|
|
|
|
become: true
|
|
|
|
|
ansible.builtin.file:
|
|
|
|
|
state: directory
|
|
|
|
|
path: "{{ item }}"
|
|
|
|
|
mode: "0750"
|
|
|
|
|
owner: "{{ postfix_user_id }}"
|
|
|
|
|
group: "{{ postfix_group_id }}"
|
2025-05-02 14:24:08 +02:00
|
|
|
loop:
|
2025-03-16 19:37:44 +01:00
|
|
|
- "{{ mail_home }}/postfix"
|
|
|
|
|
tags:
|
|
|
|
|
- tasks
|
|
|
|
|
- tasks::folders
|