Files
ansible-collection/roles/common/azure-create-network-interface/tasks/main.yml
alexpolo1 a3b8959ca9 Initial collection structure
Migrated from legacy playbook repo into Ansible collection format:

Roles (171 total):
- common: 44 roles (fact gathering, SSH setup, utilities)
- configuration: 32 roles (system config, networking, satellite)
- provisioning: 16 roles (VMware, Azure, physical server deployment)
- security: 15 roles (OpenSCAP hardening, certificates, AD integration)
- monitoring: 12 roles (Zabbix, logging agents, metrics)
- networking: 12 roles (DNS, DHCP, network interfaces)
- satellite: 4 roles (Pulp/Satellite management)
- misc: 36 roles (various utilities)

Playbooks (159 total):
- provisioning: 14 playbooks
- azure: 13 playbooks
- configuration: 22 playbooks
- maintenance: 10 playbooks
- security: 10 playbooks
- monitoring: 9 playbooks
- vcenter: 6 playbooks
- networking: 7 playbooks
- misc: 65 playbooks
2026-06-27 21:48:22 +02:00

95 lines
3.5 KiB
YAML

---
- name: Setting default ASG zone for CCTA
set_fact:
default_asg_zone: CCTA
when: default_asg_zone is undefined and dc_domain == "EXAMPLE-CORP.COM"
- name: Setting default ASG zone for DMZ23
set_fact:
default_asg_zone: NonProd
when: default_asg_zone is undefined and dc_domain == "DMZ23.EXAMPLE.COM"
- name: Setting default ASG zone for DMZ24
set_fact:
default_asg_zone: Prod
when: default_asg_zone is undefined and dc_domain == "DMZ.EXAMPLE.COM"
- debug:
msg: "Setting ASG {{ project_asg }} and the default ASG's for zone {{ default_asg_zone }}"
when: project_asg is defined
- set_fact:
asg_default:
- { resource_group: "RG-Connectivity-01", name: "ASG-DMZ23" }
- { resource_group: "RG-Connectivity-01", name: "ASG-DMZ23-ClientNet-to-DMZ23" }
- { resource_group: "RG-Connectivity-01", name: "ASG-DMZ23-Internet-OutBound" }
- { resource_group: "RG-Connectivity-01", name: "ASG-DMZ23-Logging" }
- { resource_group: "RG-Connectivity-01", name: "ASG-DMZ23-Zabbix" }
when: default_asg_zone == "NonProd"
- set_fact:
asg_default:
- { resource_group: "RG-Connectivity-01", name: "ASG-DMZ24" }
- { resource_group: "RG-Connectivity-01", name: "ASG-DMZ24-ClientNet-to-DMZ24" }
- { resource_group: "RG-Connectivity-01", name: "ASG-DMZ24-Internet-OutBound" }
- { resource_group: "RG-Connectivity-01", name: "ASG-DMZ24-Logging" }
- { resource_group: "RG-Connectivity-01", name: "ASG-DMZ24-Zabbix" }
when: default_asg_zone == "Prod"
- set_fact:
asg_default:
- { resource_group: "RG-Connectivity-01", name: "ASG-CCTA-ServerNet" }
- { resource_group: "RG-Connectivity-01", name: "ASG-CCTA-ClientNet" }
- { resource_group: "RG-Connectivity-01", name: "ASG-CCTA-ClientNet-RDP" }
- { resource_group: "RG-Connectivity-01", name: "ASG-CCTA-Internet-OutBound" }
- { resource_group: "RG-Connectivity-01", name: "ASG-CCTA-Logging" }
when: default_asg_zone == "CCTA"
- set_fact:
asg_default:
- { resource_group: "RG-Connectivity-01", name: "ASG-Shared-Services" }
- { resource_group: "RG-Connectivity-01", name: "ASG-Shared-Services-ClientNet-to-Shared-Services" }
- { resource_group: "RG-Connectivity-01", name: "ASG-Shared-Services-Internet-OutBound" }
when: default_asg_zone == "SharedServices"
- name: "Application Security Groups to be set"
set_fact:
project_asg: { name: "{{ project_asg }}", resource_group: "RG-Connectivity-01" }
when: project_asg is defined
- set_fact:
asg_list: "{{ [project_asg] + asg_default }}"
when: project_asg is defined
- set_fact:
asg_list: "{{ asg_default }}"
when: project_asg is not defined
- debug:
msg: "{{ asg_list }}"
- name: Private IP allocation method
debug:
msg: "{{ private_ip_method }}"
- name: IP address
debug:
msg: "{{ ip | default (None) }}"
- name: Create network interface
azure.azcollection.azure_rm_networkinterface:
name: "{{ vm_name | default (inventory_hostname)}}"
resource_group: "{{ tapi_resource_group }}"
virtual_network: {name: "{{ network }}", resource_group: "{{ network_rg }}"}
subnet_name: "{{ subnet }}"
location: "{{ location }}"
create_with_security_group: False
enable_accelerated_networking: "{{ enable_accelerated_networking }}"
subscription_id: "{{ tapi_azure_subscription_id }}"
ip_configurations:
- name: ipconfig1
primary: True
private_ip_allocation_method: "{{ private_ip_method }}"
private_ip_address: "{{ ip | default (None) }}"
application_security_groups: "{{ asg_list }}"