Hi Branko,
Thanks for the response. I only posted what was on line 20. I'm noticing a
general issue where if I double-bracket variables, even as Ansible
instructs me, I still receive error messages. I'm using Ansible version
2.1.1.0.
Code:
*---*
*- hosts: all*
* become: yes*
* vars_prompt:*
* - name: "new_user"*
* - prompt: "What is the name of the new user to create?"*
* 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?*
* - name: Add user to local authorized_keys file*
* - lineinfile:*
* path: /home/"{{ new_user }}"/.ssh/authorized_keys*
* state: present*
* create: True*
*# line: #Reference to what upper decision was*
* group: {{ new_user }}*
* owner: {{ 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?
On Thu, Sep 21, 2017 at 6:01 AM, Branko Majic <[email protected]> wrote:
> On Tue, 19 Sep 2017 10:13:37 -0700 (PDT)
> Dave Florek <[email protected]> wrote:
>
> > *Error message I get at execution:*
> >
> > ERROR! Syntax Error while loading YAML.
> >
> >
> > The error appears to have been in
> > '/opt/ansible/setup_scripts/create_user.yml': line 20, column 1, but
> > may be elsewhere in the file depending on the exact syntax problem.
>
> It can easily happen to be an issue elsewhere in the file, but it's
> hard to tell since you posted only a very small snippet.
>
> If you comment-out that particular task do you still have the same
> issue being reported?
>
> I would double-check the indentation as well, since what you posted as
> sample had a bit "deeper" indentation (maybe tabs vs spaces or too much
> indentation).
>
> What version of Ansible are you using?
>
> > The offending line appears to be:
> >
> >
> > - lineinfile:
> > path: /home/"{{ new_user_acct_name }}"/.ssh/authorized_keys
>
> Any reason you wouldn't be using authorized_key module
> (http://docs.ansible.com/ansible/latest/authorized_key_module.html)?
>
> Best regards
>
> --
> Branko Majic
> XMPP: [email protected]
> Please use only Free formats when sending attachments to me.
>
> Бранко Мајић
> XMPP: [email protected]
> Молим вас да додатке шаљете искључиво у слободним форматима.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/ansible-project/tXRBpl4c0U8/unsubscribe.
> To unsubscribe from this group and all its topics, 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/20170921120110.5e7791f1%40majic.rs.
> 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/CA%2BM9YC%3D617%3DLU6qzT4-hPn%2Bp%2BfE3af57hncM8n4-b3qmvsoRHQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.