From f22ca3b35dafa21d1b632710e6e2c04ca61c90e9 Mon Sep 17 00:00:00 2001 From: Michele Cereda Date: Thu, 8 Aug 2024 17:51:11 +0200 Subject: [PATCH] chore(kb/ssm): filters in ec2 ansible inventory files --- knowledge base/cloud computing/aws/ssm.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/knowledge base/cloud computing/aws/ssm.md b/knowledge base/cloud computing/aws/ssm.md index 16f4281..20b701d 100644 --- a/knowledge base/cloud computing/aws/ssm.md +++ b/knowledge base/cloud computing/aws/ssm.md @@ -146,6 +146,7 @@ aws ssm describe-instance-associations-status --instance-id 'instance-id' ## Integrate with Ansible Create a dynamic inventory which name ends with `aws_ec2.yml` (e.g. `test.aws_ec2.yml` or simply `aws_ec2.yml`).
+Refer the [amazon.aws.aws_ec2 inventory] for more information about the file specifications.
It needs to be named like that to be found by the ['community.aws.aws_ssm' connection plugin][community.aws.aws_ssm connection]. @@ -154,6 +155,11 @@ It needs to be named like that to be found by the plugin: aws_ec2 regions: - eu-east-2 +exclude_filters: + - tag-key: + - aws:eks:cluster-name # EKS nodes do not use SSM-capable images +include_filters: + - instance-state-name: running keyed_groups: - key: tags.Name # add hosts to 'tag_Name_' groups for each aws_ec2 host's 'Tags.Name' attribute @@ -288,6 +294,7 @@ $ sudo ssm-cli get-diagnostics --output 'table' [snippets]: ../../../snippets/aws/commands.fish +[amazon.aws.aws_ec2 inventory]: https://docs.ansible.com/ansible/latest/collections/amazon/aws/aws_ec2_inventory.html [aws_ssm connection plugin notes]: https://docs.ansible.com/ansible/latest/collections/community/aws/aws_ssm_connection.html#notes [community.aws.aws_ssm connection]: https://docs.ansible.com/ansible/latest/collections/community/aws/aws_ssm_connection.html [session manager preferences]: https://console.aws.amazon.com/systems-manager/session-manager/preferences