use unique keypair
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Robert Kaussow 2019-05-12 22:34:54 +02:00
parent e8f71e59f2
commit 531e47c132

View File

@ -25,7 +25,7 @@
to_port: 0
cidr_ip: '0.0.0.0/0'
keypair_name: molecule_key
keypair_name: "molecule_key_{{ molecule_yml.platforms }}"
keypair_path: "{{ lookup('env', 'MOLECULE_EPHEMERAL_DIRECTORY') }}/ssh_key"
tasks:
- name: Create security group
@ -35,16 +35,10 @@
rules: "{{ security_group_rules }}"
rules_egress: "{{ security_group_rules_egress }}"
- name: Test for presence of local keypair
stat:
path: "{{ keypair_path }}"
register: keypair_local
- name: Delete remote keypair
ec2_key:
name: "{{ keypair_name }}"
state: absent
when: not keypair_local.stat.exists
- name: Create keypair
ec2_key: