From 531e47c132fe8b0d16ad9c1040d9b56fd3182336 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Sun, 12 May 2019 22:34:54 +0200 Subject: [PATCH] use unique keypair --- molecule/ec2-centos-7/create.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/molecule/ec2-centos-7/create.yml b/molecule/ec2-centos-7/create.yml index 0aa9539..e4063cd 100644 --- a/molecule/ec2-centos-7/create.yml +++ b/molecule/ec2-centos-7/create.yml @@ -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: