1
1
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_gitea.git synced 2024-08-16 11:39:50 +02:00

Merge pull request #26 from firesoft-de/fail2ban_condition

fail2ban only if installed
This commit is contained in:
L3D 2021-04-12 17:01:23 +02:00 committed by GitHub
commit bf3436501e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 1 deletions

View file

@ -8,6 +8,7 @@
group: root group: root
mode: 0444 mode: 0444
notify: systemctl restart fail2ban notify: systemctl restart fail2ban
when: "'fail2ban' in ansible_facts.packages"
- name: Install fail2ban jail - name: Install fail2ban jail
become: true become: true
@ -18,3 +19,10 @@
group: root group: root
mode: 0444 mode: 0444
notify: systemctl restart fail2ban 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

View file

@ -3,6 +3,10 @@
ansible.builtin.include_tasks: versioncheck.yml ansible.builtin.include_tasks: versioncheck.yml
when: submodules_versioncheck|bool 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 - name: Gather variables for each operating system
ansible.builtin.include_vars: "{{ lookup('first_found', gitea_variables) }}" ansible.builtin.include_vars: "{{ lookup('first_found', gitea_variables) }}"

View file

@ -20,5 +20,5 @@ gitea_variables:
paths: paths:
- 'vars' - 'vars'
playbook_version_number: 8 # should be int playbook_version_number: 9 # should be int
playbook_version_path: 'do1jlr.gitea.version' playbook_version_path: 'do1jlr.gitea.version'