Skip to content

Instantly share code, notes, and snippets.

@raphink
Last active December 20, 2015 08:59
Show Gist options
  • Select an option

  • Save raphink/6104418 to your computer and use it in GitHub Desktop.

Select an option

Save raphink/6104418 to your computer and use it in GitHub Desktop.
#!/usr/bin/augtool -Asf
# Loaded with -A, add association now
set /augeas/load/Pg_Hba/lens Pg_Hba.lns
set /augeas/load/Pg_Hba/incl /etc/postgresql/9.1/main/pg_hba.conf
load
# Make sure file exists
defnode file /files/etc/postgresql/9.1/main/pg_hba.conf
# Check if entry already exists
defvar new $file[count(*[type='hostssl' and database='all' and user='all' and address='samenet'])=0]
# Create new entry
set $new/01/type 'hostssl'
set $new/01/database 'all'
set $new/01/user 'all'
set $new/01/address 'samenet'
set $new/01/method 'md5'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment