hashcat-cloud/aws/roles/ec2_create/tasks/main.yml

28 lines
889 B
YAML

- name: Create hashcat instance
ec2:
region: "{{ ec2.region }}"
keypair: "{{ ec2.credentials }}"
instance_tags: "{{ ec2.tags }}"
image: "{{ ec2.image }}"
instance_type: "{{ ec2.instance_type }}"
instance_profile_name: "{{ ec2.role | default('') }}"
instance_initiated_shutdown_behavior: "{{ ec2.shutdownbehavior }}"
volumes: "{{ ec2.volumes }}"
group: "{{ ec2.sg }}"
vpc_subnet_id: "{{ ec2.subnet }}"
assign_public_ip: "{{ ec2.public_ip | default('no') }}"
private_ip: "{{ ec2.private_ip | default('') }}"
wait: true
register: myec2
- name: Add new instance to host group
add_host: hostname={{ item.public_ip }} groupname=hashcat
with_items: '{{myec2.instances}}'
- name: Wait for SSH to come up
wait_for:
host: "{{ item.public_ip }}"
port: 22
state: started
#delay: 500
with_items: '{{ myec2.instances }}'