Skip to content

Commit b80bb38

Browse files
authored
Improve network security port determination logic (#29)
* Move top level key derivation to 'common' role from 'sequence' role * Add derivation key 'common__setup_base' for cdp private base * Split default extra network ports into ssh, cloud, and base port groups, with appropriate dot notation keys under infra.vpc add switch 'infra.vpc.enable_ssh', defaulted to True, to allow port 22/ssh access * Switch including cm ports 7180/7183 by default when 'mgmt' or 'clusters' is defined for base deployment * Switch including https/443 on when cdp public platform is deployed. It may also be included by overriding the defaults. Signed-off-by: Daniel Chaffelson <chaffelson@gmail.com>
1 parent df23de8 commit b80bb38

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

roles/common/defaults/main.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,13 @@ common__tunnel: "{{ env.tunnel | default(False) }}"
125125
common__public_endpoint_access: "{{ env.public_endpoint_access | default(not common__tunnel) }}"
126126

127127
common__env_admin_password: "{{ globals.admin_password | mandatory }}"
128+
128129
# Deploy
130+
common__setup_runtime: "{{ ml is defined or de is defined or datahub is defined or opdb is defined or dw is defined or df is defined | default(False) | bool }}"
131+
common__setup_plat: "{{ env is defined or sequence__setup_runtime | default(False) | bool }}"
132+
common__setup_infra: "{{ infra is defined or sequence__setup_plat | default(False) | bool }}"
133+
common__setup_base: "{{ mgmt is defined or clusters is defined | default(False) | bool }}"
134+
129135
common__include_ml: "{{ ml is defined | bool }}"
130136
common__include_dw: "{{ dw is defined | bool }}"
131137
common__include_de: "{{ de is defined | bool }}"

roles/infrastructure/defaults/main.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@ infra__vpc_svcnet_name: "{{ infra.vpc.service_network.name | default
7272
infra__vpc_public_subnet_cidrs: "{{ common__vpc_public_subnet_cidrs }}"
7373
infra__vpc_private_subnet_cidrs: "{{ common__vpc_private_subnet_cidrs }}"
7474

75-
infra__vpc_extra_ports: "{{ infra.vpc.extra_ports | default([22, 443, 7180, 7183]) }}"
75+
infra__allow_ssh_access: "{{ infra.vpc.enable_ssh | default(True) }}"
76+
infra__vpc_cloud_ports: "{{ infra.vpc.cloud_ports | default([443]) }}"
77+
infra__vpc_base_ports: "{{ infra.vpc.base_ports | default([7180, 7183]) }}"
78+
infra__vpc_ssh_ports: "{{ infra.vpc.ssh_ports | default([22]) }}"
79+
infra__vpc_extra_ports: "{{ infra.vpc.extra_ports | default(common__setup_base | ternary(infra__vpc_base_ports, []) | union( common__setup_plat | ternary(infra__vpc_cloud_ports, [])) | union(infra__allow_ssh_access | ternary(infra__vpc_ssh_ports, [])) ) }}"
7680
infra__vpc_extra_cidr: "{{ infra.vpc.extra_cidr | default([]) }}"
7781
infra__vpc_user_ports: "{{ infra.vpc.user_ports | default([infra__all_ports_security_rule[infra__type]]) }}"
7882
infra__vpc_user_cidr: "{{ infra.vpc.user_cidr | default([]) }}"

roles/sequence/defaults/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414
---
15-
sequence__setup_runtime: "{{ ml is defined or de is defined or datahub is defined or opdb is defined or dw is defined or df is defined | default(False) | bool }}"
15+
sequence__setup_runtime: "{{ common__setup_runtime }}"
1616

17-
sequence__setup_plat: "{{ env is defined or sequence__setup_runtime | default(False) | bool }}"
17+
sequence__setup_plat: "{{ common__setup_plat }}"
1818

19-
sequence__setup_infra: "{{ infra is defined or sequence__setup_plat | default(False) | bool }}"
19+
sequence__setup_infra: "{{ common__setup_infra }}"
2020

2121
sequence_init: "{{ sequence__setup_infra }}"

0 commit comments

Comments
 (0)