注册某些数据时,如何从invocation.module_args中检索变量?

时间:2019-01-29 18:37:56

标签: ansible

当我这样做时:

- name: get snapshot

  vmware_guest_snapshot_facts:

     hostname: "{{ fe_rhel_maj_template_vw__vc_drv }}"

     username: "{{ vcenter_ad_rw.username }}"

     password: "{{ vcenter_ad_rw.password }}"

     datacenter: "{{ fe_rhel_maj_template_vw__cluster_drv }}"

     folder: "{{ fe_rhel_maj_template_vw__cluster_drv }}"

     name: lphost

  register: snapshot_facts_lin_win

我检索到此:

{

    "_ansible_parsed": true,

    "invocation": {

        "module_args": {

            "username": "xxx@xxx.xxx",

            "datacenter": "xxx",

            "name": "lphost",

            "hostname": "xxxfff@xxx.xxx",

            "folder": "yyyyyy",

            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",

            "validate_certs": true,

            "port": 443,

            "uuid": null

        }

    },

    "changed": false,

    "_ansible_no_log": false,

    "guest_snapshots": {

        "current_snapshot": {

            "id": 1,

            "state": "poweredOff",

            "creation_time": "2018-11-06T14:39:40.431223+00:00",

            "description": "",

            "name": "Pré-CIS"

        },

        "snapshots": [

            {

                "id": 1,

                "state": "poweredOff",

                "creation_time": "2018-11-06T14:39:40.431223+00:00",

                "description": "",

                "name": "Pré-CIS"

            }

        ]

    }

}

我能够从guest_snapshots结构中检索数据,但不能从invocation结构中检索数据...

是否有任何方法可以检索和匹配guest_snapshotsinvocation,尤其是invocation.module_args.name

1 个答案:

答案 0 :(得分:0)

不。 invocation是一个内部字段,Ansible将该字段从注册结果中删除。

否则,它可以用来窃取密码等敏感数据。

相关问题