๐Ÿ“— Ansible playbooks and roles for building an idempotent, interconnected and scalable infrastructure
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
ansible-playbooks/roles/mta-sts/tasks/main.yml

85 lines
1.6 KiB

- name: set mta_sts_cfg
set_fact:
mta_sts_cfg: "{{ mta_sts_default_config | d({}) | combine(mta_sts_config | d({}), recursive=true) }}"
- name: install pip3 and dependencies
include_tasks: tasks/install_packages.yml
vars:
package:
- gcc
- python3-dev
- musl-dev
- py3-pip
- py3-aiohttp
- py3-frozenlist
- py3-multidict
- py3-yaml
notify: restart mta-sts
- name: install mta-sts-resolver from pip
pip:
name: postfix-mta-sts-resolver
extra_args: "--no-cache-dir"
notify: restart mta-sts
- name: create user and group
include_tasks: tasks/create_user.yml
vars:
user:
name: "{{ mta_sts_user }}"
group: "{{ mta_sts_group }}"
dir: "{{ mta_sts_conf_dir }}"
create_home: no
- name: create config dir
file:
path: "{{ mta_sts_conf_dir }}"
state: directory
mode: 0700
owner: "{{ mta_sts_user }}"
group: "{{ mta_sts_group }}"
- name: template mta-sts config
template:
src: config.j2
dest: "{{ mta_sts_conf_file }}"
force: yes
mode: 0600
owner: "{{ mta_sts_user }}"
group: "{{ mta_sts_group }}"
lstrip_blocks: no
notify: restart mta-sts
- name: template init script
template:
src: init.j2
dest: /etc/init.d/mta-sts
force: yes
mode: "+x"
notify: restart mta-sts
- name: flush handlers
meta: flush_handlers
- name: add directories to backup plan
include_role:
name: backup
vars:
function: add
backup_items:
- "{{ mta_sts_conf_dir }}"
- name: enable and start mta-sts
service:
name: mta-sts
enabled: yes
state: started