edit aix stanza files

hi all,

any way to edit so called “stanza files” in aix? i read about the blockinfile module but this seems not to be the best way to do it, since it depends on markers which will break aix configs.

example of such stanza files:

`
srvproxy:
admin = false
umask = 2
login = false
rlogin = false

usw:
shells = /bin/sh,/bin/bsh,/bin/csh,/bin/ksh,/bin/tsh,/bin/ksh93,/usr/bin/sh,/usr/bin/bsh,/usr/bin/csh,/usr/bin/ksh,/usr/bin/tsh,/usr/bin/ksh93,/usr/bin/rksh,/usr/bin/rksh93,/usr/sbin/uucp/uucico,/usr/sbin/sliplogin,/usr/sbin/snappd,/bin/false,/usr/bin/bash
maxlogins = 32767
logintimeout = 60
auth_type = STD_AUTH
pwd_algorithm = sshaitsv

`

for example i want to adress the “srcproxy:” and add or delete "pwd_algorithm = sshaitsv", or add new items "somestanza:". any ideas?

wbr

chris

you can try lineinfile or use j2 templates

hmm…tried out lineinfile, replace and template but was not successfull? any other creative ideas? i looked at the ini_file module source, and it seems this is very similar to the aix stanza format. unfortunately i am at war with regex, and this particular code is full of it.