Jason_query on setup

4 views
Skip to first unread message

Kiran Kumar

unread,
Apr 10, 2020, 3:48:06 AM4/10/20
to Ansible Project
I am looking to find vm with 4 CPUs , Please suggest what i am doing wrong 

---
## This playbook is for :

- name: Play with Jason Query for learning it 
  hosts: temp
  gather_facts: yes
  remote_user: root
  tasks:
    - name: Gather facts
      setup:
      register: vm_setup
    - name: Get VM where vCPU=4
      debug:
        msg: "{{ vm_info.results  | json_query(jmesquery) }}"
      vars:
        jmesquery: "[?ansible_processor_vcpus == '4'].ansible_hostname"
      with_items: "{{ vm_setup }}"

Reply all
Reply to author
Forward
0 new messages