Hi:
On Thu, Jun 20, 2019 at 1:37 PM David McPherson <[email protected]> wrote:
> I am attempting to add a group to the sudoers file after the line
> %wheel ALL=(ALL) ALL
> example
>
> ## Allows people in group wheel to run all commands
> %wheel ALL=(ALL) ALL
> doman\\vm_admins ALL-(ALL) ALL
>
> - name: add vm_admins to sudoers
> lineinfile:
> path: /etc/sudoers
> regexp: "^%wheel"
> insertafter: "^%wheel"
> line: '{{realm_name.realm}}\\vm_admins ALL=(ALL) ALL'
> backup: yes
>
> I haven't used "inserafter" option before, but according to documentation:
https://docs.ansible.com/ansible/latest/modules/lineinfile_module.html
"... If regular expressions are passed to both regexp and insertafter,
insertafter is only honored if no match for regexp is found."
It seems that when regexp and inserafter use regular expressions,
inserafter will work only if regexp didn't match:
What if you try to comment the regexp option and use only inserafter?
The result is that ansible is replacing the line with the new line instead
> of adding it after.
>
> example
> ## Allows people in group wheel to run all commands
> doman\\vm_admins ALL-(ALL) ALL
>
> Any help would be appreciated.
>
> Thanks,
>
> Dave
>
> --
> 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/9839c2a2-9bcb-456f-9e9f-20532bac0c6a%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/9839c2a2-9bcb-456f-9e9f-20532bac0c6a%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> 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/CAA3McK-bdWg7Ro5N3363LYVafRgemWQkHCohuJ%2BDtjLjA8chuw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.