From ae2f8804d2b37bc15e3cf4923f2653f3410e6003 Mon Sep 17 00:00:00 2001 From: Dan Shields Date: Sun, 20 Mar 2022 03:12:05 -0600 Subject: [PATCH 1/5] Add `run_opensips` var to allow disabling startup Example use case: when creating an AMI the EC2 node might not have access to the database and OpenSIPS startup will fail. --- handlers/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/handlers/main.yml b/handlers/main.yml index 4d923f3..c0bdf9b 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,13 +1,13 @@ --- # handlers file for opensips -- name: opensips start +- name: opensips enable service: name: opensips enabled: true - state: started - name: opensips restart service: name: opensips state: restarted + when: run_opensips | default(True) From 1a21ab308e4004113f9ab52fc9958e084140165d Mon Sep 17 00:00:00 2001 From: Dan Shields Date: Sun, 20 Mar 2022 03:16:10 -0600 Subject: [PATCH 2/5] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index efd32d5..0a34f3c 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ the httpd module, you will have to add to the list `opensips-http-modules`. Defa (`[]`) - no other modules are installed. * `opensips_config` - specify a configuration template that is going to be used instead of the default opensips configuration file. +* `run_opensips` - specify whether OpenSIPS should be started/restarted. Default value is `yes`. Example Playbook ---------------- From d0b1efc0e67b2e73e2bca22ff9540ba9a45679ed Mon Sep 17 00:00:00 2001 From: Dan Shields Date: Sun, 20 Mar 2022 03:45:54 -0600 Subject: [PATCH 3/5] Fix handler names --- tasks/debian.yml | 4 ++-- tasks/redhatdnf.yml | 4 ++-- tasks/redhatyum.yml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tasks/debian.yml b/tasks/debian.yml index 7d0ba66..fdfbc64 100644 --- a/tasks/debian.yml +++ b/tasks/debian.yml @@ -29,7 +29,7 @@ name: opensips state: present notify: - - opensips start + - opensips enable - opensips restart register: apt_install_result until: apt_install_result is success @@ -42,7 +42,7 @@ state: present when: opensips_modules is defined and opensips_modules | length notify: - - opensips start + - opensips enable - opensips restart register: apt_modules_install_result until: apt_modules_install_result is success diff --git a/tasks/redhatdnf.yml b/tasks/redhatdnf.yml index eab388b..34b2305 100644 --- a/tasks/redhatdnf.yml +++ b/tasks/redhatdnf.yml @@ -44,7 +44,7 @@ name: opensips state: present notify: - - opensips start + - opensips enable - opensips restart register: dnf_install_result until: dnf_install_result is success @@ -57,7 +57,7 @@ state: present when: opensips_modules is defined and opensips_modules | length notify: - - opensips start + - opensips enable - opensips restart register: dnf_modules_install_result until: dnf_modules_install_result is success diff --git a/tasks/redhatyum.yml b/tasks/redhatyum.yml index d875b4d..8124b75 100644 --- a/tasks/redhatyum.yml +++ b/tasks/redhatyum.yml @@ -44,7 +44,7 @@ name: opensips state: present notify: - - opensips start + - opensips enable - opensips restart register: yum_install_result until: yum_install_result is success @@ -57,7 +57,7 @@ state: present when: opensips_modules is defined and opensips_modules | length notify: - - opensips start + - opensips enable - opensips restart register: yum_modules_install_result until: yum_modules_install_result is success From a5b40655a60ee31cdc106af7a0987c181e3b056a Mon Sep 17 00:00:00 2001 From: Dan Shields Date: Sun, 20 Mar 2022 03:48:45 -0600 Subject: [PATCH 4/5] Fix indentation --- handlers/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handlers/main.yml b/handlers/main.yml index c0bdf9b..f1e2ba6 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -10,4 +10,4 @@ service: name: opensips state: restarted - when: run_opensips | default(True) + when: run_opensips | default(True) From c059648014986c3dbf9a8b79022a970efe2022d8 Mon Sep 17 00:00:00 2001 From: Dan Shields Date: Sun, 20 Mar 2022 04:28:29 -0600 Subject: [PATCH 5/5] Follow naming conventions nginx's role has a variable named "nginx_start" --- README.md | 2 +- handlers/main.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0a34f3c..4260f0f 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ the httpd module, you will have to add to the list `opensips-http-modules`. Defa (`[]`) - no other modules are installed. * `opensips_config` - specify a configuration template that is going to be used instead of the default opensips configuration file. -* `run_opensips` - specify whether OpenSIPS should be started/restarted. Default value is `yes`. +* `opensips_start` - specify whether OpenSIPS should be started/restarted. Default value is `yes`. Example Playbook ---------------- diff --git a/handlers/main.yml b/handlers/main.yml index f1e2ba6..a4aed2b 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -10,4 +10,4 @@ service: name: opensips state: restarted - when: run_opensips | default(True) + when: opensips_start | default(True)