From dc58c81ad221ae339a0489677aab9cef91ea04c7 Mon Sep 17 00:00:00 2001 From: David Alexander Date: Thu, 14 May 2020 12:31:59 +1000 Subject: [PATCH 1/2] add tidy resource to remove old ngrok configs --- manifests/init.pp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/manifests/init.pp b/manifests/init.pp index 7a1611b..17ec5f5 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', 'ngrok.yaml'], + recurse => true, + } + } + # Download the package and uncompress it into a bin directory. archive { '/tmp/ngrok.zip': source => $download_url, From d5ac019a3f26e6f9a325daf1d088bea421fa1e8c Mon Sep 17 00:00:00 2001 From: David Alexander Date: Thu, 14 May 2020 12:35:48 +1000 Subject: [PATCH 2/2] update readme to reflect manage_all_configs param --- README.md | 10 ++++++++++ manifests/init.pp | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) 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 17ec5f5..a8ba417 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -52,7 +52,7 @@ if ( $manage_all_configs ) { tidy { 'old ngrok configs': path => '/home', - matches => [ 'ngrok.yml', 'ngrok.yaml'], + matches => 'ngrok.yml', recurse => true, } }