Ansible 看不到主机列表或角色
Ansible not seeing host list or role
当我 运行 ansible-playbook -k configure-clish.yml 我得到以下错误:
我认为这不是语法问题,因为 Visual Studio 代码中没有显示语法问题。
[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_sid.gaia_fw1
的角色。确保该角色位于 /app/sandbox/playbooks/roles、/home/.ansible/roles、/usr/share/ansible/roles、/etc/ansible/roles 或 /app/sandbox/playbooks 中,并且您的问题应该已解决。
当我 运行 ansible-playbook -k configure-clish.yml 我得到以下错误:
我认为这不是语法问题,因为 Visual Studio 代码中没有显示语法问题。
[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_sid.gaia_fw1
的角色。确保该角色位于 /app/sandbox/playbooks/roles、/home/.ansible/roles、/usr/share/ansible/roles、/etc/ansible/roles 或 /app/sandbox/playbooks 中,并且您的问题应该已解决。