Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small updates to ec2 pattern #130

Merged
merged 2 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading