From ac2ca023c5666c2b4a8e01438dbda7037202fcbc Mon Sep 17 00:00:00 2001 From: Bikouo Aubin <79859644+abikouo@users.noreply.github.com> Date: Fri, 7 Feb 2025 13:54:37 +0100 Subject: [PATCH] Update connection/aws_ssm documentation (#2234) SUMMARY add a playbook to transfer file and run script into SSM managed node Closes #1012 ISSUE TYPE Docs Pull Request COMPONENT NAME connection/aws_ssm Reviewed-by: GomathiselviS Reviewed-by: Mark Chappell Reviewed-by: Markus Bergholz --- plugins/connection/aws_ssm.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/plugins/connection/aws_ssm.py b/plugins/connection/aws_ssm.py index e50c43e495d..2b0dcd82fa9 100644 --- a/plugins/connection/aws_ssm.py +++ b/plugins/connection/aws_ssm.py @@ -284,6 +284,38 @@ yum: name: nginx state: present + +--- +# Execution: ansible-playbook play.yaml -i ssm_inventory.ini +# ===================================================== +# ssm_inventory.ini +# [all] +# linux ansible_aws_ssm_instance_id=i-01234567829abcdef ansible_aws_ssm_region=us-east-1 + +# [all:vars] +# ansible_connection=community.aws.aws_ssm +# ansible_python_interpreter=/usr/bin/python3 +# local_tmp=/tmp/ansible-local-ssm-0123456 +# ansible_aws_ssm_bucket_name=my-test-bucket +# ansible_aws_ssm_s3_addressing_style=virtual +# ----------------------- +# Transfer file and run script on remote host +- name: Transfer file and Run script into SSM manage node + hosts: all + gather_facts: false + + tasks: + - name: Create shell script + ansible.builtin.copy: + mode: '0755' + dest: '/tmp/date.sh' + content: | + #!/usr/bin/env bash + date + + - name: Execute script from remote host + ansible.builtin.shell: + cmd: '/tmp/date.sh' """ import getpass import json