小编Jot*_*ota的帖子

尝试在剧本中注册输出时未定义变量

我正在尝试使用 F5 池查询的输出注册一个变量,但收到此错误:

"<type 'list'>": "VARIABLE IS NOT DEFINED!", 
Run Code Online (Sandbox Code Playgroud)

我做错了什么?任何帮助表示赞赏。谢谢!

---
- name: GRAB F5 FACTS
  hosts: f5
  connection: local
  gather_facts: no
  tasks:
    - name: Collect BIG-IP facts
      bigip_device_facts:
        gather_subset: ltm-pools
        provider: "{{ prov }}"
      register: bigip_device_facts

    - name: FACTS OUTPUT
      debug:
        var: "{{ item.members | rejectattr('state', 'match', '^present$') | map(attribute='name') | list }}"
      register: jkout
      with_items: "{{ bigip_device_facts.ltm_pools }}" 
      when: item.full_path  == "/Common/mypool"

    - name: Set a variable
      debug:
        msg: "jkvar={{ jkout }}"
Run Code Online (Sandbox Code Playgroud)

ansible ansible-facts

7
推荐指数
1
解决办法
3万
查看次数

标签 统计

ansible ×1

ansible-facts ×1