diff --git a/README.md b/README.md index 103c4f6..985ea5a 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,16 @@ class { 'ngrok': } ``` +## Get rid of old configuration files if ngrok is already installed + +If ngrok is already installed, older configuration files may be defined at /home/username/.ngrok2/ngrok.yml. You can use $manage_all_configs to remove these old configurations as they may apply prior to any configuration set by Puppet (the default is false and will leave these files intact). + +```puppet +class { 'ngrok': + manage_all_configs => true, +} +``` + ## Start ngrok, but don't start tunnels You might want to define a bunch of tunnels, and have ngrok running, but not have it automatically start any of those tunnels. Use the `service_tunnels` parameter to instruct ngrok to not automatically enable any tunnels. diff --git a/manifests/init.pp b/manifests/init.pp index 7a1611b..a8ba417 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -30,6 +30,9 @@ # Parameter to manage unzip which is required by the archive resource. Boolean $manage_unzip = false, + + # Parameter to manage existing configuration files, as these may interfere with this module + Boolean $manage_all_configs = false, ) { # Let's make sure .. @@ -45,6 +48,15 @@ } } + # Remove existing ngrok configurations if they exist + if ( $manage_all_configs ) { + tidy { 'old ngrok configs': + path => '/home', + matches => 'ngrok.yml', + recurse => true, + } + } + # Download the package and uncompress it into a bin directory. archive { '/tmp/ngrok.zip': source => $download_url,