ansible-community / ansible-community/molecule-plugins
Support for AWS SSM connection
- Dominant language
- Python
- Stars
- 164
- Forks
- 113
- Avg merge
- 4d 20h
- Merged PRs (30d)
- 1
Description
Dear Folks,
I am using EC2 driver and want to use AWS SSM to connect to the instance as SSH is closed off on the images we use at our organization.
I believe the relevant code is here: https://github.com/ansible-community/molecule-plugins/blob/5ebdfc60e457d5303e45fb237840e6592b98715f/src/molecule_plugins/ec2/driver.py#L221
which only supports SSH and WinRM.
I can add another if statement here like this in the code but not sure this is the right approach
```python
if conn_opts.get("ansible_connection") == "community.aws.aws_ssm":
conn_opts["connection"] = "community.aws.aws_ssm"
conn_opts["user"] = "ssm-user"
```
Secondly, the `ansible_connection_options` function is called in `login_cmd_template` function where it looks like a command to be run in a terminal is returned.
Does this mean that I should return an AWS CLI SSM command from this function to enable login. This poses some issues because a profile and region may need to be sent in to enable access through SSM.
I hope someone can guide me in this regard and I am happy to contribute this code once I have got it working.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in src/molecule_plugins/ec2/driver.py around the referenced connection-handling code, then trace ansible_connection_options and login_cmd_template. Determine how AWS SSM should provide connection settings and whether login needs an AWS CLI command with profile and region support. Done means EC2 instances can use AWS SSM when SSH is unavailable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, python
- Domain
- cloud
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100