Hello!
I would like to upload ssh keys to digitalocean, and register their ids,
like so:
- digital_ocean_sshkey: state=present "name={{item.value.name}}"
"ssh_pub_key={{lookup('file', item.value.file)}}"
client_id={{digitalocean_client_id}} api_key={{digitalocean_api_key}}
register: ssh_keys
with_dict: keys
I would expect ssh_keys.values to be a map based on the dict keys, but it
is an array.
ok: [127.0.0.1] => {
"ssh_key": {
"changed": false,
"msg": "All items completed",
"results": [
{
"changed": false,
"invocation": {
"module_args": "state=present \"name=Foo Key\"
\"ssh_pub_key=***\" client_id=*** api_key=***",
"module_name": "digital_ocean_sshkey"
},
"item": {
"key": "foo",
"value": {
"file": "~/.ssh/id_rsa2.pub",
"name": "Foo Key"
}
},
"ssh_key": {
"id": 604472,
"name": "Foo Key"
}
},
{
"changed": false,
"invocation": {
"module_args": "state=present \"name=MacBook\"
\"ssh_pub_key=***\" client_id=*** api_key=***",
"module_name": "digital_ocean_sshkey"
},
"item": {
"key": "macbook",
"value": {
"file": "~/.ssh/id_rsa.pub",
"name": "MacBook"
}
},
"ssh_key": {
"id": 599365,
"name": "MacBook"
}
}
]
}
}
Is it possible to transform that array into a map keyed by the dict keys,
so that the ssh key ids could be fetched like so:
ssh_keys.results.macosx.ssh_key.id
Thanks,
Akos Vandra
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CAHHcNoex9%3D1ORN2N0PgoTCVvOjGhjUr0kJnAGuaRrKbuRyeh-Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.