![ansible-pull:`fatal: [localhost]: FAILED! => {"changed": false, "msg": "one of the following is required: name, list"}` 是什么意思?](https://linux22.com/image/726133/ansible-pull%EF%BC%9A%60fatal%3A%20%5Blocalhost%5D%3A%20FAILED!%20%3D%3E%20%7B%22changed%22%3A%20false%2C%20%22msg%22%3A%20%22one%20of%20the%20following%20is%20required%3A%20name%2C%20list%22%7D%60%20%E6%98%AF%E4%BB%80%E4%B9%88%E6%84%8F%E6%80%9D%EF%BC%9F.png)
以下消息是什么意思?
致命:[localhost]:失败!=> {“changed”: false,“msg”:“需要以下之一:name,list”}
场景:
我跑:
$ sudo ansible-pull -C ${user}/ansible -U https://github.com/${user}/${company}/ansible.git
我得到:
Starting Ansible Pull at 2018-08-22 09:31:09
/bin/ansible-pull -C ${user}/ansible -U https://github.com/${user}/${company}/ansible.git
[WARNING]: Could not match supplied host pattern, ignoring: main
localhost [WARNING]| SUCCESS : Your git=> {
" version iafter": "fs too old 737822b1d4to fully s01e8f0c3b3upport the1a033be175 depth argcc1634b1c"ument.
Fal,
"beling back fore": "f7to full ch37822b1d40eckouts.
1e8f0c3b31a033be175cc1634b1c",
"changed": false,
"remote_url_changed": false
}
[WARNING]: provided hosts list is empty, only localhost is available. Note
that the implicit localhost does not match 'all'
[WARNING]: Could not match supplied host pattern, ignoring: main
PLAY [localhost] ***************************************************************
TASK [Gathering Facts] *********************************************************
ok: [localhost]
TASK [update repositories] *****************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "one of the following is required: name, list"}
to retry, use: --limit @/root/.ansible/pull/main/local.retry
PLAY RECAP *********************************************************************
localhost : ok=1 changed=0 unreachable=0 failed=1
在哪里:
$ cat local.yml
- hosts: localhost
become: true
pre_tasks:
- name: update repositories
yum: update_cache=yes
changed_when: False
tasks:
- include: tasks/packages.yml
和
$ cat tasks/packages.yml
- name: Install packages
yum: name={{item}}
with_items:
- vim
- htop
- mc
- byobu
答案1
使用 yum 模块的预任务需要参数name
或list
。您不能update_cache
单独使用 参数。
你可以使用例如:
yum:
name: '*'
state: latest
update_cache: yes
在安装新的包之前更新缓存和所有包。