From 3691600aee6de6c071dab04c8c1888a61b2870cf Mon Sep 17 00:00:00 2001 From: mboelen Date: Thu, 31 Mar 2016 21:18:50 +0200 Subject: Added initial playbook --- lynis.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 lynis.yml diff --git a/lynis.yml b/lynis.yml new file mode 100644 index 0000000..6f98dfd --- /dev/null +++ b/lynis.yml @@ -0,0 +1,19 @@ +# Ansible Playbook for Lynis deployment + +- name: Lynis | Create /usr/local/lynis + file: path=/usr/local/lynis state=directory + +- name: Lynis | Unarchive copied package + unarchive: src=/etc/ansible/files/packages/lynis-latest.tar.gz dest=/usr/local copy=yes + register: result + +- name: Lynis | Copy default Lynis profile from master to destination + copy: src=/etc/ansible/files/configs/lynis_custom.prf dest=/usr/local/lynis/custom.prf force=yes + when: result.changed == True + +- name: Lynis | Add Lynis to crontab if package files still exists (normally ran once) + cron: name="Run Lynis" hour="{{ 4|random }}" minute="{{ 59 |random }}" job="/usr/local/lynis/lynis -c --cronjob --upload --profile /usr/local/lynis/custom.prf" state=present + when: result.changed == True + +- name: Lynis | Delete Lynis tarball + file: path=/usr/local/lynis-latest.tar.gz state=absent -- cgit v1.2.3