272 questions
2
votes
1
answer
98
views
How to parse multiple email addresses from json data in Ansible via map(regex_search) filter
I've been trying to parse email addresses from the below json data:
"msg": [
{
"fqdn": "www.westero.local",
"function": "",
...
1
vote
1
answer
124
views
How to sum up numbers across inventory?
CSV files on each host contain certain figures and I need to add them all up.
To that end, I find the matching files first, and invoke awk to parse the CSV content and output the per-host total.
Where ...
2
votes
1
answer
82
views
"INVALID_FUNCTION_ARGUMENT: Cannot unnest type: varchar" in Athena JSON
I have a requirement to print the following output:
matchId
rainyDate
sunnyDate
1
2024-09-04
2024-09-04
1
2024-09-11
2024-09-12
1
2024-09-18
2024-09-19
2
2024-10-04
2024-10-04
2
2024-10-11
3
There is ...
1
vote
3
answers
177
views
Grabbing all *el7* packages from Ansible Package facts
We are doing an In-Place Upgrade from RHEL 7 to RHEL 8 in my organization and we've come to find out that not all RHEL 7 packages are removed after an OS Upgrade. I've been asked to report on all RHEL ...
2
votes
1
answer
71
views
Ansible json_query move dictionary key/value to subkey that is a list
I'm trying to edit a dictionary in ansible with a one line json_query (and/or other filters), but something is wrong and I can't figure it out.
I have this structure (with example data)
seinfeld:
- ...
0
votes
2
answers
227
views
How to get access the last item of a JSON array using Newtonsoft.Json SelectToken method
Is there a way to get the last item of a JSON array using a JSON query only (in this case Newtonsoft.Json SelectToken method)?
I can not use the Last method from Newtonsoft.Json, as I get the query ...
0
votes
0
answers
90
views
using ansible facts or json_query, how do i get this mac address out of this json?
so i got json back from an openstack server query, but need to extract the mac address for the server. Getting the name and IP is easy enough but the mac address is hidden behind the vlan and a colon. ...
0
votes
1
answer
195
views
CLOB - Queries json array with IN operator
I'm working with DB2 using a "data" column containing a JSON object stored as a CLOB.
To simplify my scenario consider this (easier) example:
CREATE TABLE Students (
StudentID INT ...
-1
votes
1
answer
41
views
I am getting if 'data' in data and 'jobs' in data['data']: TypeError: argument of type 'NoneType' is not iterable this error [duplicate]
In this project we want to fetch metadata of UID and all the metadata has to convert into csv file so I want to add timebound to json query which has to fetch data within 24 hours but I encountered ...
1
vote
1
answer
109
views
A JMESPath query is giving the correct number of items but they are all null when using it in json_query filter of Ansible
I have a simple Ansible play where I want to call a REST endpoint several times. I want to filter the result: only orders where the total for a product is less than 1000. By comparing the number of ...
0
votes
1
answer
103
views
Piping to json_query in Ansible reveals no result?
I have an Ansible playbook that amongst other generates a Let's Encrypt certificate by cert-manager on my cluster server.
But I have to wait until the certificate is ready, before I can continue to ...
1
vote
1
answer
155
views
Extract JSON value with key containing dashes and provided via an Ansible variable
I am trying to retrieve a value from a JSON in Ansible, where the key contains dashes and is provided via a variable.
I have the following data in Ansible:
- set_fact:
data: >-
{
...
1
vote
1
answer
148
views
json_query not parsing registered variable containing JSON output with escaped double-quotes in Ansible
I have a cert creation tool that outputs certs like so:
{
"cert": "abc123......",
"id": 10,
"key": "abc123....."
}
The actual cert and ...
0
votes
1
answer
69
views
JPA query for json column search
{
"store_ids":[
{
"name":"Gupta General store",
"store_id":"SSC10000020"
},
{
"name":"...
0
votes
0
answers
73
views
Ansible - parse values from multiple lists in loop
So I have been scratching my head and I think the solution is easy but can not see the light :-)
I have this code which reads the registry and gets the MSSQL names:
- name: check for instances
...
0
votes
1
answer
372
views
JSONata: How to get all paths from the payload?
How to get all the paths of the input object and traverse it according to my wish.
One such use case is I want to convert the value of all except few fields/nested fields in a object to uppercase.
For ...
0
votes
1
answer
156
views
Ansible how to filter dict key with double colon ::
Trying to filter "10.17.101.149" with a json_query.
From this data:
{
"fact": {
"network::ipv4_address": "10.17.101.149",
"network": "...
0
votes
2
answers
91
views
Ansible - parse a list of nested dictionaries to create a new list
I have the following list of dictionaries
"tor_vlan_list": [
{
"switch_01": {
"Vlan1": {
"id": "1",
...
0
votes
2
answers
238
views
oracle 19, json query, with arbitrary json data
I need to do this with Oracle 19c.
I have arbitrary json data in a column of a table.
I mean, I dont know the names of attributes, not even the deep the data is...
Suppose that I can identify the json ...
0
votes
0
answers
94
views
Is there way/possible to use IN operator in JMESPath
I'm trying to compare the attributes of a JSON object based on condition. I.e.:
if is_encrypted = YES encryption.state == 'encrypted' or a[0].name in encrypted_list else NO
encrypted_list contains:
{
...
0
votes
1
answer
287
views
Add RegEx pattern inside JSON string using JSON_QUERY()
I have RegEx details table and I want to make array object. I am trying to make JSON using JSON_QUERY() then I getting error like:
"JSON text is not properly formatted. Unexpected character '&...
1
vote
1
answer
699
views
json_query get value for a random key with regex
I have a situation where I'm writing a playbook for changing attributes of virtual machine, and the input I get comes from an automation that outputs the following, which is then passed in extra_vars:
...
-1
votes
1
answer
46
views
Need to remove '-' from value data in dictionary from API output using Ansible
block:
- name: Retrieve Source Volumes List
uri:
url: "https://{{ dms_ip }}/api/source/volumes"
url_username: "{{ credential_dms.username }}"
...
1
vote
1
answer
163
views
Trying to filter arrays with json_query
I'm having issues using json_query to filter arrays that have a certain key value.
This is what shows as the API result when given the direct path to it.
ok: [localhost] => {
"msg": [
...
0
votes
1
answer
949
views
Ansible: Task giving error when trying to parse 'ansible_facts'
I am fairly new to Ansible and am trying to create a playbook that will look at my Docker Swarm machines, check what NFS shares are already mounted, mount specified NFS shares from a list if they are ...
1
vote
2
answers
403
views
Fetching JSON from SQL when a column is empty
I have a table in SQL Server to keep all of the users app reviews.
When the user reviews the app with 4 or 5 stars I recieve JSON like this one
{
"Calificacion": 5,
"...
1
vote
1
answer
509
views
Does JMESPath have an 'in' like operator, that will be true if a key's value is present in an array of strings?
Does JMESPath have an 'in' like operator, that will be true if a key's value is present in an array of strings?
Given the following snippet of data, (assume the number of items is much larger, and I ...
1
vote
1
answer
103
views
Ansible - Identify Key in dictionary when Key values are lists of dicts
I have the following dictionary
grouped:
10000:
- {Id: 10001, Name: North_America, Parent_Id: 10000, Type: Country}
10001:
- {Id: 10011, Name: Maine, Parent_Id: 10001, Type: State}
...
1
vote
1
answer
998
views
Using json_query in Ansible to sort through complex JSON
I've run into a frustrating problem with Ansible and trying to parse a complex JSON object.
I need to find the physical volume, logical volume, disk name, and partition name for the devices that are ...
0
votes
1
answer
258
views
Convert epoch time to datetime within JSON query not working in Ansible
I have a list of dictionaries and for all items in this list, I want to convert one key-value pair epoch time to datetime but I'm getting an error
"JMESPathError in json_query filter plugin:\...
-2
votes
1
answer
62
views
VS2022 Server Explorer and SSMS yield different query results
I have a SQl Server query defined as follows:
SELECT ROW_NUMBER() OVER (ORDER BY p.SKU) AS Id,
p.Id AS ProductId,
p.SKU,
'ImageURL' AS ImageURL,
p....
1
vote
1
answer
186
views
"contains" filter on json_query keeps returning all data instead of what is specific in the filter
I have the following data that I'm trying to filter:
"flags": [
"inhibitor"
],
......(some data here)....
"flags": [],
......(some other data ...
0
votes
1
answer
74
views
json-query to iterate through an array
I have the below JavaScript file. I want to iterate through the "data" object and print the "ami" values. However, the query is not working. 'result.value' is null. I am not sure ...
1
vote
1
answer
167
views
Parse and filter json output in Ansible via json_query
I have the below output that I'm trying to parse and filter:
- name: lvs
debug:
msg: "{{ ansible_lvm.lvs }}"
ok: [localhost] => {
"msg": {
"...
1
vote
2
answers
196
views
MYSQL json query where array is present in json field likes
I wonder if this query is possible using json query.
I need to select all records that have more than 3 values a like.
for example, I have an array [1,2,3,4,5,6].
Database record has:
# ["1",...
1
vote
2
answers
815
views
Extract "name" from the list of dicts in Ansible
I have the following dictionary:
"dict": [ { "name": "a", "surname": "b" }, { "name": "c", "surname": "d&...
1
vote
1
answer
148
views
Variables inside JSON Query - Ansible / Jinja filter
I am trying to use JSON query to dynamically generate lists
The state of the variables is:
fabric:
vrfs:
- name: VRF-A
description: Production-Network
id: 10001
vlan: 2002
...
0
votes
2
answers
224
views
Ansible to parse multiple fields and count the results for each unique combination
long time listener / first time caller.
In ansible, I’m using the json_query in jmespath and am unable to figure out how to make it do what i want exactly. If I have a blob of data like this about a ...
2
votes
2
answers
189
views
In T-SQL, why is the ISJSON function not filtering out bad data when used in a CTE?
I have a table with a varchar(max) column that stores JSON data and one of the records has an extra comma at the end of an array in the JSON. The following statement results in an error
Unexpected ...
0
votes
1
answer
339
views
Fetching object multiple levels in JSON array using JSON_QUERY in MariaDB do not work
I have the following table in a mariadb database
| model_id | model_name |model_json |
then on the field model_json I have the following json
{"class":"GraphLinksModel",
"...
0
votes
1
answer
184
views
Ansible extract value from json_query
I'm trying to extract the result from the value "mac_addr" and then register it (in this case 00:50:56:a2:57:c9)
The output I'm working with
"msg": [
{
"...
2
votes
2
answers
862
views
Using JSON DATA Without OPENJSON And Search by Value
[
{
"Level" : "S1",
"Major" : "Teknik Informatika"
},
{
"Level" : "SMA",
"...
0
votes
0
answers
56
views
JSON Query | URL Parameter | JSONPATH
I have an API below and I'm wondering how I can query the "name"? in the URL and also I'm trying to use this API with retrofit.
https://i.sstatic.net/kqZeV.jpg
{
"code": 200,
"...
0
votes
1
answer
223
views
Correct way to use JSON_Query() with an IN operator
I wanted to create a table using PIVOT operator in SQL Server by extracting data from a JSON object using JSON_QUERY(). But when I use JSON_QUERY() inside IN operator, syntax error is thrown.
DECLARE @...
0
votes
1
answer
538
views
Ansible - parsing a Json result with json_query
how are you doing ?
So, I am trying to extract two informations from a json. it is a response from API with all information about a specific server in a cloud plataform. So, with curl, I can show the ...
0
votes
1
answer
42
views
subquery results appends to all main query selected field
I'm writing a stored procedure to get list of IOT parameter data under a specific machine and the result of stored procedure should have a specific JSON format. the problem is, when I tried to add a ...
2
votes
3
answers
394
views
Getting the values of keys of Ansible JSON output
I have the following JSON data
{
"docker_compose_init_result": {
"changed": true,
"failed": false,
"services": {
"...
0
votes
1
answer
725
views
How to use json_query against a output stored in a registered variable in Ansible?
I am writing an Ansible role to fetch current details of Audit settings from SQL Server through ansible.windoww.win_powershell module. In doing so, I am trying to use json_query in Ansible that has ...
0
votes
0
answers
53
views
r json mongodb query $in operator syntax error due to double quotes?
I'm building a json query to pass to a mongodb database in R.
In one scenario, I have a vector of dates and I want to query the database to return all records which have a date in the relevant field ...
0
votes
1
answer
234
views
Arithmetic operation in json_query (syntax wrong) - Ansible
I have the following dictionary:
dict1: {x: 1, y: 2}
I want to add third value z that should be (x/y)*100, or in other words percentage.
This is the code I wrote, but something is wrong with the ...