I have an ansible playbook which runs following task from a jenkins job
- name: printing get caller
shell: "aws sts get-caller-identity"
register: var_caller
- debug:
msg: "{{var_caller.stdout}}"
And returns the following output
ok: [local-server] => {
"msg": {
"Account": "8693XXXXXX",
"Arn": "arn:aws:iam::8693XXXXXX:user/user-A",
"UserId": "AIDAJEXXXXXXXXXX"
}
}
And when i run the same command manually from command line, it gives assumed-role output and account-id is also different
[root@local-server] aws sts get-caller-identity
{
"UserId": "AROAZXXXXXXXX:i-01143d8XXXXXXX",
"Account": "653XXXXXXX",
"Arn": "arn:aws:sts::653XXXXXXX:assumed-role/role-A/i-01143d8XXXXXXX"
}
Isn't it supposed to return the same thing? What could be the misconfiguration here?
NOTE : I'm not using any kind of aws credentials, the ec2 local-server
has IAM Role assigned role-A
.