From f20bbde88468b1c5cc4b952527e9fd19ee0c14ca Mon Sep 17 00:00:00 2001 From: Phil Porada Date: Fri, 8 Apr 2016 16:43:26 -0400 Subject: [PATCH] Users can now set the apt/yum module 'state' to be 'installed, latest, present' etc. This allows a user to test php55, swap a variable to enable the php56 repo, then re-run the ansible play to get different PHP packages. --- defaults/main.yml | 3 +++ tasks/setup-Debian.yml | 2 +- tasks/setup-RedHat.yml | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 8d2a6be..00c60ed 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -2,6 +2,9 @@ # Pass in a comma-separated list of repos to use (e.g. "remi,epel"). php_enablerepo: "" +# State that the system package installer should use for PHP the enabled repo (e.g. "installed,latest") +php_repostate: installed + # Set this to false if you're not using PHP with Apache/Nginx/etc. php_enable_webserver: true diff --git a/tasks/setup-Debian.yml b/tasks/setup-Debian.yml index a43684d..7cbcc04 100644 --- a/tasks/setup-Debian.yml +++ b/tasks/setup-Debian.yml @@ -5,7 +5,7 @@ - name: Ensure PHP packages are installed. apt: name: "{{ item }}" - state: installed + state: "{{ php_repostate }}" with_items: "{{ php_packages }}" register: php_package_install notify: restart webserver diff --git a/tasks/setup-RedHat.yml b/tasks/setup-RedHat.yml index e2e0e43..15dd8fd 100644 --- a/tasks/setup-RedHat.yml +++ b/tasks/setup-RedHat.yml @@ -2,7 +2,7 @@ - name: Ensure PHP packages are installed. yum: name: "{{ item }}" - state: installed + state: "{{ php_repostate }}" enablerepo: "{{ php_enablerepo }}" with_items: "{{ php_packages }}" notify: restart webserver