Add apache_packages_state to allow upgrading Apache versions

This commit is contained in:
Oskar Schöldström 2017-01-05 16:39:55 -05:00
parent 2ad0164cfe
commit 4fb372d104
6 changed files with 12 additions and 4 deletions

View file

@ -99,6 +99,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_packages_state: installed
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. By default, this is set to `installed`. You can now override this variable to `latest`. Combined with `apache_enablerepo`, a user now doesn't need to manually uninstall the existing Apache packages before installing them from a different repository.
apache_ignore_missing_ssl_certificate: true
If you would like to only create SSL vhosts when the vhost certificate is present (e.g. when using Lets Encrypt), set `apache_ignore_missing_ssl_certificate` to `false`. When doing this, you might need to run your playbook more than once so all the vhosts are configured (if another part of the playbook generates the SSL certificates).

View file

@ -52,3 +52,7 @@ apache_state: started
# Set apache state when configuration changes are made. Recommended values:
# `restarted` or `reloaded`
apache_restart_state: restarted
# Apache package state; use `installed` to make sure it's installed, or `latest` if
# you want to upgrade or switch versions using a new repo.
apache_packages_state: installed

View file

@ -3,5 +3,5 @@
apt: update_cache=yes cache_valid_time=3600
- name: Ensure Apache is installed on Debian.
apt: "name={{ item }} state=installed"
apt: "name={{ item }} state={{ apache_packages_state }}"
with_items: "{{ apache_packages }}"

View file

@ -2,6 +2,6 @@
- name: Ensure Apache is installed on RHEL.
yum:
name: "{{ item }}"
state: installed
state: "{{ apache_packages_state }}"
enablerepo: "{{ apache_enablerepo }}"
with_items: "{{ apache_packages }}"

View file

@ -2,5 +2,5 @@
- name: Ensure Apache is installed on Solaris.
pkg5:
name: "{{ item }}"
state: installed
state: "{{ apache_packages_state }}"
with_items: "{{ apache_packages }}"

View file

@ -2,5 +2,5 @@
- name: Ensure Apache is installed on Suse.
zypper:
name: "{{ item }}"
state: installed
state: "{{ apache_packages_state }}"
with_items: "{{ apache_packages }}"