Are you able to do sudo without password
On Tue 22 May, 2018, 10:05 PM 'Kallu Srikanth' via Ansible Project, <
[email protected]> wrote:
>
> Hi Abhay i still have the error
>
> Code : -
> ---
> - hosts: dpie_prod
> user: dpiesa
> become: true
> become_method: enable
> tasks:
> - name: install telnet
> yum: pkg=telnet state=present update_cache=true
>
> ERROR:
>
> fatal: [lind01]: FAILED! => {"changed": false, "module_stderr": "Shared
> connection to lind01.\r\n", "module_stdout": "sudo: illegal option
> `-n'\r\nusage: sudo -h | -K | -k | -L | -l | -V | -v\r\nusage: sudo
> [-bEHPS] [-p prompt] [-u username|#uid] [VAR=value]\r\n {-i | -s
> | <command>}\r\nusage: sudo -e [-S] [-p prompt] [-u username|#uid] file
> ...\r\n", "msg": "MODULE FAILURE", "rc": 1}
>
> But I can run this successfully manually on a server like this without
> password
> #dpiesa@lind01:/home/dpiesa> sudo yum install telnet
>
> Also can become root like this
>
> dpiesa@lind01:/home/dpiesa> become
> root@lind01:/root>
> On Monday, May 21, 2018 at 10:59:42 PM UTC-5, abhay srivastava wrote:
>>
>> Try:
>>
>> - hosts: dpie_prod
>> user: dpiesa
>> become: True
>> tasks:
>> - name: install telnet
>> yum: pkg=telnet state=installed update_cache=true
>> # command: sudo yum install telnet -y
>>
>>
>>
>>
>> On Sat, May 19, 2018 at 12:56 AM, 'Kallu Srikanth' via Ansible Project <
>> [email protected]> wrote:
>>
>>> Hi,
>>>
>>> I highly appreciate if anybody can help, please
>>>
>>> ############### playbook ##################
>>>
>>> - hosts: dpie_prod
>>> user: dpiesa
>>> tasks:
>>> - name: install telnet
>>> yum: pkg=telnet state=installed update_cache=true
>>> # command: sudo yum install telnet -y
>>> become: yes
>>> become_user: root
>>> become_method: sudo
>>>
>>> The above does not work and throws this error
>>>
>>> TASK [install telnet]
>>> ****************************************************************************************************************************************
>>> [WARNING]: Module invocation had junk after the JSON data: usage: sudo
>>> -e [-S] [-p prompt] [-u username|#uid] file ...
>>>
>>> fatal: [lind01.corp.acxiom.net]: FAILED! => {"changed": false,
>>> "module_stderr": "Shared connection to lind01.corp.acxiom.net
>>> closed.\r\n", "module_stdout": "sudo: illegal option `-n'\r\nusage: sudo -h
>>> | -K | -k | -L | -l | -V | -v\r\nusage: sudo [-bEHPS] [-p prompt] [-u
>>> username|#uid] [VAR=value]\r\n {-i | -s | <command>}\r\nusage:
>>> sudo -e [-S] [-p prompt] [-u username|#uid] file ...\r\n", "msg": "MODULE
>>> FAILURE", "rc": 1}
>>> to retry, use: --limit
>>> @/home/dpiesa/playbooks/install_telnet.retry
>>>
>>>
>>> ##########################################################################################################################################################################
>>>
>>> But below works
>>>
>>> - hosts: dpie_prod
>>> user: dpiesa
>>> tasks:
>>> - name: install telnet
>>> command: sudo yum install telnet -y
>>>
>>>
>>> ########################################################################################################################################################################
>>>
>>> [dpiesa@cwypatch06 playbooks]$ ansible --version
>>> ansible 2.5.2
>>> config file = /etc/ansible/ansible.cfg
>>> configured module search path =
>>> [u'/home/dpiesa/.ansible/plugins/modules',
>>> u'/usr/share/ansible/plugins/modules']
>>> ansible python module location =
>>> /usr/lib/python2.7/site-packages/ansible
>>> executable location = /bin/ansible
>>> python version = 2.7.5 (default, Aug 4 2017, 00:39:18) [GCC 4.8.5
>>> 20150623 (Red Hat 4.8.5-16)]
>>>
>>>
>>> I think I am not using become options correctly can somebody help ??
>>>
>>> Thank you.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Ansible Project" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To post to this group, send email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ansible-project/2de5f3d4-b9b8-45be-b0c2-8941e4c55c52%40googlegroups.com
>>> <https://groups.google.com/d/msgid/ansible-project/2de5f3d4-b9b8-45be-b0c2-8941e4c55c52%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Regards,
>> Abhay Srivastava
>> ---------------------------
>> Mob-9160512000
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/573867fd-3869-4395-a0d1-7c20fb415e7c%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/573867fd-3869-4395-a0d1-7c20fb415e7c%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CAPKgz8VuD%3D-Kx_0bRiNrPO_TM8iXhoXNuJAOJQock0HA_WmyvA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.