Hey,

You could use the lineinfile-module.

With something like:

lineinfile:
  regexp: "^/dev/mapper/vg_rhel-var_tmp"
  line: "/dev/mapper/vg_rhel-var_tmp /var/tmp xfs
defaults,noexec,nosuid,nodev 0 0"


Take into account that the regexp definition has to match __before__ and
__after__ replacement

Cheers

Lars

Am 03.11.20 um 05:14 schrieb 'Chris Bidwell - NOAA Federal' via Ansible
Project:
> Hey all,
>
> Interesting question here.  I want to remove the string noexec out of
> a line in my /etc/fstab.  In this instance, I only want it to be in
> the /tmp line.  
> I was thinking a replace module, but not sure about a regexp that
> would work.  Any thoughts?
>
> #
> # /etc/fstab
> # Created by anaconda on Tue Nov  3 01:51:55 2020
> #
> # Accessible filesystems, by reference, are maintained under '/dev/disk/'.
> # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more
> info.
> #
> # After editing this file, run 'systemctl daemon-reload' to update systemd
> # units generated from this file.
> #
> /dev/mapper/vg_rhel-root /                       xfs     defaults    
>    0 0
> UUID=3da5b7f5-fc36-4e8f-beb4-d270d3dff5f8 /boot ext4
> defaults,nosuid,nodev 0 0
> /dev/mapper/vg_rhel-home /home xfs defaults,nosuid,nodev 0 0
> /dev/mapper/vg_rhel-opt /opt                    xfs     defaults      
>  0 0
> /dev/mapper/vg_rhel-tmp /tmp xfs defaults,noexec,nodev,nosuid 0 0
> /dev/mapper/vg_rhel-usr /usr                    xfs     defaults      
>  0 0
> /dev/mapper/vg_rhel-usr_local /usr/local              xfs     defaults
>        0 0
> /dev/mapper/vg_rhel-var /var xfs defaults,nodev 0 0
> /dev/mapper/vg_rhel-var_lib_docker /var/lib/docker         xfs    
> defaults        0 0
> /dev/mapper/vg_rhel-var_log /var/log xfs defaults,nodev,noexec,nosuid 0 0
> /dev/mapper/vg_rhel-var_log_audit /var/log/audit xfs
> defaults,nodev,noexec,nosuid 0 0
> /dev/mapper/vg_rhel-var_tmp /var/tmp xfs defaults,noexec,nosuid,nodev 0 0
> /dev/mapper/vg_rhel-swap swap                    swap    defaults    
>    0 0
> tmpfs /dev/shm tmpfs rw,nosuid,nodev,noexec,seclabel 0 0
> -- 
> 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]
> <mailto:[email protected]>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAHKi8CiS-9EK%2BmL1bHY3-VO5RkYOzboh8d0Bz5oUYMYnTi9AoQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAHKi8CiS-9EK%2BmL1bHY3-VO5RkYOzboh8d0Bz5oUYMYnTi9AoQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.

-- 
---
punkt.de GmbH
Lars Liedtke
.infrastructure

Kaiserallee 13a 
76133 Karlsruhe

Tel. +49 721 9109 500
https://infrastructure.punkt.de
[email protected]

AG Mannheim 108285
Geschäftsführer: Jürgen Egeling, Daniel Lienert, Fabian Stein

-- 
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/a2d711c7-2d11-ccbb-081a-342be4169466%40punkt.de.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to