1
votes

I am trying to run this play book:

pi@rpi02:/etc/ansible/playbooks $ cat ntp.yml

---
- hosts: raspbian
  become: yes

  vars:
   ntp_server1: time.google.com

  tasks:
    - name: Ensure NTP (for time synclronization) is install
      apt: name=ntpdate state=latest update_cache=yes

    - name: Ensure ntpstat (to report the synchronisation state of the NTP daemon)
      apt: name=ntpstat state=latest update_cache=yes 

    - name: Start service ntpdate, if not started
      systemd: 
        name: ntp
        state: restarted
        enabled: yes

    - name: report the synchronisation state of the NTP daemon
      shell:
        name: ntpstat
# ...

Every things runs fine, except the last part. I get this error:

TASK [report the synchronisation state of the NTP daemon] ******************************************************************************************************************************************************** fatal: [rpi02.daquezada.net]: FAILED! => {"changed": false, "msg": "Unsupported parameters for (command) module: name Supported parameters include: _raw_params, _uses_shell, argv, chdir, creates, executable, removes, stdin, warn"} fatal: [rpi04.daquezada.net]: FAILED! => {"changed": false, "msg": "Unsupported parameters for (command) module: name Supported parameters include: _raw_params, _uses_shell, argv, chdir, creates, executable, removes, stdin, warn"} fatal: [rpi03.daquezada.net]: FAILED! => {"changed": false, "msg": "Unsupported parameters for (command) module: name Supported parameters include: _raw_params, _uses_shell, argv, chdir, creates, executable, removes, stdin, warn"} fatal: [rpi01.daquezada.net]: FAILED! => {"changed": false, "msg": "Unsupported parameters for (command) module: name Supported parameters include: _raw_params, _uses_shell, argv, chdir, creates, executable, removes, stdin, warn"} [WARNING]: Could not create retry file '/etc/ansible/playbooks/ntp.retry'. [Errno 13] Permission denied: u'/etc/ansible/playbooks/ntp.retry'

Please advise.

Thanks

1
What is wrong with the very clearly stated error message? Unsupported parameters for (command) module: name means you cannot use shell: name: ntpstat like that, as the fine manual will tell you - mdaniel

1 Answers

2
votes

You are using the shell module incorrectly as stated by the output:

Unsupported parameters for (command) module: name Supported parameters include: _raw_params, _uses_shell, argv, chdir, creates, executable, removes, stdin, warn

Your task looks like this:

   - name: report the synchronisation state of the NTP daemon
      shell:
        name: ntpstat

Should look like this:

   - name: report the synchronisation state of the NTP daemon
     shell: ntpstat