diff --git a/tasks/fail2ban.yml b/tasks/fail2ban.yml index 640b754..913127d 100644 --- a/tasks/fail2ban.yml +++ b/tasks/fail2ban.yml @@ -8,6 +8,7 @@ group: root mode: 0444 notify: systemctl restart fail2ban + when: "'fail2ban' in ansible_facts.packages" - name: Install fail2ban jail become: true @@ -18,3 +19,10 @@ group: root mode: 0444 notify: systemctl restart fail2ban + when: "'fail2ban' in ansible_facts.packages" + +- name: warn if fail2ban is not installed + ansible.builtin.fail: + msg: "the package fail2ban is not installed. no fail2ban filters deployed." + when: "'fail2ban' not in ansible_facts.packages" + ignore_errors: true diff --git a/tasks/main.yml b/tasks/main.yml index e0c49ba..461d49d 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -3,6 +3,10 @@ ansible.builtin.include_tasks: versioncheck.yml when: submodules_versioncheck|bool +- name: Gather installed packages for checks later on + ansible.builtin.package_facts: + manager: auto + - name: Gather variables for each operating system ansible.builtin.include_vars: "{{ lookup('first_found', gitea_variables) }}" diff --git a/vars/main.yml b/vars/main.yml index 1cdd648..c38f978 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -20,5 +20,5 @@ gitea_variables: paths: - 'vars' -playbook_version_number: 8 # should be int +playbook_version_number: 9 # should be int playbook_version_path: 'do1jlr.gitea.version'