On 21. sep. 2017 17:20, Dave Florek wrote:
Hi Branko,

Thanks for the response. I only posted what was on line 20.

It's recommended to show everything, you'll get help a lot faster that way because the problem can be anywhere as you can see by my comments bellow.


Code:

---
- hosts: all

  become: yes

  vars_prompt:
   - name: "new_user"
   - prompt: "What is the name of the new user to create?"

You need to remove the dash in front of prompt, one list item contains name and prompt.


  tasks:
  - name: Create new user
    command: useradd {{ new_user }}


  - name: Generate new SSH pub/priv key for user
# Do you just have a file with a pasted public key for distribution or
auto-generate one?

You can't have a name: without a module, Ansible will fail.


  - name: Add user to local authorized_keys file
  - lineinfile:

You need to remove the dash in front of lineinfile.


        path: /home/"{{ new_user }}"/.ssh/authorized_keys

Remove the double quotes.


        state: present
        create: True
#       line: #Reference to what upper decision was
        group: {{ new_user }}
        owner: {{ new_user }}

When you have {{ after a colon you need to wrap them in single or double quotes like this "{{ new_user }}".


For some reason, when I reference the new user name as part of a path to
set a file, I get the requirement that the variable needs to be in quotes.
Any ideas?

I don't understand the problem, but maybe the comments about give you the answer if not show the code and the error message.


--
Kai Stian Olstad

--
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/b8e94527-9123-78ab-2751-8146053868c5%40olstad.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to