Merge branch 'dev-ufw_1' into 'dev-ufw'

Add ufw role | Adjustments after test

See merge request roydfalk/ansible-base!6
This commit is contained in:
roydfalk 2024-06-09 08:57:04 +00:00
commit cf175b8ec1
6 changed files with 66 additions and 49 deletions

View file

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

View file

@ -11,7 +11,8 @@
},
{
"name": "ufw deny incoming",
"ufw": {
"become": true,
"community.general.ufw": {
"direction": "incoming",
"proto": "any",
"policy": "deny"
@ -19,7 +20,8 @@
},
{
"name": "ufw allow outgoing",
"ufw": {
"become": true,
"community.general.ufw": {
"direction": "outgoing",
"proto": "any",
"policy": "allow"
@ -27,14 +29,16 @@
},
{
"name": "ufw allow and rate-limit ssh",
"ufw": {
"become": true,
"community.general.ufw": {
"rule": "limit",
"name": "ssh"
}
},
{
"name": "enable ufw service",
"ufw": {
"become": true,
"community.general.ufw": {
"state": "enabled"
}
}