From 6f566533a30a38458d37656cd2fd051fdd6ecda5 Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Wed, 19 Jul 2017 14:36:30 +0200 Subject: [PATCH] evocheck: don't install by default (but possible) --- evocheck/README.md | 8 +++++++- evocheck/defaults/main.yml | 1 + evocheck/tasks/install_local.yml | 29 ++++++++++++++++++++++++++++ evocheck/tasks/install_package.yml | 5 +++++ evocheck/tasks/main.yml | 31 ++++-------------------------- 5 files changed, 46 insertions(+), 28 deletions(-) create mode 100644 evocheck/tasks/install_local.yml create mode 100644 evocheck/tasks/install_package.yml diff --git a/evocheck/README.md b/evocheck/README.md index b4438d3f..4a0e80de 100644 --- a/evocheck/README.md +++ b/evocheck/README.md @@ -4,7 +4,8 @@ Install and run evocheck ; a script for checking various settings automatically. ## Tasks -The tasks in `main.yml` install the script. This is temporary as evocheck is a package on Debian which is a bit outdated for the moment. For OpenBSD, it should also be packaged, but the work is not done yet. +The roles does not install evocheck by default as it should be installed through dependencies. +For OpenBSD, it should be packaged, but the work is not done yet. A separate `exec.yml` file can be imported manually in playbooks or roles to execute the script. Example : @@ -13,3 +14,8 @@ A separate `exec.yml` file can be imported manually in playbooks or roles to exe name: evocheck tasks_from: exec.yml ``` +## Variables + +We can force install via : +* `evocheck_force_install: local` : will copy the script provided by the role +* `evocheck_force_install: package` : will install the package via repositories diff --git a/evocheck/defaults/main.yml b/evocheck/defaults/main.yml index 8160768d..565849e3 100644 --- a/evocheck/defaults/main.yml +++ b/evocheck/defaults/main.yml @@ -1,2 +1,3 @@ --- +evocheck_force_install: False evocheck_bin_dir: /usr/share/scripts diff --git a/evocheck/tasks/install_local.yml b/evocheck/tasks/install_local.yml new file mode 100644 index 00000000..d98ce0ae --- /dev/null +++ b/evocheck/tasks/install_local.yml @@ -0,0 +1,29 @@ +--- +- include: remount_usr_rw.yml + when: evocheck_bin_dir | search ("/usr") + +- name: Scripts dir is present + file: + path: "{{ evocheck_bin_dir }}" + state: directory + owner: root + group: root + mode: "0700" + +- name: Copy evocheck.sh + copy: + src: evocheck.sh + dest: "{{ evocheck_bin_dir }}/evocheck.sh" + mode: "0700" + owner: root + force: yes + tags: + - evocheck + +- name: Copy evocheck.cf + copy: + src: evocheck.cf + dest: /etc/evocheck.cf + force: no + tags: + - evocheck diff --git a/evocheck/tasks/install_package.yml b/evocheck/tasks/install_package.yml new file mode 100644 index 00000000..7a2f875e --- /dev/null +++ b/evocheck/tasks/install_package.yml @@ -0,0 +1,5 @@ +--- +- name: install evocheck from package + apt: + name: evocheck + state: installed diff --git a/evocheck/tasks/main.yml b/evocheck/tasks/main.yml index ad6d8b4e..769dbbfe 100644 --- a/evocheck/tasks/main.yml +++ b/evocheck/tasks/main.yml @@ -1,30 +1,7 @@ --- -- include: remount_usr_rw.yml - when: evocheck_bin_dir | search ("/usr") +- include: install_local.yml + when: evocheck_force_install == "local" -- name: Scripts dir is present - file: - path: "{{ evocheck_bin_dir }}" - state: directory - owner: root - group: root - mode: "0700" - -- name: Copy evocheck.sh - copy: - src: evocheck.sh - dest: "{{ evocheck_bin_dir }}/evocheck.sh" - mode: "0700" - owner: root - force: yes - tags: - - evocheck - -- name: Copy evocheck.cf - copy: - src: evocheck.cf - dest: /etc/evocheck.cf - force: no - tags: - - evocheck +- include: install_package.yml + when: evocheck_force_install == "package"