-
-
Save rodjek/3051548 to your computer and use it in GitHub Desktop.
Want to define a different security group for each server range
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# First option, make elasticsearch a parameterised class | |
node /^tcsearch(0[1-9]|10)\.deskstaging\.com$/ inherits staging { | |
class { 'elasticsearch': | |
security_group => 'foo', | |
} | |
} | |
node /^tcsearch2[0-9]\.deskstaging\.com$/ inherits staging { | |
class { 'elasticsearch': | |
security_group => 'bar', | |
} | |
} | |
class elasticsearch($security_group) { | |
# ... | |
} | |
# Second option, handle it in the class itself | |
class elasticsearch { | |
case $::hostname { | |
/^tcsearch(0[1-9]|10)/ { $security_group = 'foo' } | |
/^tcsearch2[1-9]/ { $security_group = 'bar' } | |
default: { | |
fail("Unable to determine security group for host '${::hostname}'") | |
} | |
} | |
# ... | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment