mirror of https://github.com/nucypher/nucypher.git
46 lines
1.7 KiB
YAML
46 lines
1.7 KiB
YAML
- hosts: localhost
|
|
connection: local
|
|
gather_facts: false
|
|
user: ubuntu
|
|
pre_tasks:
|
|
- include_vars: "{{ lookup('env', 'ANSIBLE_VARIABLES') }}"
|
|
vars:
|
|
nucypher_network_name: "{{ lookup('env', 'NUCYPHER_NETWORK_NAME') }}"
|
|
inventory_group: "{{ nucypher_network_name }}-{{ nucypher_role }}"
|
|
tasks:
|
|
- name: "Provision {{ ec2_count }} instances on the {{ ec2_region }} region ({{ inventory_group }})"
|
|
local_action:
|
|
module: ec2
|
|
key_name: "{{ ec2_keypair }}"
|
|
group_id: "{{ ec2_security_group_id }}"
|
|
instance_type: "{{ ec2_instance_type }}"
|
|
image: "{{ ec2_image }}"
|
|
vpc_subnet_id: "{{ ec2_subnet_id }}"
|
|
region: "{{ ec2_region }}"
|
|
instance_tags: '{"Type":"{{ec2_instance_type}}", "Role":"{{inventory_group}}"}'
|
|
assign_public_ip: yes
|
|
wait: true
|
|
exact_count: "{{ ec2_count }}"
|
|
count_tag:
|
|
Role: "{{ inventory_group }}"
|
|
volumes:
|
|
- device_name: /dev/xvda
|
|
volume_type: gp2
|
|
volume_size: "{{ ec2_volume_size }}"
|
|
delete_on_termination: true
|
|
register: nucypher_fleet
|
|
|
|
- name: "Add Provisioned Servers as Hosts"
|
|
add_host:
|
|
name: "{{ item.public_ip }}"
|
|
groups: "{{ inventory_group }}"
|
|
ec2_region: "{{ ec2_region }}"
|
|
ec2_tag_Type: "{{ ec2_tag_Type}}"
|
|
ec2_tag_Role: "{{ inventory_group }}"
|
|
ec2_ip_address: "{{ item.public_ip }}"
|
|
with_items: "{{ nucypher_fleet.instances }}"
|
|
|
|
- name: Wait for the instances to boot by checking the ssh port
|
|
wait_for: host={{item.public_ip}} port=22 delay=15 timeout=300 state=started
|
|
with_items: "{{ nucypher_fleet.instances }}"
|