- hosts: test.preprod.io gather_facts: no remote_user: ansible become: yes
tasks: - name: Create Users user: name: joe shell: /bin/bash
- name: Add user to the sudoers copy: dest: "/etc/sudoers.d/joe" content: "joe ALL=(ALL) NOPASSWD: ALL" - name: Deploy SSH Key authorized_key: user=joe key="{{ lookup('file', 'roles/manage-ssh-users/files/joe_id_rsa.pub') }}" state=presentfatal: [test.preprod.io]: FAILED! => { "changed": false, "module_stderr": "OpenSSH_7.4p1 Debian-10+deb9u6, OpenSSL 1.0.2u 20 Dec 2019\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 18482\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\nTraceback (most recent call last):\n File \"<stdin>\", line 113, in <module>\n File \"<stdin>\", line 105, in _ansiballz_main\n File \"<stdin>\", line 48, in invoke_module\n File \"/tmp/ansible_authorized_key_payload_bQp3_I/__main__.py\", line 678, in <module>\n File \"/tmp/ansible_authorized_key_payload_bQp3_I/__main__.py\", line 673, in main\n File \"/tmp/ansible_authorized_key_payload_bQp3_I/__main__.py\", line 572, in enforce_state\n File \"/tmp/ansible_authorized_key_payload_bQp3_I/__main__.py\", line 439, in parsekey\nIndexError: list index out of range\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 1\r\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}ansible@ansible:~$ ansible --versionansible 2.7.10.post0 config file = /home/ansible/ansible.cfg configured module search path = [u'/home/ansible/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible-2.7.10.post0-py2.7.egg/ansible executable location = /usr/local/bin/ansible python version = 2.7.13 (default, Sep 26 2018, 18:42:22) [GCC 6.3.0 20170516][defaults]inventory = ./hostslog_path = /var/log/ansible.logretry_files_enabled = False[privilege_escalation][paramiko_connection][ssh_connection]ssh_arg = -o ServerAliveInterval=30 -o ControlMaster=auto -o ControlPersist=60spipelining = True[accelerate][selinux][colors]--
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 ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/a9755b39-a860-4440-9509-f91ddf246325%40googlegroups.com.
I appreciate the suggestion though I don't believe that is the solution to my problem, right? I suppose I should have posted the actual playbook I'm working with. The one previously provided was just a test one.
- include_vars: users.yml- name: Create Users On VMs user: name="{{ item.username }}" with_items: "{{ users }}" #shell: /bin/bash #groups:
- name: Add .ssh Keys and Directories authorized_key: > user="{{item.username}}" key="{{ lookup('file', './files/{{ item.username}}_id_rsa.pub')}}" with_items: "{{ users }}"failed: [test.preprod.io] (item={u'username': u'joe'}) => { "changed": false, "item": { "username": "joe" }, "module_stderr": "OpenSSH_7.4p1 Debian-10+deb9u6, OpenSSL 1.0.2u 20 Dec 2019\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 22809\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\nTraceback (most recent call last):\n File \"<stdin>\", line 113, in <module>\n File \"<stdin>\", line 105, in _ansiballz_main\n File \"<stdin>\", line 48, in invoke_module\n File \"/tmp/ansible_authorized_key_payload_GKpQf3/__main__.py\", line 678, in <module>\n File \"/tmp/ansible_authorized_key_payload_GKpQf3/__main__.py\", line 673, in main\n File \"/tmp/ansible_authorized_key_payload_GKpQf3/__main__.py\", line 572, in enforce_state\n File \"/tmp/ansible_authorized_key_payload_GKpQf3/__main__.py\", line 439, in parsekey\nIndexError: list index out of range\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 1\r\n", --
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 ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/d41dc096-c6e8-4fa5-b31b-b495d3e8a4b1%40googlegroups.com.
>> To unsubscribe from this group and stop receiving emails from it, send an email to ansible...@googlegroups.com.
>> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/d41dc096-c6e8-4fa5-b31b-b495d3e8a4b1%40googlegroups.com.
>
> --
> 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 ansible...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/8815d333-4853-48a4-9358-abccb92ce9db%40googlegroups.com.
---# task file for manage_ssh_users- include_vars: users.yml- name: Create Users On VMs user: name="{{ item.username }}" with_items: "{{ users }}" shell: /bin/bash #groups:
- name: Add .ssh Keys and Directories authorized_key: > user="{{item.username}}" key="{{ lookup('file', './files/{{ item.username}}_id_rsa.pub')}}" with_items: "{{ users }}"ERROR! conflicting action statements: shell, user
The error appears to have been in '/home/ansible/roles/manage-ssh-users/tasks/ssh_users.yml': line 3, column 3, but maybe elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- include_vars: users.yml- name: Create Users On VMs ^ hereTo view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/8815d333-4853-48a4-9358-abccb92ce9db%40googlegroups.com.