以下消息是什么意思?
致命:[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
在安装新的包之前更新缓存和所有包。