Created
December 30, 2016 03:44
-
-
Save iversond/258e5a0ee758e1abc506a00502a436aa to your computer and use it in GitHub Desktop.
Uses a custom `dynamic_config:` hash in `psft_customizations.yaml` to update dynamic changes in `psappsrv.cfg`
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
$ensure = hiera('ensure') | |
$base = hiera('peoplesoft_base') | |
$appserver_domain_list = hiera('appserver_domain_list') | |
$appserver_domain_list.each | $domain_name, $appserver_domain_info | { | |
$cfg_file = "${appserver_domain_info['ps_cfg_home_dir']}/appserv/${domain_name}/psappsrv.cfg" | |
$dynamic_config = $appserver_domain_info['dynamic_config'] | |
$dynamic_config.each | $setting, $config_value | { | |
$settings_array = split($setting, "/") | |
ini_setting {"app-dynamic-change-${domain_name}-${setting}": | |
ensure => $ensure, | |
path => $cfg_file, | |
section => $settings_array[0], | |
setting => $settings_array[1], | |
value => $config_value, | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great to see this approach in puppet/DPK. This allows for a very effective configuration.
Using Ansible to do a similar approach, by having separate lists for dynamic vs static config. But also allows the task to determine if the app server needs to be cycled for the change when a change does actually occur. Ansible provides a powerful Jinja templating to sort-of pivot a yaml file into a template to update the psappsrv.cfg file. Here's a sample yaml template file (ie: ps_app_static_config.yml.j2) to specify static configs, but we also separate configs by app, environment and/or type. This allows me to see all the values for app servers for any environment in one location.
Then read these config rules in an Ansible task, load the yaml to a variable and loop through the sub-elements (Each config item).
The second task will first, loop through each config item in the yaml, then the second loop will check each change/value and determine if the current domain matches the app and environment the value is intended for. Then using the ini module, set the value to the matching section/option in the psappsrv.cfg file. And only if any changes occur, then restart the app server to make the changes take effect.