Skip to content

Commit

Permalink
Merge pull request #26 from firesoft-de/fail2ban_condition
Browse files Browse the repository at this point in the history
fail2ban only if installed
  • Loading branch information
DO1JLR authored Apr 12, 2021
2 parents 26b4afd + 2ca88c2 commit bf34365
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
8 changes: 8 additions & 0 deletions tasks/fail2ban.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
group: root
mode: 0444
notify: systemctl restart fail2ban
when: "'fail2ban' in ansible_facts.packages"

- name: Install fail2ban jail
become: true
Expand All @@ -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
4 changes: 4 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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) }}"

Expand Down
2 changes: 1 addition & 1 deletion vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'

0 comments on commit bf34365

Please sign in to comment.