首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >不可推拉:什么是‘致命的:[localhost]:false!=> {"changed":false,"msg":“需要下列之一:名称,列表”}?

不可推拉:什么是‘致命的:[localhost]:false!=> {"changed":false,"msg":“需要下列之一:名称,列表”}?
EN

Server Fault用户
提问于 2018-08-22 16:55:46
回答 1查看 8K关注 0票数 0

What以下消息是否意味着?

致命::失败!=> {“更改”:false,"msg":“需要下列之一:名称,列表”}

The场景:

我跑:

代码语言:javascript
复制
$ sudo ansible-pull -C ${user}/ansible -U https://github.com/${user}/${company}/ansible.git

我得到:

代码语言:javascript
复制
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  

其中:

代码语言:javascript
复制
$ cat local.yml 
- hosts: localhost
  become: true
  pre_tasks:
    - name: update repositories
      yum: update_cache=yes
      changed_when: False

  tasks:
    - include: tasks/packages.yml

代码语言:javascript
复制
$ cat tasks/packages.yml
  - name: Install packages
    yum: name={{item}}
    with_items:
    - vim
    - htop
    - mc
    - byobu
EN

回答 1

Server Fault用户

回答已采纳

发布于 2018-08-22 17:03:31

使用yum模块的预任务需要参数namelist。不能单独使用参数update_cache

例如,您可以使用:

代码语言:javascript
复制
yum:
  name: '*'
  state: latest
  update_cache: yes

在安装新包之前更新缓存和所有包。

票数 1
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/927538

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档