This commit is contained in:
parent
e8f71e59f2
commit
531e47c132
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user