ajoo Posted March 20, 2020 Share Posted March 20, 2020 HI, I have been trying to create a passwordless user using Ansible. However it fails at the point where the SSH key is to be placed. Below is the playbook that I am using. Text --- - hosts: test1 become: yes tasks: - name: Make sure we have a 'wheel' group group: name: wheel state: present - name: Allow 'wheel' group to have passwordless sudo lineinfile: dest: /etc/sudoers state: present regexp: '^%wheel' line: '%wheel ALL=(ALL) NOPASSWD: ALL' validate: 'visudo -cf %s' - name: Add sudoers users to wheel group user: name: "adminn" groups: wheel append: yes state: present createhome: yes - name: Set up authorized keys for the adminn user authorized_key: user: adminn key: "{{ item }}" with_file: - /home/vagrant/.ssh/id_rsa.pub which ends giving the following error. Quote PLAY [test1] ************************************************************************************************************************* TASK [Gathering Facts] *************************************************************************************************************** ok: [test1] TASK [Make sure we have a 'wheel' group] ********************************************************************************************* ok: [test1] TASK [Allow 'wheel' group to have passwordless sudo] ********************************************************************************* changed: [test1] TASK [Add sudoers users to wheel group] ********************************************************************************************** changed: [test1] TASK [Set up authorized keys for the adminn user] ************************************************************************************ fatal: [test1]: FAILED! => {"changed": false, "msg": "Either user must exist or you must provide full path to key file in check mode"} to retry, use: --limit @/vagrant/ansible2/playbook.retry PLAY RECAP *************************************************************************************************************************** test1 : ok=4 changed=2 unreachable=0 failed=1 I have set up the system using vagrant wherein i have a control and node server with default user vagrant that already has a passwordless access from control to the node. This is a new user that I wish to create. I referred to this article . Hoping that someone can help me resolve this error. Thanks all ! Quote Link to comment https://forums.phpfreaks.com/topic/310330-creating-a-passwordless-user-on-a-centos7-using-ansible-fails/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.