Skip to content

Commit

Permalink
firewall -> cloud_firewall
Browse files Browse the repository at this point in the history
  • Loading branch information
vitabaks committed Aug 13, 2024
1 parent ad0fa03 commit e6a6ce4
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions roles/cloud-resources/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ ssh_key_name: "" # Name of the SSH key to be added to the server.
# Note: If not provided, all cloud available SSH keys will be added (applicable to DigitalOcean, Hetzner).
ssh_key_content: "" # (optional) If provided, the public key content will be added to the cloud (directly to the server for GCP).

# Security Group / Firewall
firewall: true # Specify 'false' if you don't want to configure Firewall rules, or want to manage them yourself.
# Firewall / Security Group
cloud_firewall: true # Specify 'false' if you don't want to configure Firewall rules, or want to manage them yourself.

ssh_public_access: true # Allow public ssh access (required for deployment from the public network).
ssh_public_allowed_ips: "" # (comma-separated list of IP addresses in CIDR format) If empty, then public access is allowed for any IP address.
Expand Down
4 changes: 2 additions & 2 deletions roles/cloud-resources/tasks/aws.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@
}]
}}
register: ec2_security_group_result
when: firewall | bool
when: cloud_firewall | bool

# Server and volume
- name: "AWS: Create or modify EC2 instance"
Expand All @@ -206,7 +206,7 @@
image_id: "{{ server_image }}"
key_name: "{{ ssh_key_name }}"
region: "{{ server_location }}"
security_groups: "{{ ([] if not firewall | bool else [patroni_cluster_name + '-security-group']) }}"
security_groups: "{{ ([] if not cloud_firewall | bool else [patroni_cluster_name + '-security-group']) }}"
vpc_subnet_id: "{{ server_network }}"
network:
assign_public_ip: true
Expand Down
2 changes: 1 addition & 1 deletion roles/cloud-resources/tasks/azure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
'direction': 'Inbound'
}]
}}
when: firewall | bool
when: cloud_firewall | bool

# Load Balancer
- name: "Azure: Create public IP address for Load Balancer"
Expand Down
4 changes: 2 additions & 2 deletions roles/cloud-resources/tasks/digitalocean.yml
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@
] if database_public_access | bool and (not with_haproxy_load_balancing | bool and not pgbouncer_install | bool) else [])
}}
when:
- firewall | bool
- cloud_firewall | bool
- (ssh_public_access | bool or netdata_public_access | bool or database_public_access | bool)

- name: "DigitalOcean: Create or modify Postgres cluster firewall"
Expand Down Expand Up @@ -452,7 +452,7 @@
}
] if dcs_type == 'consul' else [])
}}
when: firewall | bool
when: cloud_firewall | bool

# Server and volume
- name: "DigitalOcean: Create or modify Droplet"
Expand Down
8 changes: 4 additions & 4 deletions roles/cloud-resources/tasks/gcp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
state: present
when:
- ssh_public_access | bool
- firewall | bool
- cloud_firewall | bool

- name: "GCP: Create or modify Netdata public firewall rule"
google.cloud.gcp_compute_firewall:
Expand All @@ -131,7 +131,7 @@
when:
- netdata_install | bool
- netdata_public_access | bool
- firewall | bool
- cloud_firewall | bool

- name: "GCP: Create or modify Database public firewall rule"
google.cloud.gcp_compute_firewall:
Expand Down Expand Up @@ -161,7 +161,7 @@
}}
when:
- database_public_access | bool
- firewall | bool
- cloud_firewall | bool

- name: "GCP: Create or modify Postgres cluster firewall rule"
google.cloud.gcp_compute_firewall:
Expand Down Expand Up @@ -201,7 +201,7 @@
consul_ports_serf_wan | default('8302'),
consul_ports_server | default('8300')] if dcs_type == 'consul' else [])
}}
when: firewall | bool
when: cloud_firewall | bool

# if 'cloud_load_balancer' is 'true'
# https://cloud.google.com/load-balancing/docs/tcp#firewall-rules
Expand Down
8 changes: 4 additions & 4 deletions roles/cloud-resources/tasks/hetzner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@
] if database_public_access | bool and (not with_haproxy_load_balancing | bool and not pgbouncer_install | bool) else [])
}}
when:
- firewall | bool
- cloud_firewall | bool
- (ssh_public_access | bool or netdata_public_access | bool or database_public_access | bool)

- name: "Hetzner Cloud: Create or modify Postgres cluster firewall"
Expand Down Expand Up @@ -400,7 +400,7 @@
] if dcs_type == 'consul' else [])
}}
when:
- firewall | bool
- cloud_firewall | bool

# Server and volume
- name: "Hetzner Cloud: Create or modify server"
Expand All @@ -427,9 +427,9 @@
vars:
firewalls_list: >-
{{
([patroni_cluster_name + '-public-firewall'] if firewall | bool and
([patroni_cluster_name + '-public-firewall'] if cloud_firewall | bool and
(ssh_public_access | bool or netdata_public_access | bool or database_public_access | bool) else []) +
([patroni_cluster_name + '-firewall'] if firewall | bool else [])
([patroni_cluster_name + '-firewall'] if cloud_firewall | bool else [])
}}
- name: "Hetzner Cloud: Add server to network '{{ server_network }}'"
Expand Down

0 comments on commit e6a6ce4

Please sign in to comment.