summaryrefslogtreecommitdiff
path: root/ansible
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2019-08-01 13:32:01 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2019-08-08 09:03:13 +0200
commit8070c0cf9aa181f98d52407f053b941f08c16613 (patch)
treed89ef7c20977964fc6be01b2d29e033e1c5a4e6e /ansible
parentfe4b8b3a499270df23b1ac3f0d8ec17e22f055ae (diff)
downloadinfra-8070c0cf9aa181f98d52407f053b941f08c16613.tar.gz
infra-8070c0cf9aa181f98d52407f053b941f08c16613.tar.bz2
infra-8070c0cf9aa181f98d52407f053b941f08c16613.tar.xz
infra-8070c0cf9aa181f98d52407f053b941f08c16613.zip
postfix-satellite:
o Removing keys default_transport and relay_transport. o Moving postfix-satellite to its own file.
Diffstat (limited to 'ansible')
-rw-r--r--ansible/all.yml21
-rw-r--r--ansible/plays/postfix-satellite.yml19
-rw-r--r--ansible/roles/postfix-satellite/tasks/postfix-satellite.yml14
3 files changed, 32 insertions, 22 deletions
diff --git a/ansible/all.yml b/ansible/all.yml
index 02b78ae..05502bf 100644
--- a/ansible/all.yml
+++ b/ansible/all.yml
@@ -21,26 +21,6 @@
- bind
- hosts:
- - all !knot
- roles:
- - postfix-satellite
- vars:
- username: "{{ ansible_hostname }}.trygvis.io"
- postfix:
- sasl_password:
- - host: "[trygvis.io]:587"
- username: "{{ username }}"
- password: "{{ dovecot__passwords[username] }}"
-
- tasks:
- - tags: postfix-satellite
- become: yes
- lineinfile:
- dest: /etc/postfix/sasl_passwd
- state: absent
- regex: "^\\[knot.trygvis.io\\]"
-
-- hosts:
- linode-dns-update
roles:
- linode-dns-update
@@ -52,6 +32,7 @@
tags: systemd-networkd
become: yes
+- import_playbook: plays/postfix-satellite.yml
- import_playbook: nftables.yml
- import_playbook: lxc-host.yml
- import_playbook: wireguard.yml
diff --git a/ansible/plays/postfix-satellite.yml b/ansible/plays/postfix-satellite.yml
new file mode 100644
index 0000000..af77d17
--- /dev/null
+++ b/ansible/plays/postfix-satellite.yml
@@ -0,0 +1,19 @@
+- hosts:
+ - all !knot
+ roles:
+ - postfix-satellite
+ vars:
+ username: "{{ ansible_hostname }}.trygvis.io"
+ postfix:
+ sasl_password:
+ - host: "[trygvis.io]:587"
+ username: "{{ username }}"
+ password: "{{ dovecot__passwords[username] }}"
+
+ tasks:
+ - tags: postfix-satellite
+ become: yes
+ lineinfile:
+ dest: /etc/postfix/sasl_passwd
+ state: absent
+ regex: "^\\[knot.trygvis.io\\]"
diff --git a/ansible/roles/postfix-satellite/tasks/postfix-satellite.yml b/ansible/roles/postfix-satellite/tasks/postfix-satellite.yml
index 8a11a84..2303523 100644
--- a/ansible/roles/postfix-satellite/tasks/postfix-satellite.yml
+++ b/ansible/roles/postfix-satellite/tasks/postfix-satellite.yml
@@ -2,6 +2,7 @@
package:
name: "{{ items }}"
state: present
+ tags: packages
vars:
items:
- postfix
@@ -13,15 +14,20 @@
notify: reload postfix
lineinfile:
dest: /etc/postfix/main.cf
- line: "{{ item.key }} = {{ item.value }}"
+ line: "{{ (item.key + ' = ' + item.value) if state=='present' else None }}"
regexp: "^{{ item.key }} ="
+ state: "{{ state }}"
+ vars:
+ state: "{{ item.state|default('present') }}"
with_items:
- key: "mydomain"
value: "{{ postfix_satellite__mydomain }}"
- key: "myorigin"
value: "{{ postfix_satellite__myorigin }}"
- key: "mydestination"
- value: ""
+ state: absent
+ - key: "myhostname"
+ state: absent
- key: "mynetworks"
value: "{{ postfix_satellite__mynetworks }}"
- key: "smtp_sasl_auth_enable"
@@ -38,6 +44,10 @@
value: "4096000"
- key: "relayhost"
value: "{{ postfix__relayhost }}"
+ - key: "default_transport"
+ state: absent
+ - key: "relay_transport"
+ state: absent
- name: Create /etc/postfix/sasl_passwd
tags: postfix-satellite-config