From 8edd69547dd2c2787c20af0549516b7cbe17b6ab Mon Sep 17 00:00:00 2001 From: Emilien Mantel Date: Sat, 5 Mar 2016 15:46:54 +0100 Subject: [PATCH] [WIP] split pre/post tasks related to OS version --- tests/includes/post_Debian.yml | 10 +++++++++ tests/includes/post_FreeBSD.yml | 2 ++ tests/includes/pre_Debian.yml | 18 +++++++++++++++++ tests/includes/pre_FreeBSD.yml | 5 +++++ tests/test.yml | 36 ++++----------------------------- 5 files changed, 39 insertions(+), 32 deletions(-) create mode 100644 tests/includes/post_Debian.yml create mode 100644 tests/includes/post_FreeBSD.yml create mode 100644 tests/includes/pre_Debian.yml create mode 100644 tests/includes/pre_FreeBSD.yml diff --git a/tests/includes/post_Debian.yml b/tests/includes/post_Debian.yml new file mode 100644 index 0000000..e86270a --- /dev/null +++ b/tests/includes/post_Debian.yml @@ -0,0 +1,10 @@ +--- + +- name: APT | Install web apps + apt: pkg={{ item }} state=present + with_items: + - nagios3 + - backuppc + +- name: SERVICE | Ensure backuppc is started + service: name=backuppc state=started diff --git a/tests/includes/post_FreeBSD.yml b/tests/includes/post_FreeBSD.yml new file mode 100644 index 0000000..cd21505 --- /dev/null +++ b/tests/includes/post_FreeBSD.yml @@ -0,0 +1,2 @@ +--- + diff --git a/tests/includes/pre_Debian.yml b/tests/includes/pre_Debian.yml new file mode 100644 index 0000000..17e6fb4 --- /dev/null +++ b/tests/includes/pre_Debian.yml @@ -0,0 +1,18 @@ +--- + +- name: APT_REPOSITORY | Install backports + apt_repository: repo='deb http://httpredir.debian.org/debian {{ ansible_distribution_release }}-backports main' state=present + +- name: APT | Install needed packages + apt: pkg={{ item }} update_cache=yes cache_valid_time=3600 state=present + with_items: + - php5-fpm + - curl + - fcgiwrap + +- name: SERVICE | Force start services + service: name={{ item }} state=started + register: sf + with_items: + - php5-fpm + - fcgiwrap diff --git a/tests/includes/pre_FreeBSD.yml b/tests/includes/pre_FreeBSD.yml new file mode 100644 index 0000000..8ec7448 --- /dev/null +++ b/tests/includes/pre_FreeBSD.yml @@ -0,0 +1,5 @@ +--- + +- name: SET_FACT | FreeBSD web user + set_fact: + nginx_user: 'www' diff --git a/tests/test.yml b/tests/test.yml index afdd1e9..bbbb91a 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -2,30 +2,8 @@ - hosts: all pre_tasks: - - block: - - name: APT_REPOSITORY | Install backports - apt_repository: repo='deb http://httpredir.debian.org/debian {{ ansible_distribution_release }}-backports main' state=present - - name: APT | Install needed packages - apt: pkg={{ item }} update_cache=yes cache_valid_time=3600 state=present - with_items: - - php5-fpm - - curl - - fcgiwrap - - name: SERVICE | Force start services - service: name={{ item }} state=started - register: sf - with_items: - - php5-fpm - - fcgiwrap - when: ansible_distribution == 'Debian' - - block: - - name: SET_FACT | FreeBSD web user - set_fact: - nginx_user: 'www' - when: ansible_distribution == 'FreeBSD' - - name: PAUSE | Prevent bugs (CGI not fully loaded) - pause: seconds=5 - when: sf.changed + - name: INCLUDE | Pre_tasks related to OS version + include: "includes/pre_{{ ansible_distribution }}.yml" - name: FILE | Create an internal SSL dir file: path={{ int_ansible_ssl_dir }} state=directory - name: COPY | Deploy test certificate @@ -199,14 +177,8 @@ # -------------------------------- # Apps # -------------------------------- - - name: APT | Install web apps - apt: pkg={{ item }} state=present - with_items: - - nagios3 - - backuppc - - name: SERVICE | Ensure backuppc is started - service: name=backuppc state=started - + - name: INCLUDE | Post_tasks related to OS version + include: "includes/post_{{ ansible_distribution }}.yml" # -------------------------------- # Deploy index files # --------------------------------