[fix] roles with ufw incocation

This commit is contained in:
roydfalk 2024-06-01 17:56:28 +02:00
parent 2ac8c9c4c3
commit c7c9e6895c
5 changed files with 58 additions and 45 deletions

View file

@ -28,30 +28,33 @@
} }
}, },
{ {
"name": "Check wether enabling UFW would be considered a changed", "name": "ufw | check",
"check_mode": true, "check_mode": true,
"become": true,
"community.general.ufw": { "community.general.ufw": {
"state": "enabled", "state": "enabled"
"register": "ufw_enable_check" },
} "register": "ufw_enable_check"
}, },
{ {
"name": "Allow port 80 in ufw", "name": "ufw | allow port 80",
"when": "not ufw_enable_check.changed",
"become": true,
"community.general.ufw": { "community.general.ufw": {
"rule": "allow", "rule": "allow",
"port": "80", "port": "80",
"proto": "tcp" "proto": "tcp"
}, }
"when": "not ufw_enable_check.changed"
}, },
{ {
"name": "Allow port 443 in ufw", "name": "ufw | allow port 443",
"when": "not ufw_enable_check.changed",
"become": true,
"community.general.ufw": { "community.general.ufw": {
"rule": "allow", "rule": "allow",
"port": "443", "port": "443",
"proto": "tcp" "proto": "tcp"
}, }
"when": "not ufw_enable_check.changed"
}, },
{ {
"name": "restart service", "name": "restart service",

View file

@ -26,21 +26,23 @@
} }
}, },
{ {
"name": "Check wether enabling UFW would be considered a changed", "name": "ufw | check",
"check_mode": true, "check_mode": true,
"become": true,
"community.general.ufw": { "community.general.ufw": {
"state": "enabled", "state": "enabled"
"register": "ufw_enable_check" },
} "register": "ufw_enable_check"
}, },
{ {
"name": "Allow port in ufw", "name": "ufw | allow port",
"when": "not ufw_enable_check.changed",
"become": true,
"community.general.ufw": { "community.general.ufw": {
"rule": "allow", "rule": "allow",
"port": "{{ var_murmur_port }}", "port": "{{var_murmur_port | string}}",
"proto": "tcp" "proto": "tcp"
}, }
"when": "not ufw_enable_check.changed"
}, },
{ {
"name": "service", "name": "service",

View file

@ -10,30 +10,33 @@
} }
}, },
{ {
"name": "Check wether enabling UFW would be considered a changed", "name": "ufw | check",
"become": true,
"check_mode": true, "check_mode": true,
"community.general.ufw": { "community.general.ufw": {
"state": "enabled", "state": "enabled"
"register": "ufw_enable_check" },
} "register": "ufw_enable_check"
}, },
{ {
"name": "Allow port 80 in ufw", "name": "ufw | allow port 80",
"when": "not ufw_enable_check.changed",
"become": true,
"community.general.ufw": { "community.general.ufw": {
"rule": "allow", "rule": "allow",
"port": "80", "port": "80",
"proto": "tcp" "proto": "tcp"
}, }
"when": "not ufw_enable_check.changed"
}, },
{ {
"name": "Allow port 443 in ufw", "name": "ufw | allow port 443",
"when": "not ufw_enable_check.changed",
"become": true,
"community.general.ufw": { "community.general.ufw": {
"rule": "allow", "rule": "allow",
"port": "443", "port": "443",
"proto": "tcp" "proto": "tcp"
}, }
"when": "not ufw_enable_check.changed"
}, },
{ {
"name": "restart service", "name": "restart service",

View file

@ -10,29 +10,32 @@
} }
}, },
{ {
"name": "Check wether enabling UFW would be considered a changed", "name": "ufw | check",
"check_mode": true, "check_mode": true,
"become": true,
"community.general.ufw": { "community.general.ufw": {
"state": "enabled", "state": "enabled"
"register": "ufw_enable_check" },
} "register": "ufw_enable_check"
}, },
{ {
"name": "Allow FTP port 20 in ufw", "name": "ufw | allow port 20",
"when": "not ufw_enable_check.changed",
"become": true,
"community.general.ufw": { "community.general.ufw": {
"rule": "allow", "rule": "allow",
"port": "20", "port": "20",
"proto": "tcp" "proto": "tcp"
}, }
"when": "not ufw_enable_check.changed"
}, },
{ {
"name": "Allow FTP port 21 in ufw", "name": "ufw | allow port 21",
"when": "not ufw_enable_check.changed",
"become": true,
"community.general.ufw": { "community.general.ufw": {
"rule": "allow", "rule": "allow",
"port": "21", "port": "21",
"proto": "tcp" "proto": "tcp"
}, }
"when": "not ufw_enable_check.changed"
} }
] ]

View file

@ -59,21 +59,23 @@
} }
}, },
{ {
"name": "Check wether enabling UFW would be considered a changed", "name": "ufw | check",
"become": true,
"check_mode": true, "check_mode": true,
"community.general.ufw": { "community.general.ufw": {
"state": "enabled", "state": "enabled"
"register": "ufw_enable_check" },
} "register": "ufw_enable_check"
}, },
{ {
"name": "Allow matrix federation port in ufw", "name": "ufw | allow port",
"when": "not ufw_enable_check.changed",
"become": true,
"community.general.ufw": { "community.general.ufw": {
"rule": "allow", "rule": "allow",
"port": "8448", "port": "8448",
"proto": "tcp" "proto": "tcp"
}, }
"when": "not ufw_enable_check.changed"
}, },
{ {
"name": "restart service", "name": "restart service",