Skip to content

Instantly share code, notes, and snippets.

@spensireli
Created January 4, 2023 19:49
Show Gist options
  • Save spensireli/7fb9820bfd289b80b70cd2c1d76e945b to your computer and use it in GitHub Desktop.
Save spensireli/7fb9820bfd289b80b70cd2c1d76e945b to your computer and use it in GitHub Desktop.
SSM Send Command for GitHub and S3
source_info = {"owner":"spensireli","repository":"ssm-test","path":"ssm-test","tokenInfo":"{{ssm-secure:git-token}}", "getOptions":"branch:main"}
json_encoded_source_info = json.dumps(source_info)
try:
send_command = ssm_client.send_command(
InstanceIds=[resource_id],
DocumentName="AWS-ApplyAnsiblePlaybooks",
Parameters={"SourceType": ["GitHub"], "SourceInfo": [json_encoded_source_info], "PlaybookFile": ["someteam.yml"], "InstallDependencies": ["True"]}
)
source_info = {"path": "https://s3.amazonaws.com/spencers-world-famous-ansible-playbooks/ssm-test/"}
json_encoded_source_info = json.dumps(source_info)
try:
send_command = ssm_client.send_command(
InstanceIds=[resource_id],
DocumentName="AWS-ApplyAnsiblePlaybooks",
Parameters={"SourceType": ["S3"], "SourceInfo": [json_encoded_source_info], "PlaybookFile": ["someteam.yml"], "InstallDependencies": ["True"]}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment