cisagov / ansible-role-amazon-ssm-agent

An Ansible role for installing aws/amazon-ssm-agent
Creative Commons Zero v1.0 Universal
8 stars 4 forks source link

Role fails against ARM-based devices #52

Closed strophy closed 4 months ago

strophy commented 6 months ago

🐛 Summary

Deploy fails against ARM-based devices due to hardcoded package URL, which naively assumes only amd64 targets exist.

To reproduce

Steps to reproduce the behavior:

  1. Deploy to Raspberry Pi target
  2. Observe error: msg: Wrong architecture 'amd64' -- Run dpkg --add-architecture to add it and update afterwards

Expected behavior

I expect the role to support the same set of architectures as SSM Agent itself

Any helpful log output or screenshots

Call the role like this:

- name: Install Amazon SSM agent
  ansible.builtin.include_role:
    name: amazon-ssm-agent
TASK [Install Amazon SSM agent] **************************************************************************************************************************************************************************************

TASK [amazon-ssm-agent : Load var file with package names based on the OS type] **************************************************************************************************************************************
ok: [pi]

TASK [amazon-ssm-agent : Load tasks file with install tasks based on the OS type] ************************************************************************************************************************************
included: /home/leon/.ansible/roles/amazon-ssm-agent/tasks/install_Debian.yml for pi

TASK [amazon-ssm-agent : Download and install amazon-ssm-agent deb package] ******************************************************************************************************************************************
fatal: [pi]: FAILED! => changed=false 
  msg: Wrong architecture 'amd64' -- Run dpkg --add-architecture to add it and update afterwards
strophy commented 6 months ago

Temporary workaround is to call the role like this:

- name: Get deb architecture
  ansible.builtin.command:
    cmd: dpkg --print-architecture
  register: deb_architecture
  changed_when: deb_architecture.rc == 0

- name: Install SSM Agent
  ansible.builtin.include_role:
    name: amazon-ssm-agent
  vars:
    package_url: '{{ "https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/debian_" + deb_architecture.stdout + "/amazon-ssm-agent.deb" }}'
jsf9k commented 6 months ago

Thank you for the issue!

I plan to update cisagov/skeleton-ansible-role to handle ARM. I have a proof-of-concept PR that needs to be updated.

Once the changes are made to the skeleton repo they will flow down to all the cisagov/ansible-role-* repos (including this one) via cisagov/action-lineage.

jsf9k commented 6 months ago

cisagov/skeleton-ansible-role#174 has been updated and is out for review.

jsf9k commented 4 months ago

Resolved by #54.