Skip to content

Commit

Permalink
Merge pull request #146 from redhat-cop/patchback/backports/stable-3/…
Browse files Browse the repository at this point in the history
…1c2b0e9ffaa7eacc783dc790ec822e258fcbd28e/pr-130

[PR #130/1c2b0e9f backport][stable-3] Small updates to ec2 pattern
  • Loading branch information
abikouo authored Jan 27, 2025
2 parents d9d5f91 + 4a82c38 commit c311c70
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
amazon.aws.ec2_key_info:
names:
- "{{ key_name }}"
register: key_info_result
register: pattern_key_info_result

- name: Set manage_ec2_instance_key_name role var
ansible.builtin.set_fact:
manage_ec2_instance_key_name: "{{ key_name }}"
when: key_info_result.keypairs | length > 0
when: pattern_key_info_result.keypairs | length > 0

- name: Get RHEL 9 AMI ID if needed
when: ami_id | default("", true) == ""
Expand Down Expand Up @@ -73,5 +73,5 @@

- name: Warn if key does not exist
ansible.builtin.debug:
msg: "Warning: The key '{{ key_name }}' does not exist!"
when: key_name is defined and key_info_result.keypairs | length == 0
msg: "Warning: The provided key '{{ key_name }}' does not exist!"
when: key_name is defined and pattern_key_info_result.keypairs | length == 0
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ spec:

- type: text
question_name: Key Pair Name
question_description: Name of key pair for instance, include to delete key pair created with other instance resources. Defaults to '{{ instance_name }}-key'
question_description: Name of key pair for instance, include to delete key pair created with other instance resources.
variable: key_name
required: false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
names:
- "{{ manage_ec2_instance_key_name }}"
register: key_info_result
no_log: true

- name: Create new key pair
amazon.aws.ec2_key:
Expand Down

0 comments on commit c311c70

Please sign in to comment.