Templates Ansible模板与\u项冲突
我想使用模板在/etc/network/interfaces.d中创建配置文件/ 但我在模板任务中使用_项时出错 我不确定ansible_host.networks是否包含_项 谢谢 Inventory.yml:Templates Ansible模板与\u项冲突,templates,ansible,jinja2,Templates,Ansible,Jinja2,我想使用模板在/etc/network/interfaces.d中创建配置文件/ 但我在模板任务中使用_项时出错 我不确定ansible_host.networks是否包含_项 谢谢 Inventory.yml: proxmoxve: # group hosts: virtu: networks: internet: interface: enp9s0 mode:
proxmoxve: # group
hosts:
virtu:
networks:
internet:
interface: enp9s0
mode: manual
type: interface
openvswitch:
interface: vmbr1
mode: static
type: ovs_bridge
sauv:
networks:
internet:
interface: enp38s0
mode: manual
type: interface
openvswitch:
interface: vmbr1
mode: static
type: ovs_bridge
Playbook.yml:
---
- hosts: proxmoxve
tasks:
- name: "Install openvswitch with fresh cache"
apt:
name: openvswitch-switch
state: present
update_cache: yes
- name: "Set internet interfaces"
template:
src: templates/interfaces.j2
dest: "/etc/network.interfaces.d/{{ item.interface }}"
whith_items: "{{ ansible_host.networks }}"
错误:
ERROR! conflicting action statements: template, whith_items
The error appears to be in '/home/yanux/dev/ansible-proxmoxve/proxmoxve_config_networks.yml': line 10, column 5, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: "Set internet interface to manual"
^ here
似乎有一个输入错误:
whith_items
应该是with_items