Hi everyone, I am currently trying to automate the hardening of machines 
with the use of the audit.pol file from the group policy software. I have 
managed to automate the parsing of the file into a text file with the help 
of LGPO software but I am trying to figure out how to do the following:

-Check the text file if a setting exist (Settings are usually a few lines 
long)
-If it exist simple update the value
-If it does not exist, append the settings into the text file

I have attached a screenshot of how the text file looks like a template of 
how a setting will look like:

Computer
PathToRegistry
RegistryName
RegistryValue

So my first step is to search if the registry name exist in the text file, 
if it exists then i have to edit the next line after it which is registry 
value. If it doesn't append the 4 lines of details in the format shown 
above. Searching if the registry name exist can be done by storing the text 
file as a registry in the ansible playbook however how do I edit the next 
line after the registry name? And is it possible to do the if else in a 
single task?

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-devel/b37b4675-58db-40ea-8f8b-7612d01a0e60%40googlegroups.com.

Reply via email to