我在运行我的第一个 ansible playbook 时出现此错误(即我还不熟悉 ansible)
TASK: [Install packages] ******************************************************
failed: [default] => (item=@Development tools,git,curl,htop) => {"failed": true, "item": "@Development tools,git,curl,htop"}
msg: this module requires key=value arguments (['name=@Development', 'tools,git,curl,htop', 'state=present', 'update_cache=yes'])
FATAL: all hosts have already failed -- aborting
PLAY RECAP ********************************************************************
to retry, use: --limit @/Users/lukemackenzie/playbook.retry
default : ok=1 changed=0 unreachable=0 failed=1
Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.
剧本的相关部分:
tasks:
- name: Install packages
yum: name={{ item }} state=present update_cache=yes
with_items:
- "@Development tools"
- git
- curl
- htop
我尝试改编这个例子
我也尝试过“开发工具”。我认为我在剧本 yaml 中错误地转义了空格,但不确定如何正确执行此操作。
答案1
所需的命名是“@development-tools”,因此:
tasks:
- name: Install packages
yum: name={{ item }} state=present update_cache=yes
with_items:
- "@development-tools"
- git
- curl
- htop