通过ansible获取yum更新列表失败

问题描述 投票:-1回答:1
- hosts: all
  gather_facts: false
  become: yes
  user: username

  tasks:
  - name: List Available Patches (Non-Kernel)
    yum:
     list: updates
     update_cache: true
     exclude: kernel*
     register: yumoutput

  - debug: msg="{{ inventory_hostname}} {{ yumoutput.results }}"

味精:

Unsupported parameters for (yum) module: register Supported parameters 
include: allow_downgrade, bugfix, conf_file, disable_gpg_check, 
disable_plugin, disablerepo, enable_plugin, enablerepo, exclude, 
install_repoquery, installroot, list, name, security, skip_broken, state, 
update_cache, update_only, validate_certs

to retry, use:
ansible --version
ansible 2.6.5

2.7.5版本的相同问题。

linux ansible yum
1个回答
0
投票

这似乎是一个缩进错误。 register必须与yum在同一列。

- hosts: all
  gather_facts: false
  become: yes
  user: username

  tasks:
  - name: List Available Patches (Non-Kernel)
    yum:
      list: updates
      update_cache: true
      exclude: kernel*
    register: yumoutput

  - debug: msg="{{ inventory_hostname}} {{ yumoutput.results }}"
© www.soinside.com 2019 - 2024. All rights reserved.