You should be able to do:
{{ grafana_datasources.json|map(attribute='name') }}
On Mon, Feb 1, 2016 at 9:20 AM, Yoel <[email protected]> wrote:
> Hi,
>
> my variable contains this Json
>
>
> "grafana_datasources.json": [
> {
> "access": "proxy",
> "basicAuth": false,
> "basicAuthPassword": "",
> "basicAuthUser": "",
> "database": "databaseName",
> "id": 2,
> "isDefault": false,
> "jsonData": null,
> "name": "InfluxDB1",
> "orgId": 1,
> "password": "user",
> "type": "influxdb",
> "url": "http://localhost:8086",
> "user": "myUser"
> },
> {
> "access": "proxy",
> "basicAuth": false,
> "basicAuthPassword": "",
> "basicAuthUser": "",
> "database": "databaseName2",
> "id": 3,
> "isDefault": false,
> "jsonData": null,
> "name": "InfluxDB2",
> "orgId": 1,
> "password": "user",
> "type": "influxdb",
> "url": "http://localhost:8086",
> "user": "myUser2"
> }
> ]
>
>
> How can i extract a list of "name attribute" ?
>
> Expected = ["InfluxDB1", "InfluxDB2"]
> I'm using ansible 1.9.2
>
>
> Thanks,
>
> Yoel
>
>
> --
> 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/c0afa79e-5bdf-4bda-b5ce-de564a2e78c5%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/c0afa79e-5bdf-4bda-b5ce-de564a2e78c5%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
Matt Martz
@sivel
sivel.net
--
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/CAD8N0v-zRZgoHja%3DpQchAEOn7RyX1z0RwDwt%3D-hd-LwPfwoOoA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.