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

Fix race condition in obtaining the public IP for ec2 (#43) #70

Merged

Conversation

danielpodwysocki
Copy link
Contributor

Fixes #43

This prevents a race condition where we attempt to look up the public IP before an interface is assigned to the instance.

An instance in a "running" state will always have this completed - a "started" one not necessarily.

This would then go on and fail when this module is called (

)

        - name: Collect instance configs
          set_fact:
            instance_config:
              instance: "{{ item.name }}"
              address: "{{ item.assign_public_ip | ternary(instance.public_ip_address, instance.private_ip_address) }}"
              user: "{{ item.ssh_user }}"
              port: "{{ item.ssh_port }}"
              identity_file: "{{ item.private_key_path }}"
              instance_ids:
                - "{{ instance.instance_id }}"
          vars:
            instance: "{{ ec2_instances.results[index].instances[0] }}"
          loop: "{{ platforms }}"
          loop_control:
            index_var: index
            label: "{{ item.name }}"
          register: instance_configs


@danielpodwysocki danielpodwysocki changed the title Fix race condition in obtaining the public IP for ec2 (https://github.com/ansible-community/molecule-plugins/issues/43) Fix race condition in obtaining the public IP for ec2 (#43) Jan 7, 2023
@ssbarnea
Copy link
Member

Please raise this towards the new code location at https://github.com/ansible-community/molecule-plugins

@ssbarnea ssbarnea closed this Jan 10, 2023
@danielpodwysocki
Copy link
Contributor Author

@ssbarnea This had already been opened at the new repo. Can we get this PR reopened?

@ssbarnea ssbarnea reopened this Jan 11, 2023
@danielpodwysocki
Copy link
Contributor Author

Any news on this PR?

@apatard apatard added bug Something isn't working ec2 Amazon EC2 labels Apr 12, 2023
@apatard
Copy link
Member

apatard commented Apr 12, 2023

@danielpodwysocki damn. forgot that gh rebase is messing with the commit authorship, sorry. Feel free to push force a commit with proper authorship if you care. If you don't mind it, say it too and I'll merge the PR.

@apatard
Copy link
Member

apatard commented Apr 12, 2023

after checking seems it's fine. Sorry for the noise, I've yet to learn how to deal with github interface. I'm going to merge the PR then.

@apatard apatard merged commit b003d8e into ansible-community:main Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ec2 Amazon EC2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EC2 public_ip_address not always set after ec2_instance creation
3 participants