Skip to content

Commit

Permalink
fix: updated ansible playbook
Browse files Browse the repository at this point in the history
  • Loading branch information
titanism committed Dec 6, 2023
1 parent 3df8995 commit 756e82f
Show file tree
Hide file tree
Showing 9 changed files with 141 additions and 30 deletions.
7 changes: 3 additions & 4 deletions ansible/playbooks/imap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,16 @@
rule: limit
port: 22
proto: tcp
- name: Set UFW default forward policy to ACCEPT
- name: Set UFW default forward policy to DROP
lineinfile:
dest: /etc/default/ufw
line: DEFAULT_FORWARD_POLICY="ACCEPT"
line: DEFAULT_FORWARD_POLICY="DROP"
regexp: ^DEFAULT_FORWARD_POLICY\=
- name: Allow ssh
ufw:
rule: allow
port: 22
proto: tcp
# NOTE: we port forward 993 -> 2993
- name: Allow port 993
ufw:
rule: allow
Expand All @@ -85,7 +84,7 @@
#
- name: "Update ufw before.rules until #21 is resolved"
template:
src: "{{ playbook_dir }}/templates/before.imap.rules.j2"
src: "{{ playbook_dir }}/templates/before.rules.j2"
dest: /etc/ufw/before.rules
owner: root
mode: "0644"
Expand Down
7 changes: 3 additions & 4 deletions ansible/playbooks/pop3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,16 @@
rule: limit
port: 22
proto: tcp
- name: Set UFW default forward policy to ACCEPT
- name: Set UFW default forward policy to DROP
lineinfile:
dest: /etc/default/ufw
line: DEFAULT_FORWARD_POLICY="ACCEPT"
line: DEFAULT_FORWARD_POLICY="DROP"
regexp: ^DEFAULT_FORWARD_POLICY\=
- name: Allow ssh
ufw:
rule: allow
port: 22
proto: tcp
# NOTE: we port forward 995 -> 2995
- name: Allow port 995
ufw:
rule: allow
Expand All @@ -86,7 +85,7 @@
#
- name: "Update ufw before.rules until #21 is resolved"
template:
src: "{{ playbook_dir }}/templates/before.pop3.rules.j2"
src: "{{ playbook_dir }}/templates/before.rules.j2"
dest: /etc/ufw/before.rules
owner: root
mode: "0644"
Expand Down
8 changes: 3 additions & 5 deletions ansible/playbooks/smtp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,18 +115,16 @@
rule: limit
port: 22
proto: tcp
- name: Set UFW default forward policy to ACCEPT
- name: Set UFW default forward policy to DROP
lineinfile:
dest: /etc/default/ufw
line: DEFAULT_FORWARD_POLICY="ACCEPT"
line: DEFAULT_FORWARD_POLICY="DROP"
regexp: ^DEFAULT_FORWARD_POLICY\=
- name: Allow ssh
ufw:
rule: allow
port: 22
proto: tcp
# NOTE: we port forward 25, 587, and 2525 -> 2587 (and 2587 is itself available)
# NOTE: we port forward 465 -> 2465 (and 2465 is itself available)
- name: Allow port 25
ufw:
rule: allow
Expand Down Expand Up @@ -163,7 +161,7 @@
#
- name: "Update ufw before.rules until #21 is resolved"
template:
src: "{{ playbook_dir }}/templates/before.smtp.rules.j2"
src: "{{ playbook_dir }}/templates/before.rules.j2"
dest: /etc/ufw/before.rules
owner: root
mode: "0644"
Expand Down
6 changes: 3 additions & 3 deletions ansible/playbooks/templates/ecosystem-imap.json.j2
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"apps": [
{
"name": "imap",
"name": "imap-993",
"script": "imap.js",
"exec_mode": "cluster",
"wait_ready": true,
Expand All @@ -15,9 +15,9 @@
{
"name": "imap-2993",
"script": "imap.js",
"exec_mode": "cluster",
"exec_mode": "fork",
"wait_ready": true,
"instances": "2",
"instances": "1",
"pmx": false,
"env_production": {
"NODE_ENV": "production",
Expand Down
6 changes: 3 additions & 3 deletions ansible/playbooks/templates/ecosystem-pop3.json.j2
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"apps": [
{
"name": "pop3",
"name": "pop3-995",
"script": "pop3.js",
"exec_mode": "cluster",
"wait_ready": true,
Expand All @@ -15,9 +15,9 @@
{
"name": "pop3-2995",
"script": "pop3.js",
"exec_mode": "cluster",
"exec_mode": "fork",
"wait_ready": true,
"instances": "2",
"instances": "1",
"pmx": false,
"env_production": {
"NODE_ENV": "production",
Expand Down
57 changes: 50 additions & 7 deletions ansible/playbooks/templates/ecosystem-smtp.json.j2
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"apps": [
{
"name": "smtp-tls",
"name": "smtp-tls-587",
"script": "smtp.js",
"exec_mode": "cluster",
"wait_ready": true,
Expand All @@ -13,7 +13,43 @@
}
},
{
"name": "smtp-ssl",
"name": "smtp-tls-2587",
"script": "smtp.js",
"exec_mode": "fork",
"wait_ready": true,
"instances": "1",
"pmx": false,
"env_production": {
"NODE_ENV": "production",
"SMTP_PORT": 2587
}
},
{
"name": "smtp-tls-25",
"script": "smtp.js",
"exec_mode": "fork",
"wait_ready": true,
"instances": "1",
"pmx": false,
"env_production": {
"NODE_ENV": "production",
"SMTP_PORT": 25
}
},
{
"name": "smtp-tls-2525",
"script": "smtp.js",
"exec_mode": "fork",
"wait_ready": true,
"instances": "1",
"pmx": false,
"env_production": {
"NODE_ENV": "production",
"SMTP_PORT": 2525
}
},
{
"name": "smtp-ssl-465",
"script": "smtp.js",
"exec_mode": "cluster",
"wait_ready": true,
Expand All @@ -24,11 +60,18 @@
"SMTP_PORT": 465
}
},
run these in fork mode:
25
2525
2587
2465
{
"name": "smtp-ssl-2465",
"script": "smtp.js",
"exec_mode": "fork",
"wait_ready": true,
"instances": "1",
"pmx": false,
"env_production": {
"NODE_ENV": "production",
"SMTP_PORT": 465
}
},
{
"name": "smtp-bree",
"script": "smtp-bree.js",
Expand Down
14 changes: 13 additions & 1 deletion ecosystem-imap.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
{
"apps": [
{
"name": "imap",
"name": "imap-993",
"script": "imap.js",
"exec_mode": "cluster",
"wait_ready": true,
"instances": "max",
"pmx": false,
"env_production": {
"NODE_ENV": "production",
"IMAP_PORT": 993
}
},
{
"name": "imap-2993",
"script": "imap.js",
"exec_mode": "fork",
"wait_ready": true,
"instances": "1",
"pmx": false,
"env_production": {
"NODE_ENV": "production",
"IMAP_PORT": 2993
Expand Down
14 changes: 13 additions & 1 deletion ecosystem-pop3.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"apps": [
{
"name": "pop3",
"name": "pop3-995",
"script": "pop3.js",
"exec_mode": "cluster",
"wait_ready": true,
Expand All @@ -11,6 +11,18 @@
"NODE_ENV": "production",
"POP3_PORT": 995
}
},
{
"name": "pop3-2995",
"script": "pop3.js",
"exec_mode": "fork",
"wait_ready": true,
"instances": "1",
"pmx": false,
"env_production": {
"NODE_ENV": "production",
"POP3_PORT": 2995
}
}
],
"deploy": {
Expand Down
52 changes: 50 additions & 2 deletions ecosystem-smtp.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"apps": [
{
"name": "smtp-tls",
"name": "smtp-tls-587",
"script": "smtp.js",
"exec_mode": "cluster",
"wait_ready": true,
Expand All @@ -13,7 +13,43 @@
}
},
{
"name": "smtp-ssl",
"name": "smtp-tls-2587",
"script": "smtp.js",
"exec_mode": "fork",
"wait_ready": true,
"instances": "1",
"pmx": false,
"env_production": {
"NODE_ENV": "production",
"SMTP_PORT": 2587
}
},
{
"name": "smtp-tls-25",
"script": "smtp.js",
"exec_mode": "fork",
"wait_ready": true,
"instances": "1",
"pmx": false,
"env_production": {
"NODE_ENV": "production",
"SMTP_PORT": 25
}
},
{
"name": "smtp-tls-2525",
"script": "smtp.js",
"exec_mode": "fork",
"wait_ready": true,
"instances": "1",
"pmx": false,
"env_production": {
"NODE_ENV": "production",
"SMTP_PORT": 2525
}
},
{
"name": "smtp-ssl-465",
"script": "smtp.js",
"exec_mode": "cluster",
"wait_ready": true,
Expand All @@ -24,6 +60,18 @@
"SMTP_PORT": 465
}
},
{
"name": "smtp-ssl-2465",
"script": "smtp.js",
"exec_mode": "fork",
"wait_ready": true,
"instances": "1",
"pmx": false,
"env_production": {
"NODE_ENV": "production",
"SMTP_PORT": 465
}
},
{
"name": "smtp-bree",
"script": "smtp-bree.js",
Expand Down

0 comments on commit 756e82f

Please sign in to comment.