On Mon, Feb 27, 2023 at 2:30 PM Hamim Ismail <[email protected]> wrote:

> Append 2 lines in /etc/sudoers
>
> Hi I have 2 lines starting with User_Alias
>
> How do i make sure both lines get appended
>
> at the moment only the last line is being appended using this playbook
>

You don't. You put that content in as a separate, template based file in
/etc/sudoers.d/whateveryoulike.conf, with ownership set to root and
permissions set to 440.

> tasks:
>
> - name: add someuser to end of line
>
> lineinfile:
>
> dest: /etc/sudoers
>
> state: present
>
> regexp: '^(User_Alias(.*)$)'
>
> backrefs: yes
>
> backup: yes
>
> line: '\1, someuser'
>
>
> Output:
>
>
> User_Alias SAP_ADMIN =user1, user2, user3, (see its blank here)
>
> User_Alias ORA_ADMIN = user1, user2 ,user3, someuser
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/9fa81932-2293-442d-996e-575f476aca08n%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/9fa81932-2293-442d-996e-575f476aca08n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAOCN9rzzj4GOHCzMJ%2BiA89KEfOi8w5g%2BM7DU4uHZKt%3DbRujL%2Bg%40mail.gmail.com.

Reply via email to