November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

Categories

November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

ansible-playbooks one of the following is required name list

Ansible implementation of one of the following is required: name,list

Perform playbooks

[root@controller playbook]# ansible-playbook package.yaml

Error message

[root@controller playbook]# ansible-playbook package.yaml
[WARNING]: While constructing a mapping from /root/ansible/playbook/package.yaml, line 11, column 5, found a duplicate dict key (name). Using last defined value only.

[WARNING]: Ignoring invalid attribute: state

PLAY [app] ****************************************************************************************************************************************************************************************************************************************************************

TASK [Gathering Facts] ****************************************************************************************************************************************************************************************************************************************************
ok: [node2.rmohan.com]

TASK [Upgrade all packages] ***********************************************************************************************************************************************************************************************************************************************
ok: [node2.rmohan.com]

TASK [install epel-release] ***********************************************************************************************************************************************************************************************************************************************
skipping: [node2.rmohan.com]

TASK [{{ item }}] *********************************************************************************************************************************************************************************************************************************************************
failed: [node2.rmohan.com] (item=libselinux-python) => {“changed”: false, “item”: “libselinux-python”, “msg”: “one of the following is required: name,list”}
failed: [node2.rmohan.com] (item=docker-python) => {“changed”: false, “item”: “docker-python”, “msg”: “one of the following is required: name,list”}
failed: [node2.rmohan.com] (item=python-yaml) => {“changed”: false, “item”: “python-yaml”, “msg”: “one of the following is required: name,list”}
failed: [node2.rmohan.com] (item=net-tools) => {“changed”: false, “item”: “net-tools”, “msg”: “one of the following is required: name,list”}
failed: [node2.rmohan.com] (item=nfs-utils) => {“changed”: false, “item”: “nfs-utils”, “msg”: “one of the following is required: name,list”}
failed: [node2.rmohan.com] (item=mc) => {“changed”: false, “item”: “mc”, “msg”: “one of the following is required: name,list”}
failed: [node2.rmohan.com] (item=vim) => {“changed”: false, “item”: “vim”, “msg”: “one of the following is required: name,list”}
failed: [node2.rmohan.com] (item=wget) => {“changed”: false, “item”: “wget”, “msg”: “one of the following is required: name,list”}
failed: [node2.rmohan.com] (item=git) => {“changed”: false, “item”: “git”, “msg”: “one of the following is required: name,list”}
failed: [node2.rmohan.com] (item=ntp) => {“changed”: false, “item”: “ntp”, “msg”: “one of the following is required: name,list”}
failed: [node2.rmohan.com] (item=telnet) => {“changed”: false, “item”: “telnet”, “msg”: “one of the following is required: name,list”}
failed: [node2.rmohan.com] (item=mtr) => {“changed”: false, “item”: “mtr”, “msg”: “one of the following is required: name,list”}
failed: [node2.rmohan.com] (item=htop) => {“changed”: false, “item”: “htop”, “msg”: “one of the following is required: name,list”}
failed: [node2.rmohan.com] (item=iotop) => {“changed”: false, “item”: “iotop”, “msg”: “one of the following is required: name,list”}
failed: [node2.rmohan.com] (item=mailx) => {“changed”: false, “item”: “mailx”, “msg”: “one of the following is required: name,list”}
to retry, use: –limit @/root/ansible/playbook/package.retry

PLAY RECAP ****************************************************************************************************************************************************************************************************************************************************************
node2.rmohan.com : ok=2 changed=0 unreachable=0 failed=1

Playbooks written

– name: Install zabbix agent
yum: name={{item}} state=present
with_items:
– libselinux-python
– docker-python
– python-yaml
– net-tools
– nfs-utils
– mc
– vim
– wget
– git
– ntp
– telnet
– mtr
– htop
– iotop
– mailx
tags: install

Troubleshoot

Carefully looked down and found no spaces, no spaces, no spaces. Change it to something like this

– name: Install zabbix agent
yum: name={{ item }} state=present
– name: Install system packages.
yum: name={{ item }} state=present
with_items:
– libselinux-python
– docker-python
– python-yaml
– net-tools
– nfs-utils
– mc
– vim
– wget
– git
– ntp
– telnet
– mtr
– htop
– iotop
– mailx
tags: install

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>