Skip to content

Commit

Permalink
Merge pull request #28 from cisco-open/az_subnets
Browse files Browse the repository at this point in the history
Azure: create cluster subnet by default if deploying at least 3 vmana…
  • Loading branch information
przsus authored Oct 30, 2024
2 parents 4338533 + 2b09379 commit 1f567f2
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 15 deletions.
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace: cisco
name: sdwan_deployment
version: 0.2.3
version: 0.3.0
readme: README.md
authors:
- Arkadiusz Cichon <acichon@cisco.com>
Expand Down
14 changes: 9 additions & 5 deletions roles/azure_controllers/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ az_virtual_network: "{{ az_resources_prefix }}-vn"
az_vn_address_prefixes_cidr: 10.0.0.0/16

# Subnets
az_subnets:
az_subnets: |
{% filter from_yaml %}
- name: "{{ az_resources_prefix }}-mgmt-subnet-512"
cidr: "10.0.1.0/24"
VPN: 512
Expand All @@ -30,10 +31,13 @@ az_subnets:
cidr: "10.0.2.0/24"
VPN: 0
type: transport
# - name: "{{ az_resources_prefix }}-cluster-subnet-0"
# cidr: "10.0.3.0/24"
# VPN: 0
# type: cluster
{% if vmanage_instances is defined and vmanage_instances | length > 2 %}
- name: "{{ az_resources_prefix }}-cluster-subnet-0"
cidr: "10.0.3.0/24"
VPN: 0
type: cluster
{% endif %}
{% endfilter %}
# Security group
az_network_security_group: "{{ az_resources_prefix }}-nsg"
Expand Down
4 changes: 3 additions & 1 deletion roles/azure_controllers/tasks/azure_vbond_vm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@
- name: "Set vpn0_default_gateway fact from VPN 0 subnet value"
ansible.builtin.set_fact:
vpn0_default_gateway: "{{ subnet_item.cidr | ansible.utils.ipaddr('1') | ansible.utils.ipaddr('address') }}"
loop: "{{ az_subnets }}"
loop:
- "{{ mgmt_subnet }}"
- "{{ transport_subnet }}"
loop_control:
loop_var: subnet_item
when: subnet_item.VPN == 0
Expand Down
4 changes: 3 additions & 1 deletion roles/azure_controllers/tasks/azure_vsmart_vm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@
- name: "Set vpn0_default_gateway fact from VPN 0 subnet value"
ansible.builtin.set_fact:
vpn0_default_gateway: "{{ subnet_item.cidr | ansible.utils.ipaddr('1') | ansible.utils.ipaddr('address') }}"
loop: "{{ az_subnets }}"
loop:
- "{{ mgmt_subnet }}"
- "{{ transport_subnet }}"
loop_control:
loop_var: subnet_item
when: subnet_item.VPN == 0
Expand Down
13 changes: 11 additions & 2 deletions roles/azure_edges/tasks/azure_cedge_vm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@

---

- name: "Set facts for subnets used in vManage deployment"
ansible.builtin.set_fact:
transport_subnet: "{{ az_subnets | selectattr('type', 'equalto', 'transport') | first }}"
mgmt_subnet: "{{ az_subnets | selectattr('type', 'equalto', 'mgmt') | first }}"

- name: "Create public IP addresses for machine: {{ hostname }}"
azure.azcollection.azure_rm_publicipaddress:
resource_group: "{{ az_resource_group }}"
Expand All @@ -14,7 +19,9 @@
Machine: "{{ hostname }}"
VPN: "{{ subnet_item.VPN }}"
Subnet: "{{ subnet_item.name }}"
loop: "{{ az_subnets }}"
loop:
- "{{ mgmt_subnet }}"
- "{{ transport_subnet }}"
loop_control:
loop_var: subnet_item
register: public_ip_addresses
Expand Down Expand Up @@ -98,7 +105,9 @@
loop: "{{ az_subnets }}"
loop_control:
loop_var: subnet
when: subnet.VPN == 0
when:
- subnet.VPN == 0
- subnet.type =! "cluster"

- name: "Set path for bootstrap configuration: {{ userdata_cedge_path }}-{{ hostname }}"
ansible.builtin.set_fact:
Expand Down
14 changes: 9 additions & 5 deletions roles/azure_network_infrastructure/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ az_virtual_network: "{{ az_resources_prefix }}-vn"
az_vn_address_prefixes_cidr: 10.0.0.0/16

# Subnets
az_subnets:
az_subnets: |
{% filter from_yaml %}
- name: "{{ az_resources_prefix }}-mgmt-subnet-512"
cidr: "10.0.1.0/24"
VPN: 512
Expand All @@ -30,10 +31,13 @@ az_subnets:
cidr: "10.0.2.0/24"
VPN: 0
type: transport
# - name: "{{ az_resources_prefix }}-cluster-subnet-0"
# cidr: "10.0.3.0/24"
# VPN: 0
# type: cluster
{% if vmanage_instances is defined and vmanage_instances | length > 2 %}
- name: "{{ az_resources_prefix }}-cluster-subnet-0"
cidr: "10.0.3.0/24"
VPN: 0
type: cluster
{% endif %}
{% endfilter %}
# Security group
az_network_security_group: "{{ az_resources_prefix }}-nsg"
Expand Down

0 comments on commit 1f567f2

Please sign in to comment.