From f8970f4a380e2bf06cd5a7ddde98208a7f6cc23a Mon Sep 17 00:00:00 2001 From: "J. Daniel Ashton" Date: Wed, 9 Jun 2021 11:55:34 -0400 Subject: [PATCH] Alllow service to be disabled --- README.md | 4 ++++ defaults/main.yml | 3 +++ tasks/main.yml | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a0888c1..24149d8 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,10 @@ The list of packages to be installed. This defaults to a set of platform-specifi Set initial Apache daemon state to be enforced when this role is run. This should generally remain `started`, but you can set it to `stopped` if you need to fix the Apache config during a playbook run or otherwise would not like Apache started at the time this role is run. + apache_enabled: yes + +Set the Apache service boot time status. This should generally remain `yes`, but you can set it to `no` if you need to run Ansible while leaving the service disabled. + apache_packages_state: present If you have enabled any additional repositories such as _ondrej/apache2_, [geerlingguy.repo-epel](https://github.com/geerlingguy/ansible-role-repo-epel), or [geerlingguy.repo-remi](https://github.com/geerlingguy/ansible-role-repo-remi), you may want an easy way to upgrade versions. You can set this to `latest` (combined with `apache_enablerepo` on RHEL) and can directly upgrade to a different Apache version from a different repo (instead of uninstalling and reinstalling Apache). diff --git a/defaults/main.yml b/defaults/main.yml index 941a57c..21d7726 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -49,6 +49,9 @@ apache_mods_disabled: [] # Set initial apache state. Recommended values: `started` or `stopped` apache_state: started +# Set initial apache service status. Recommended values: `yes` or `no` +apache_enabled: yes + # Set apache state when configuration changes are made. Recommended values: # `restarted` or `reloaded` apache_restart_state: restarted diff --git a/tasks/main.yml b/tasks/main.yml index cdbcb63..567356c 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -44,4 +44,4 @@ service: name: "{{ apache_service }}" state: "{{ apache_state }}" - enabled: true + enabled: "{{ apache_enabled }}"