Ansible看不到主机列表或角色
当我运行ansible playbook-k configure-clish.yml时,会出现以下错误: 我认为这不是语法问题,因为VisualStudio代码中没有语法问题Ansible看不到主机列表或角色,ansible,ansible-inventory,Ansible,Ansible Inventory,当我运行ansible playbook-k configure-clish.yml时,会出现以下错误: 我认为这不是语法问题,因为VisualStudio代码中没有语法问题 [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' ERROR! the role 'ashwin_sid.gaia_fw1'
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
ERROR! the role 'ashwin_sid.gaia_fw1' was not found in /app/sandbox/playbooks/roles:/home/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:/app/sandbox/playbooks
The error appears to be in '/app/sandbox/playbooks/configure-clish.yml': line 25, column 16, but may
be elsewhere in the file depending on the exact syntax problem.
令人不快的一行似乎是:
'import_role:
name: ashwin_sid.gaia_fw1
^ here'
这是剧本:
- hosts: localhost
tasks:
- command: /bin/echo "{{ lookup('pipe','date +%Y-%m-%d_%H-%M') }}"
register: foo
- file:
path: ../SHOW
state: directory
- hosts: ckp
serial: 1
gather_facts: no
tasks:
- name: SHOW COMMAND
import_role:
name: ashwin_sid.gaia_fw1
tasks_from: setclish
vars:
cmdfile: configure-clish.cmd
logdir: ../SHOW
这是主机文件:
[ckp]
lab ansible_host=192.168.2.1
这是ansible.cfg文件:
[defaults]
roles_path = /app/sandbox/roles/ashwin_sid.gaia_fw1
inventory = /app/sandbox/hosts
host_key_checking = False
retry_files_enabled = False
正如错误所说,您没有名为
ashwin\u sid.gaia\u fw1
的角色。确保角色位于/app/sandbox/playbooks/roles、/home/.ansible/roles、/usr/share/ansible/roles、/etc/ansible/roles或/app/sandbox/playbooks中,并且您的问题应该得到解决