On torsdag 31. august 2017 16.17.06 CEST Konrad Kosewski wrote:
> I have errors Could You help me :D
> 
> 
> - hosts: "{{ variable_hosts | default('all') }}"
>   remote_user: ansible
>   become: yes
>   tasks:
>     - include_vars: users.yml
>     - name: Make sure we have a {{ item.groupname }} group
>       group:
>         name:{{item.groupname}} with_items: '{{groups}}'

You need a space after the colon and you are missing quotes around the 
variable.
with_items must be on it own line and indented the same level as group:, 
with_items is a task parameter and not a group module parameter.


>         state: present
> 
>     - name: Allow {{ item.groupname }}  to have passwordless sudo
>       lineinfile:
>         dest: /etc/sudoers
>         state: present
>         regexp: '^%{{ item.groupname }}'
>         line: '%{{ item.groupname }} ALL=(ALL) NOPASSWD: ALL'
>       when: '{{ item.use_sudo }} == True'

You can't use curly brackets in when, just remove them since they are implied 
in when:.


>       with_items:'{{groups}}'

You are missing a space after colon.


> 
>     - name: Add sudoers users to wheel group
>       user:
>         name: "{{ item.username }}"
>         groups: 'jtendo'
>         append: yes
>         state: present
>         createhome: yes
>         system: yes
>         comment: "Ansible Automation Tool"
>       with_items: '{{users}}'
> 
>     - name: Sudoers or update sudoers file and validate
>       lineinfile: "dest=/etc/sudoers
>         insertafter=EOF
>         line='{{ item.username }} ALL=(ALL) NOPASSWD: ALL'
>         regexp='^{{ item.username }} .*'
>         state=present"
>       when: '{{ item.use_sudo }} == True'

Remove the curly brackets.


>       with_items:'{{users}}'

Missing space after colon.


-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/8315453.OCYT0aP1kl%40x1.
For more options, visit https://groups.google.com/d/optout.

Reply via email to