Skip to content

Commit 4987307

Browse files
committed
aws_edge_params role
1 parent 70d4242 commit 4987307

File tree

5 files changed

+120
-1
lines changed

5 files changed

+120
-1
lines changed

galaxy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace: cisco
22
name: sdwan_deployment
3-
version: 0.3.3
3+
version: 0.3.4
44
readme: README.md
55
authors:
66
- Arkadiusz Cichon <acichon@cisco.com>

roles/aws_device_params/README.md

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: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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: Get EIPs associated with the cEdge instances
7+
amazon.aws.ec2_eip_info:
8+
region: "{{ aws_region }}"
9+
filters:
10+
"tag:Creator": "{{ aws_tag_creator }}"
11+
tag:Machine: "*{{ hostname }}*"
12+
register: eip_info
13+
14+
- name: Extract management public IP
15+
ansible.builtin.set_fact:
16+
mgmt_public_ip: "{{ (eip_info.addresses | selectattr('tags.VPN', 'equalto', '512') | map(attribute='public_ip') | first) | default(None) }}"
17+
transport_public_ip: "{{ (eip_info.addresses | selectattr('tags.VPN', 'equalto', '0') | map(attribute='public_ip') | first) | default(None) }}"
18+
19+
- name: Set service_interfaces fact
20+
ansible.builtin.set_fact:
21+
service_interfaces: []
22+
last_index: 2
23+
24+
- name: Append to service_interfaces
25+
ansible.builtin.set_fact:
26+
service_interfaces: "{{ service_interfaces + [{'addr': eip.private_ip_address, 'index': last_index}] }}"
27+
last_index: "{{ last_index | int + 1 }}"
28+
loop: "{{ eip_info.addresses }}"
29+
loop_control:
30+
loop_var: eip
31+
when:
32+
- eip.tags.VPN != '512'
33+
- eip.tags.VPN != '0'
34+
35+
- name: Set instance fact
36+
ansible.builtin.set_fact:
37+
instance:
38+
hostname: "{{ hostname }}"
39+
admin_username: "admin"
40+
admin_password: "{{ admin_password }}"
41+
mgmt_public_ip: "{{ mgmt_public_ip }}"
42+
transport_public_ip: "{{ transport_public_ip }}"
43+
service_interfaces: "{{ service_interfaces }}"
44+
45+
- name: Update deployment facts
46+
ansible.builtin.set_fact:
47+
deployment_facts:
48+
deployed_edge_instances: "{{ deployment_facts.deployed_edge_instances + [instance] }}"
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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: Gather network resources information
7+
ansible.builtin.include_role:
8+
name: cisco.sdwan_deployment.aws_network_infrastructure
9+
tasks_from: aws_gather_network_resources.yml
10+
11+
- name: Gather information about EC2 instances with 'cedge' in their name
12+
amazon.aws.ec2_instance_info:
13+
region: "{{ aws_region }}"
14+
filters:
15+
"tag:Creator": "{{ aws_tag_creator }}"
16+
"tag:Name": "*vManage*"
17+
register: vmanage_ec2_info
18+
19+
- name: Get EIPs associated with the vManage instances
20+
amazon.aws.ec2_eip_info:
21+
region: "{{ aws_region }}"
22+
filters:
23+
"tag:Creator": "{{ aws_tag_creator }}"
24+
tag:Machine: "*{{ vmanage_ec2_info.instances | map(attribute='tags.Name') | list | first }}*"
25+
register: vmanage_eip_info
26+
27+
- name: Set manager authentication fact
28+
ansible.builtin.set_fact:
29+
manager_authentication:
30+
url: "{{ vmanage_eip_info.addresses | selectattr('tags.VPN', 'equalto', '512') | map(attribute='public_ip') | first }}"
31+
username: "admin"
32+
password: "{{ admin_password }}"
33+
34+
- name: Define deployment facts
35+
ansible.builtin.set_fact:
36+
deployment_facts:
37+
deployed_edge_instances: []
38+
39+
- name: Gather information about EC2 instances with 'cedge' in their name
40+
amazon.aws.ec2_instance_info:
41+
region: "{{ aws_region }}"
42+
filters:
43+
"tag:Creator": "{{ aws_tag_creator }}"
44+
"tag:Name": "*cedge*"
45+
register: cedge_ec2_info
46+
47+
- name: Get params for cEdge
48+
ansible.builtin.include_tasks: aws_cedge_ec2_instance.yml
49+
vars:
50+
hostname: "{{ host }}"
51+
loop: "{{ cedge_ec2_info.instances | map(attribute='tags.Name') | list }}"
52+
loop_control:
53+
loop_var: host

0 commit comments

Comments
 (0)