gpt4 book ai didi

Ansible - 错误!字段 'hosts' 是必需的,但未设置

转载 作者:行者123 更新时间:2023-12-01 23:40:51 25 4
gpt4 key购买 nike

启动剧本时出现错误,但我不知道原因......

ERROR! the field 'hosts' is required but was not set

这是我的 main.yml :

---
- hosts: hosts
- vars:
- elasticsearch_java_home: /usr/lib/jmv/jre-1.7.0
- elasticsearch_http_port: 8443

- tasks:
- include: tasks/main.yml

- handlers:
- include: handlers/main.yml

还有我的/etc/ansible/hosts :

[hosts]
10.23.108.182
10.23.108.183
10.23.108.184
10.23.108.185

当我测试 ping 时,一切都很好:

[root@poste08-08-00 elasticsearch]# ansible hosts -m ping
10.23.108.183 | SUCCESS => {
"changed": false,
"ping": "pong" }
10.23.108.182 | SUCCESS => {
"changed": false,
"ping": "pong" }
10.23.108.185 | SUCCESS => {
"changed": false,
"ping": "pong" }
10.23.108.184 | SUCCESS => {
"changed": false,
"ping": "pong" }

请帮帮我:)问候,

最佳答案

您的剧本中有语法错误。

---
- hosts: webservers
vars:
http_port: 80
max_clients: 200

参见:https://docs.ansible.com/ansible/playbooks_intro.html

关于Ansible - 错误!字段 'hosts' 是必需的,但未设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36724870/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com