0

I'm trying to add privilege to Ansible node via Ansible server using "lineinfile" via ad-hoc command as ROOT :

ansible -i rec-apache.inv -m lineinfile -a "path=/etc/sudoers \
line ='ansible-node1 ALL=(ALL:ALL) NO PASSWD:ALL'" --become-method=su --become -K all

I got the following error

ERROR! this task 'lineinfile' has extra params, which is only allowed in the following modules:
shell, win_shell, include_vars, add_host, raw, include_role, meta, set_fact, include, 
import_tasks, script, import_role, include_tasks, group_by, command, win_command

I already did the key exchange and everything went good and right . This problems occurs only when I use root user in the server side. I know that I can do it using playbook ,but I'm interesting on the ad-hoc command. Thank you !

Rayanaay
  • 85
  • 1
  • 9

1 Answers1

0

A space after line in line ='...' might have cause Ansible to treat ='...' as a parameter, which is not supported. Try removing the space as: line='ansible-node1 ALL=(ALL:ALL) NO PASSWD:ALL'

seshadri_c
  • 6,906
  • 2
  • 10
  • 24