-
Notifications
You must be signed in to change notification settings - Fork 0
/
create-ec2-2-IOS-tasks.yml
27 lines (25 loc) · 942 Bytes
/
create-ec2-2-IOS-tasks.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
---
- name: Create EC2 instance {{ router_number }} in AWS
ansible.builtin.include_role:
name: aws_create_ec2
vars:
- ec2_name_tag: "nleiva-cisco-ios-{{ router_number }}"
- name: Save Router-{{ router_number }} data
ansible.builtin.set_fact:
rtr_facts: "{{ ec2 }}"
- name: Add instance {{ router_number }} to my_routers group
ansible.builtin.add_host:
name: "{{ item.tags.Name }}"
ansible_host: "{{ item.public_ip_address }}"
ansible_user: "{{ ec2_username }}"
ansible_network_os: "{{ my_os }}"
private_ip: "{{ item.private_ip_address }}"
short_name: "rtr{{ router_number }}"
site: "{{ router_number }}"
# access: "ssh {{ ec2_username }}@{{ rtr_facts['instances'][0]['public_ip_address'] }}"
access: "{{ ssh_info }}"
ansible_ssh_private_key_file: "{{ private_key_file }}"
instance_ssh: "{{ ssh_info }}"
groups:
- my_routers
with_items: "{{ rtr_facts.instances }}"