Skip to content

Commit 7eab152

Browse files
committed
azure_device_params role
1 parent 4987307 commit 7eab152

File tree

4 files changed

+106
-0
lines changed

4 files changed

+106
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
TODO
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright 2024 Cisco Systems, Inc. and its affiliates
2+
3+
---
4+
5+
galaxy_info:
6+
author: Przemyslaw Susko <sprzemys@cisco.com>
7+
description: Deploy Cisco SD-WAN cEdges (C8000V) on AWS
8+
license: GPL-3.0-or-later
9+
min_ansible_version: "2.16.6"
10+
11+
galaxy_tags:
12+
- cisco
13+
- sdwan
14+
- catalystwan
15+
- networking
16+
17+
dependencies: []
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Copyright 2024 Cisco Systems, Inc. and its affiliates
2+
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)
3+
4+
---
5+
6+
- name: Set mgmt and transport IP address facts
7+
ansible.builtin.set_fact:
8+
mgmt_public_ip: "{{ (public_ips | selectattr('tags.type', 'equalto', 'mgmt') | list | first).ip_address }}"
9+
transport_public_ip: "{{ (public_ips | selectattr('tags.type', 'equalto', 'transport') | list | first).ip_address }}"
10+
11+
- name: Get service NICs
12+
azure.azcollection.azure_rm_networkinterface_info:
13+
resource_group: "{{ az_resource_group }}"
14+
tags:
15+
- type:service
16+
register: service_nic_info
17+
18+
- name: Set helper facts
19+
ansible.builtin.set_fact:
20+
service_interfaces: []
21+
last_index: 2
22+
cedge_service_nic_info: "{{ service_nic_info.networkinterfaces | selectattr('tags.Name', 'search', hostname) | list }}"
23+
24+
- name: Append to service_interfaces fact
25+
ansible.builtin.set_fact:
26+
service_interfaces: "{{ service_interfaces + [{'addr': item.ip_configurations[0].private_ip_address, 'index': last_index}] }}"
27+
loop: "{{ cedge_service_nic_info }}"
28+
29+
- name: Set instance fact
30+
ansible.builtin.set_fact:
31+
instance:
32+
hostname: "{{ hostname }}"
33+
admin_username: "admin"
34+
admin_password: "{{ admin_password }}"
35+
mgmt_public_ip: "{{ mgmt_public_ip }}"
36+
transport_public_ip: "{{ transport_public_ip }}"
37+
service_interfaces: "{{ service_interfaces }}"
38+
39+
- name: Update deployment facts
40+
ansible.builtin.set_fact:
41+
deployment_facts:
42+
deployed_edge_instances: "{{ deployment_facts.deployed_edge_instances + [instance] }}"
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Copyright 2024 Cisco Systems, Inc. and its affiliates
2+
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)
3+
4+
---
5+
6+
- name: Verify if user session with Azure is active
7+
ansible.builtin.include_role:
8+
name: common
9+
tasks_from: az_user_session_probe
10+
11+
- name: Gather public IP addresses
12+
azure.azcollection.azure_rm_publicipaddress_info:
13+
resource_group: "{{ az_resource_group }}"
14+
register: public_ip_info
15+
16+
- name: Set manager authentication fact
17+
ansible.builtin.set_fact:
18+
manager_authentication:
19+
url: "{{ public_ip_info.publicipaddresses |
20+
selectattr('tags.Machine', 'search', 'vManage') |
21+
selectattr('tags.type', 'equalto', 'mgmt') |
22+
map(attribute='ip_address') |
23+
list | first }}"
24+
username: "admin"
25+
password: "{{ admin_password }}"
26+
27+
- name: Get all VMs
28+
azure.azcollection.azure_rm_virtualmachine_info:
29+
resource_group: "{{ az_resource_group }}"
30+
register: vm_info
31+
32+
- name: Filter cedge VMs
33+
ansible.builtin.set_fact:
34+
cedge_vms: "{{ vm_info.vms | selectattr('name', 'search', 'cedge') | list }}"
35+
36+
- name: Define deployment facts
37+
ansible.builtin.set_fact:
38+
deployment_facts:
39+
deployed_edge_instances: []
40+
41+
- name: Get params for cEdge
42+
ansible.builtin.include_tasks: az_cedge_ec2_instance.yml
43+
vars:
44+
hostname: "{{ item.name }}"
45+
public_ips: "{{ public_ip_info.publicipaddresses | selectattr('tags.Machine', 'equalto', item.name) | list }}"
46+
loop: "{{ cedge_vms }}"

0 commit comments

Comments
 (0)