"one of the following is required: name,list while executing handlers"

778 views
Skip to first unread message

Sameer Modak

unread,
Aug 10, 2017, 6:49:09 AM8/10/17
to Ansible Project
We are getting "one of the following is required: name,list" error on executing handlers on non sles servers 

skipping: [NESSTDDB01] => (item=ntp)
skipping: [NESSTDDB01] => (item=vim)
failed: [NESLTR10AJAWA01] (item=vim) => {"failed": true, "item": "vim", "msg": "one of the following is required: name,list"}
failed: [neslds12ainfo01] (item=vim) => {"failed": true, "item": "vim", "msg": "one of the following is required: name,list"}
failed: [NESLTR10AJAWA01] (item=ntp) => {"failed": true, "item": "ntp", "msg": "one of the following is required: name,list"}
failed: [neslds12ainfo01] (item=ntp) => {"failed": true, "item": "ntp", "msg": "one of the following is required: name,list"}

Below are the tasks and handlers main.yml file 

This is tasks main.yml
vi roles/basic/tasks/main.yml

- name: "Installing VIM and NTP"
  yum: name= {{ item }} state=present
  with_items:
  - vim
  - ntp
  when: ansible_distribution != "SLES"
  notify:
  - test  <-----------
==============================================

This is the handler file code 

cat roles/basic/handlers/main.yml
- name: test  <------------
  copy: src=/home/capfin.capgemini.fi/smodak/handtest.txt dst=/tmp/ owner=root mode=0777

Kai Stian Olstad

unread,
Aug 10, 2017, 1:32:11 PM8/10/17
to ansible...@googlegroups.com
On 10. aug. 2017 12:49, Sameer Modak wrote:
> This is tasks main.yml
> vi roles/basic/tasks/main.yml
>
> - name: "Installing VIM and NTP"
> yum: name= {{ item }} state=present

You can't have space in front or after the equal sign.
So correct syntax
yum: name={{ item }} state=present



--
Kai Stian Olstad

Sameer Modak

unread,
Aug 13, 2017, 8:09:42 AM8/13/17
to Ansible Project, ansible-pr...@olstad.com
Thanks Kai let for htis 
Reply all
Reply to author
Forward
0 new messages