rust-lang / rust-lang/simpleinfra

AWS SSO legacy profile doesn't work with ansible

Open
#762 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HCL
Stars
178
Forks
107
Avg merge
15h 57m
Merged PRs (30d)
38

Description

When running aws sso login --profile legacy the apply script doesn't work.

For example, ./apply staging dev-desktop -u marcoieni fails with the following error:

fatal: [dev-desktop-staging.infra.rust-lang.org]: FAILED! => {"msg": "The conditional check 'datadog_api_key is not defined and datadog_manage_config' failed.
The error was: An unhandled exception occurred while templating '{{ vars_datadog_api_key }}'. Error was a <class 'ansible.errors.AnsibleError'>, original message: An unhandled exception occurred while templating '{{ ssm_all['datadog-api-key'] }}'.
Error was a <class 'ansible.errors.AnsibleError'>, original message: An unhandled exception occurred while templating '{{ lookup('aws_ssm', '/staging/ansible/all/', region='us-west-1', shortnames=true, bypath=true, recursive=true) }}'.
Error was a <class 'ansible.errors.AnsibleLookupError'>, original message: Failed to access SSM parameter path /staging/ansible/all/ (AccessDenied)\n\nThe error appears to be in '~/.ansible/roles/datadog.datadog/tasks/main.yml': line 17, column 3,
but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Fail if API key is missing\n  ^ here\n"}

By logging in with the aws-creds.py script, the apply script works as expected.

It would be nice to be able to use sso for everything and delete the aws-creds.py from the repo.

EDIT: when deleting aws-creds.py, also close https://github.com/rust-lang/simpleinfra/issues/27

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the ansible/apply script and reproduce the failure using aws sso login --profile legacy and ./apply staging dev-desktop -u marcoieni. Compare this with credentials from aws-creds.py, then inspect the aws_ssm lookup and issue #27. Done means the apply command works with SSO and the legacy credential script can be removed as requested.

Written by the indexing model from the issue text.

Assessment

Tech stack
ansible, aws
Domain
cloud, devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.