-
Notifications
You must be signed in to change notification settings - Fork 403
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
Windows become fails when using aws_ssm connection #1952
Labels
jira
Adds the issue to cloud content backlog refinement jira board
Comments
softwarefactory-project-zuul bot
pushed a commit
that referenced
this issue
Jan 24, 2025
SUMMARY This PR adds the code suggested by @PatrickV-code on #1952 In short, connection to Windows based EC2 instances using aws_ssm connection and using the become option of runas fails every job. The job itself actually finishes, but as Powershell 5 adds additional wrapping with CLIXML information. Which makes the output unreadable for Ansible. ISSUE TYPE Bugfix Pull Request COMPONENT NAME aws_ssm Reviewed-by: Markus Bergholz <git@osuv.de> Reviewed-by: Alina Buzachis Reviewed-by: Bikouo Aubin
patchback bot
pushed a commit
that referenced
this issue
Jan 24, 2025
SUMMARY This PR adds the code suggested by @PatrickV-code on #1952 In short, connection to Windows based EC2 instances using aws_ssm connection and using the become option of runas fails every job. The job itself actually finishes, but as Powershell 5 adds additional wrapping with CLIXML information. Which makes the output unreadable for Ansible. ISSUE TYPE Bugfix Pull Request COMPONENT NAME aws_ssm Reviewed-by: Markus Bergholz <git@osuv.de> Reviewed-by: Alina Buzachis Reviewed-by: Bikouo Aubin (cherry picked from commit 044b8d8)
patchback bot
pushed a commit
that referenced
this issue
Jan 24, 2025
SUMMARY This PR adds the code suggested by @PatrickV-code on #1952 In short, connection to Windows based EC2 instances using aws_ssm connection and using the become option of runas fails every job. The job itself actually finishes, but as Powershell 5 adds additional wrapping with CLIXML information. Which makes the output unreadable for Ansible. ISSUE TYPE Bugfix Pull Request COMPONENT NAME aws_ssm Reviewed-by: Markus Bergholz <git@osuv.de> Reviewed-by: Alina Buzachis Reviewed-by: Bikouo Aubin (cherry picked from commit 044b8d8)
softwarefactory-project-zuul bot
pushed a commit
that referenced
this issue
Jan 27, 2025
This is a backport of PR #2080 as merged into main (044b8d8). SUMMARY This PR adds the code suggested by @PatrickV-code on #1952 In short, connection to Windows based EC2 instances using aws_ssm connection and using the become option of runas fails every job. The job itself actually finishes, but as Powershell 5 adds additional wrapping with CLIXML information. Which makes the output unreadable for Ansible. ISSUE TYPE Bugfix Pull Request COMPONENT NAME aws_ssm
@PatrickV-code I am not sure if I missed something, but I have created a new user and add it to the administrators group to allow default SSM user New-LocalUser -Name ansible (will prompt for password)
Get-LocalGroupMember -Group "Administrators" Then I ran the following playbook - name: Copy and Run script into SSM
hosts: aws_ssm
gather_facts: false
vars:
ansible_become_method: ansible.builtin.runas
ansible_become_user: ansible
ansible_runas_password: <redacted>
tasks:
- name: Run WhoAmI
ansible.windows.win_command:
cmd: whoami
become: true
register: become_value
- name: Debug
ansible.builtin.debug:
var: become_value with the following inventory file [aws_ssm_linux]
[aws_ssm_windows]
windows_i-02e5736e0485c64ac ansible_aws_ssm_instance_id=i-02e5736e0485c64ac ansible_aws_ssm_region=eu-west-2
[aws_ssm_linux:vars]
remote_tmp=/tmp/ansible-remote
action_prefix=ansible.builtin.
[aws_ssm_windows:vars]
ansible_shell_type=powershell
remote_tmp=c:/windows/temp/ansible-remote
action_prefix=ansible.windows.win_
[aws_ssm:children]
aws_ssm_linux
aws_ssm_windows
[aws_ssm:vars]
ansible_connection=community.aws.aws_ssm
ansible_aws_ssm_plugin=/usr/local/sessionmanagerplugin/bin/session-manager-plugin
ansible_python_interpreter=/usr/bin/python3
local_tmp=/tmp/ansible-local-aa0484bcd96a
ansible_aws_ssm_bucket_name=cf-templates-m0nzeh7sv334-us-west-2
# support tests that target testhost
[testhost:children]
aws_ssm The output is as expected
My EC2 instance is running on |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Summary
A similar issue has been reported on: ansible/ansible#67119
That is however on the main Ansible repo, while I have the feeling this is the more appropriate place.
In short, connection to Windows based EC2 instances using aws_ssm connection and using the become option of runas fails every job.
The job itself actually finishes, but as Powershell 5 adds additional wrapping with CLIXML information.
Which makes the output unreadable for Ansible.
adding the in the earlier mentioned issue does resolve the problem (the section that contains the CLIXML statement)
But as the posted on that item says, not sure what kind of possible side effects this causes......
Issue Type
Bug Report
Component Name
aws_ssm connection
Ansible Version
ansible [core 2.15.4]
config file = None
configured module search path = ['/Users//.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /opt/homebrew/Cellar/ansible/8.4.0/libexec/lib/python3.11/site-packages/ansible
ansible collection location = /Users//.ansible/collections:/usr/share/ansible/collections
executable location = /opt/homebrew/bin/ansible
python version = 3.11.5 (main, Aug 24 2023, 15:09:45) [Clang 14.0.3 (clang-1403.0.22.14.1)] (/opt/homebrew/Cellar/ansible/8.4.0/libexec/bin/python)
jinja version = 3.1.2
libyaml = True
Collection Versions
AWS SDK versions
latest aws client installed via brew.. not using pip
Configuration
OS / Environment
Target OS version = Windows Server 2022
AWS EC2 Instance
PowerShell 5 installed on target system (default version)
Steps to Reproduce
Expected Results
Expected result was that who am I would return the correct output.
As shown in the expected results, the task actually completes, but due to unhandled wrapping it fails.
Actual Results
Code of Conduct
The text was updated successfully, but these errors were encountered: