Skip to content

Instantly share code, notes, and snippets.

@iamgini
Created August 21, 2020 06:19
Show Gist options
  • Save iamgini/3c9a5842676bf00aa10f13ed82d3aa81 to your computer and use it in GitHub Desktop.
Save iamgini/3c9a5842676bf00aa10f13ed82d3aa81 to your computer and use it in GitHub Desktop.
```
tasks:
- name: Display the JSON file and collect data
shell: cat {{ cve_json_file }}
register: result
- name: Save the Json data to a Variable
set_fact:
jsondata: "{{ result.stdout | from_json }}"
- name: setDomainName
set_fact:
domain_name: "{{ jsondata | json_query(jmesquery) }}"
vars:
jmesquery: 'domain.name'
- name: Server Names
set_fact:
servernames: "{{ jsondata | json_query(jmesquery) }}"
vars:
jmesquery: '*.servers[*].name'
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment