ansible-collections / community.aws

Ansible Collection for Community AWS
GNU General Public License v3.0
184 stars 392 forks source link

Allow for aws_ssm plugin option to be provided by an environment variable #1990

Open abeluck opened 8 months ago

abeluck commented 8 months ago

Summary

When running the same playbook on different host machines the location of the session-manager-plugin binary may not be in the same location on each machine.

It would be very helpful to be able to load the ansible_aws_ssm_plugin option from an environment variable, like many of the other options.

Issue Type

Feature Idea

Component Name

aws_ssm

Additional Information

https://github.com/ansible-collections/community.aws/blob/main/plugins/connection/aws_ssm.py#L73-L77

Code of Conduct

kepstin commented 6 months ago

With most methods of installing it, the session-manager-plugin binary can be found on the system $PATH. It would be really nice if by default the module ran the version found on the $PATH rather than require that you provide an absolute path.

This will involve setting the default plugin executable to just "session-manager-plugin" and removing the os.path.exists check. Additional error handling on the subprocess.Popen call might be needed so people get a useful error message if the plugin was not found.

chrismazanec commented 2 months ago

we use a lookup plugin as a workaround for that

ansible_aws_ssm_plugin: "{{ lookup('ansible.builtin.pipe', 'which session-manager-plugin') }}"