我正在使用 Ansible,在运行我的 playbook 后收到此错误。
这是我的剧本:
---
- name: Set 192.168.122.4 Hostname
hosts: 192.168.122.4
gather_facts: false
become: true
tasks:
- name : Name 4
hostname:
name: ansible1.example.com
- name: Set 192.168.122.5 Hostname
hosts: 192.168.122.5
gather_facts: false
become: true
tasks:
- name : Name 5
hostname:
name: ansible2.example.com
- name: Manage Hosts File
hosts: all
gather_facts: true
become: true
tasks:
- name: Deploy Hosts Template
template:
src: hosts.j2
dest: /etc/hosts
Run Code Online (Sandbox Code Playgroud)
这是我的模板
# Managed by Ansible
127.0.0.1 localhost
{% for host in groups['all'] …Run Code Online (Sandbox Code Playgroud)