4
我有一個ansbile.cfg文件以及一個目錄中的主機文件。在同一個目錄中,我有一個test_playbook.yml文件。以下全部複製。當我運行ping(ad-hoc)命令時,我得到了一個成功的響應。然而,當我嘗試運行ansible-劇本命令,響應規定如下:運行完整的操作手冊時缺少主機信息
[WARNING]: Host file not found: testserver
[WARNING]: provided hosts list is empty, only localhost is available
skipping: no hosts matched
ansible.cfg
[defaults]
hostfile = hosts
remote_user = testuser
##private_key_file = .vagrant/machines/default/virtualbox/private_key
##host_key_checking = False
主機
[webservers]
testserver ansible_ssh_host=ec2-xx-xx-xxx-xxx.compute-1.amazonaws.com ansible_ssh_port=1234
test_playbook。 yml
---
- hosts: all
remote_user: testuser
become: yes
become_user: testuser
tasks:
- group:
name: devops
state: present
- name: create devops user with admin privileges
user:
name: devops
comment: "Devops User"
uid: 2001
groups: devops
,我運行的命令如下:
ansible-playbook test_playbook.yml -i testserver -vvv
響應:
什麼我可能已經配置錯誤任何想法?
工作將盡快SO讓我接受 - 謝謝。我需要指定清單文件名稱,而不是主機文件中指定的服務器名稱 –