I am trying to install packages in ansible using playbook. For that i need to install some packages in yum and some in apt. The version of ansible i am using is:
root@server:~# ansible --version
ansible 2.6.0
when i try to run this playbook for yum, i get this error:
fatal: [centos]: FAILED! => {"changed": false, "module_stderr": "Shared connection to centos closed.\r\n",
"module_stdout": "sudo: a password is required\r\n",
"msg": "MODULE FAILURE", "rc": 1}
to retry, use: --limit @/root/test.retry
when i try to run this playbook for apt, i get this error:
fatal: [server]: FAILED! => {"changed": false, "module_stderr": "Shared connection to server closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n File \"/tmp/ansible_t9NeHG/ansible_module_apt.py\", line 269, in \r\n from ansible.module_utils.urls import fetch_url\r\n File \"/tmp/ansible_t9NeHG/ansible_modlib.zip/ansible/module_utils/urls.py\", line 95, in \r\n File \"/usr/lib/python2.7/dist-packages/urllib3/contrib/pyopenssl.py\", line 54, in \r\n import OpenSSL.SSL\r\n File \"/usr/lib/python2.7/dist-packages/OpenSSL/init.py\", line 8, in \r\n from OpenSSL import rand, crypto, SSL\r\n File \"/usr/lib/python2.7/dist-packages/OpenSSL/SSL.py\", line 118, in \r\n SSL_ST_INIT = _lib.SSL_ST_INIT\r\nAttributeError: 'module' object has no attribute 'SSL_ST_INIT'\r\n", "msg": "MODULE FAILURE", "rc": 1}
I have gone through various help posts, but this is the way they have suggested to run the playbook. Where am i making the mistakes? Could you please specify. Thank you in advance
module_stdout": "sudo: a password is required\r\n",
- the account you use for Ansible to log into your server is not configured to allowsudo
to be used without a password (or at all?) when you need to run commands that require root privileges. Either configure the required password in Ansible docs.ansible.com/ansible/latest/user_guide/… or set upsudo
on that machine with the NOPASSWD option