Hello,
I need to collect some hostnames from a MariaDB database but don't know
exactly how to properly parse the result of my query... Could somebody help?
This how the tasks look like:
- name: Collect devices in down state
community.mysql.mysql_query:
login_db: cacti
query: SELECT hostname FROM host WHERE status=1
login_unix_socket: /run/mysqld/mysqld.sock
register: cacti_query
- name: print query result
debug:
msg: "{{ cacti_query.query_result }}"
And this is the output:
ok: [xxxxxxxxx] => {
"msg": [
[
{
"hostname": "host_A"
},
{
"hostname": "host_B"
},
{
"hostname": "host_C"
},
{
"hostname": "host_D"
}
]
]
}
How could I create a list with just the actual host names "host_A host_*B *
host_C host_D" to be used/referenced in a loop further down my playbook?
Thanks a lot,
Alex
[image: Edmonton_sig_RGB_S.jpg]
Alex Wanderley
Application and Infrastructure Analyst II
Acting Team Lead Server Solutions & Automation
Financial and Corporate Services | Open City and Technology
780-496-4156 Office
780-819-0273 Mobile
City of Edmonton
Century Place, 19th Floor
9803 102A Avenue NW
Edmonton AB, T5J 3A3
All information contained in this email post is proprietary to the City of
Edmonton, confidential and intended only for the addressed recipient. If
you have received this post in error, please disregard the contents, inform
the sender of the misdirection, and remove it from your system. The
copying, dissemination or distribution of this email, if misdirected, is
strictly prohibited.
--
*The contents of this message and any attachment(s) are confidential,
proprietary to the City of Edmonton, and are intended only for the
addressed recipient. If you have received this in error, please disregard
the contents, inform the sender of the misdirection, and remove it from
your system. The copying, dissemination, or distribution of this message,
if misdirected, is strictly prohibited.*
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CADp8UUT3QEAO38EO6tEN-eLNZ6YYPi-Q75sXE_mOOzuJyD4gSA%40mail.gmail.com.