diodonfrost / ansible-role-amazon-ssm Goto Github PK
View Code? Open in Web Editor NEWAnsible role for manage AWS system manager agent
License: Apache License 2.0
Ansible role for manage AWS system manager agent
License: Apache License 2.0
Role fails on Register on-premise host with SSM on Ubuntu 20.04 LTS and snap
allow_sudo: true
activation_id: "xxxxxxxx"
activation_code: "xxxxxxxx"
aws_region: "xx-xxxx-x"
TASK [diodonfrost.amazon_ssm : Linux/Darwin | Register on-premise host] ********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
ok: [xx.xx.xx.xx]
TASK [diodonfrost.amazon_ssm : Linux/Darwin | Register on-premise host] **************************************************************************************************************
fatal: [xx.xx.xx.xx]: FAILED! => {"changed": true, "cmd": ["/snap/amazon-ssm-agent/current/amazon-ssm-agent", "-register", "-code", "ilkIdTbal9WQXjpjjB08", "-id", "xxxxxxxx", "-region", "xx-xxxx-x"], "delta": "0:00:00.784650", "end": "2023-09-15 22:37:24.307265", "msg": "non-zero return code", "rc": 1, "start": "2023-09-15 22:37:23.522615", "stderr": "", "stderr_lines": [], "stdout": "Error occurred fetching the seelog config file path: open /etc/amazon/ssm/seelog.xml: no such file or directory\nInitializing new seelog logger\nNew Seelog Logger Creation Complete\n2023-09-15 22:37:23 WARN Error adding the directory '/etc/amazon/ssm' to watcher: no such file or directory\n2023-09-15 22:37:24 WARN Could not read InstanceFingerprint file: InstanceFingerprint does not exist\n2023-09-15 22:37:24 INFO No initial fingerprint detected, generating fingerprint file...\n2023-09-15 22:37:24 ERROR Registration failed due to error registering the instance with AWS SSM. InvalidActivation: ", "stdout_lines": ["Error occurred fetching the seelog config file path: open /etc/amazon/ssm/seelog.xml: no such file or directory", "Initializing new seelog logger", "New Seelog Logger Creation Complete", "2023-09-15 22:37:23 WARN Error adding the directory '/etc/amazon/ssm' to watcher: no such file or directory", "2023-09-15 22:37:24 WARN Could not read InstanceFingerprint file: InstanceFingerprint does not exist", "2023-09-15 22:37:24 INFO No initial fingerprint detected, generating fingerprint file...", "2023-09-15 22:37:24 ERROR Registration failed due to error registering the instance with AWS SSM. InvalidActivation: "]}
ansible [core 2.12.10]
Ubuntu 20.04.6 LTS
Not able to register an Ubuntu host where ssm agent was installed using SNAP.
Execute the role over an Ubuntu 20.04 host with activation_id
, activation_code
and aws_region
values.
- hosts: all
become: yes
roles:
- role: diodonfrost.amazon_ssm
vars:
aws_region: "{{ region }}"
activation_id: "{{ id }}"
activation_code: "{{ code }}"
Ubuntu host is registered in AWS SSM using the ssm_agent_bin as /snap/amazon-ssm-agent/current/amazon-ssm-agent
or snap run amazon-ssm-agent
It executes amazon-ssm-agent
for registering the instance but as it was installed using Snap, it is not able to find the file.
TASK [diodonfrost.amazon_ssm : Linux | Register on-premise host] ****************************************************************************************************************************************************************************************************************
fatal: [<ip>]: FAILED! => {"changed": false, "cmd": "amazon-ssm-agent -register -code <code> -id <id> -region <region>", "msg": "[Errno 2] No such file or directory: b'amazon-ssm-agent'", "rc": 2}
The reference to the osx specific community.general.launchd
in the handlers appears to break ansible-playbook.
Using a playbook that runs with the new role installed.
- name: Initialize common AWS configuration
hosts: all
become: true
roles:
- diodonfrost.amazon_ssm
Playbook parses and starts running successfully.
Executing Ansible: ansible-playbook -e packer_build_name="elasticsearch-6_x-x64" -e packer_builder_type=amazon-ebs --ssh-extra-args '-o IdentitiesOnly=yes' -v
No config file found; using defaults
ERROR! couldn't resolve module/action 'community.general.launchd'. This often indicates a misspelling, missing collection, or incorrect module path.
The error appears to be in '/builds/gas/trustkeeper-aws/ami/elasticsearch-6/roles/diodonfrost.amazon_ssm/handlers/main.yml': line 13, column 3, but may be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: Darwin | Restart amazon ssm agent
^ here
alpine linux
ansible 2.9.16
config file = None
configured module search path = ['/home/packer/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.8/site-packages/ansible
executable location = /usr/bin/ansible
python version = 3.8.5 (default, Jul 20 2020, 23:11:29) [GCC 9.3.0]
Ansible 2.10 changed the namespaces of builtin modules.
Run a basic playbook calling this role using Ansible 2.10+.
Not error out.
ERROR! couldn't resolve module/action 'win_service'. This often indicates a misspelling, missing collection, or incorrect module path.
The error appears to be in '/Users/xxx/ansible/playbooks/roles.galaxy/diodonfrost.amazon_ssm/handlers/main.yml': line 18, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: Windows | Restart amazon ssm agent
^ here
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.