Hi everyone,

 

I am really having a very Monday Monday today and am just having a fit with
my regex. I'm working on implementing part of the DISA STIG for RHEL 9 and
need to edit /etc/bashrc, specifically:

 

    # Set default umask for non-login shell only if it is set to 0

    [ `umask` -eq 0 ] && umask 022

 

I need to change that "umask 022" to "umask 077" and I've gotten as far as
this:

 

- name: RHEL-09-412055 | RHEL 9 must define default permissions for the bash
shell

  ansible.builtin.lineinfile:

    path: /etc/bashrc

    regexp: \sumask\s\d{3}

    line: "[ `umask` -eq 0 ] && umask 077"

 

 

But then realized that the regexp and replacement isn't idempotent and since
then my brain has just decided to go on a little vacation by itself.

 

I was thinking about some sort of capture group and then something saying
"if <capture group> != '077'," but I think I completely lost the plot at
that point.

 

Thank you for any help on this Mondayest of Mondays.

 

 

 

--

Chad Schrock, he/him

Supporting MIT Lincoln Laboratory, Lexington, MA

 

-- 
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/PH1P110MB14443DB4A6FBB2E6DD135DA8B3B3A%40PH1P110MB1444.NAMP110.PROD.OUTLOOK.COM.

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to