115 lines
2.2 KiB
YAML
115 lines
2.2 KiB
YAML
---
|
|
- include_vars: msmtp-as-sendmail.yml
|
|
|
|
- name: install msmtp
|
|
package:
|
|
name: "{{ msmtp_package }}"
|
|
state: present
|
|
become: true
|
|
tags:
|
|
- installation
|
|
|
|
- name: create systemwide msmtp config
|
|
template:
|
|
dest: "{{ msmtprc }}"
|
|
src: "../mutt/templates/msmtprc.j2"
|
|
become: true
|
|
tags:
|
|
- configuration
|
|
|
|
- name: "set msmtp as mta"
|
|
lineinfile:
|
|
path: "{{ mailrc | default(/etc/mail.rc) }}"
|
|
regexp: "^{{ item.name }}"
|
|
line: "{{ item.name }}={{ item.val }}"
|
|
become: true
|
|
loop: "{{ sysctl_setting }}"
|
|
tags:
|
|
- configuration
|
|
vars:
|
|
sysctl_setting:
|
|
- name: "set mta"
|
|
val: "{{ msmtp_path }}"
|
|
|
|
- name: "set an adress for root"
|
|
lineinfile:
|
|
path: "{{ aliases | default(/etc/aliases) }}"
|
|
regexp: "^{{ item.name }}"
|
|
line: "{{ item.name }}: {{ item.val }}"
|
|
become: true
|
|
loop: "{{ sysctl_setting }}"
|
|
tags:
|
|
- configuration
|
|
vars:
|
|
sysctl_setting:
|
|
- name: "root"
|
|
val: "{{ root_mail }}"
|
|
- name: "default"
|
|
val: "root"
|
|
when: root_mail is defined
|
|
notify: new aliases
|
|
|
|
|
|
|
|
|
|
|
|
- name: "enable local_unbound"
|
|
lineinfile:
|
|
path: "/etc/rc.conf"
|
|
regexp: "^{{ item.name }}"
|
|
line: "{{ item.name }}={{ item.val }}"
|
|
become: true
|
|
loop: "{{ sysctl_setting }}"
|
|
tags:
|
|
- configuration
|
|
vars:
|
|
sysctl_setting:
|
|
- name: "local_unbound_enable"
|
|
val: "YES"
|
|
|
|
- name: "get opennic hints"
|
|
shell: "{{ hints_opennic_cmd }}"
|
|
become: true
|
|
tags:
|
|
- installation
|
|
- configuration
|
|
|
|
- name: "get named hints"
|
|
get_url:
|
|
url: "{{ hints_named_url }}"
|
|
dest: "{{ hints_named }}"
|
|
become: true
|
|
tags:
|
|
- installation
|
|
- configuration
|
|
|
|
- name: manage resolv.conf
|
|
template:
|
|
dest: /etc/resolv.conf
|
|
src: templates/resolv.conf.j2
|
|
become: true
|
|
tags:
|
|
- configuration
|
|
|
|
- name: "generate configs"
|
|
template:
|
|
src: "{{ config.src }}"
|
|
dest: "{{ config.dest }}"
|
|
become: true
|
|
loop: "{{ local_unbound_files }}"
|
|
loop_control:
|
|
loop_var: config
|
|
tags:
|
|
- configuration
|
|
notify: "restart local_unbound"
|
|
|
|
- name: "start local_unbound"
|
|
service:
|
|
name: "local_unbound"
|
|
state: started
|
|
become: true
|
|
tags:
|
|
- service
|
|
- configuration
|
|
|
|
|