小编3am*_*_92的帖子

该任务包含一个带有未定义变量的选项

我有下面的 vars 文件和 Ansible 任务,它允许防火墙上特定源 IP 的某些端口。

但由于某种原因,每当我运行该任务时,我都会收到此错误:

FAILED! => {"msg": "The task includes an option with an undefined variable.

尽管我能够使用debugAnsible 模块回显这些变量,但基本上我无法在此任务中专门使用这些变量。

Ansible 任务:

---
- name:
  firewalld:
    permanent: yes
    port: "{{ item.0 }}"
    state: enabled
    zone: public
    source: "{{ item.1 }}"
    with_nested: 
      - "{{ ports }}"
      - "{{ ips }}"
Run Code Online (Sandbox Code Playgroud)

变量文件:

ports:
  - "8000/tcp"
  - "9997/tcp"
  - "8181/tcp"
  - "8080/tcp"
  - "8191/tcp"
  - "8088/tcp"
  - "8065/tcp"
  
ips:
  - "192.168.210.30/32"
  - "192.168.210.35/32"
  - "192.168.210.40/32"
  - "192.168.210.31/32"
  - "192.168.210.36/32" …
Run Code Online (Sandbox Code Playgroud)

variables loops ansible centos7 firewalld

4
推荐指数
1
解决办法
2万
查看次数

标签 统计

ansible ×1

centos7 ×1

firewalld ×1

loops ×1

variables ×1