Skip to content

Instantly share code, notes, and snippets.

@markuskont
Last active September 7, 2016 11:11
Show Gist options
  • Save markuskont/26187516fe0ea453df090ee36f68dc17 to your computer and use it in GitHub Desktop.
Save markuskont/26187516fe0ea453df090ee36f68dc17 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import sys
def openfile(argv):
with open(argv, 'r') as file:
lines = [line.rstrip('\n') for line in file]
return lines
PUPPET_TPL = """auditd::rule { "audit-rule-%(INDEX)s":
content => "\\n%(COMMAND)s",
order => "%(INDEX)s"
}
"""
INDEX=1
COMMANDS = openfile('/tmp/list2.txt')
for COMMAND in COMMANDS:
sys.stdout.write(PUPPET_TPL % {'INDEX': INDEX, 'COMMAND': COMMAND })
INDEX=INDEX+1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment