-
Notifications
You must be signed in to change notification settings - Fork 54
Open
Description
Description
Comtrya has gained a lot of nice features over the past few years, but it being a configuration management utility... well, eventually being able to modify actual configuration files, is pretty crucial.
Deleting lines from a (text) file might be a good first action. The examples here are meant to start a discussion on the topic.
Additional information
Here's three cases with examples below:
- Removing all lines that are exact matches of 'sendmail_enable="NO"' in the /etc/rc.conf file.
- Removing all lines that start with 'sendmail_enable', which would remove both the line of the previous example as well as 'sendmail_enable="YES"' (and a lot of other thinkable combinations, too, of course), effectively resetting a machine to the system default.
- Removing all lines which contain 'sendmail', also getting rid of entries like 'sendmail_msp_queue_enable="YES" and the like.
- (or 3b actually) Removing all the commented out lines in default configurations (those can be dozens to hundreds) is somewhat common task in system administration.
Manifest Example
actions:
- action: lineinfile.delete
target: /etc/rc.conf
pattern: sendmail_enable="NO"
mode: exact
- action: lineinfile.delete
target: /etc/rc.conf
pattern: sendmail_enable
mode: startswith
- action: lineinfile.delete
target: /etc/rc.conf
pattern: sendmail
mode: contains
- action: lineinfile:delete
target: /usr/local/etc/nginx.conf
pattern: #
mode: contains
martintc
Metadata
Metadata
Assignees
Labels
No labels