Skip to content

Commit

Permalink
Merge pull request #5 from adfinis/bump_bareos_fd
Browse files Browse the repository at this point in the history
feat(role): update bareos_fd version to v1.1.1
  • Loading branch information
adf-patrickha authored Feb 13, 2024
2 parents b84e7fd + 3264479 commit 5ea54c5
Show file tree
Hide file tree
Showing 13 changed files with 142 additions and 65 deletions.
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
namespace: adfinis
name: bareos
version: 1.0.0
version: 1.0.5
readme: README.md
authors:
- Adfinis
Expand Down
4 changes: 2 additions & 2 deletions roles/bareos_fd/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ galaxy_info:
role_name: bareos_fd
description: Install and configure [Bareos](https://www.bareos.com/) File Daemon.
license: Apache-2.0
company: none
company: Adfinis
min_ansible_version: "2.12"

platforms:
Expand All @@ -20,8 +20,8 @@ galaxy_info:
- "9"
- name: Fedora
versions:
- "37"
- "38"
- "39"
- name: opensuse
versions:
- all
Expand Down
1 change: 1 addition & 0 deletions roles/bareos_fd/requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ roles:

collections:
- name: community.crypto
- name: community.general
6 changes: 6 additions & 0 deletions roles/bareos_fd/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
---
# tasks file for bareos_fd

- name: Include OS-specific vars
ansible.builtin.include_vars: "{{ item }}"
with_first_found:
- "{{ ansible_facts.distribution }}_{{ ansible_facts.distribution_major_version }}.yml"
- "{{ ansible_facts.os_family }}.yml"

- name: Import assert.yml
ansible.builtin.import_tasks:
file: assert.yml
Expand Down
14 changes: 10 additions & 4 deletions roles/bareos_fd/tasks/plugins.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
---

- name: plugins | Get Bareos plugin package names
- name: plugins | Get data
ansible.builtin.set_fact:
_plugin_packages:
"{{ bareos_fd_plugin_list | selectattr('name', 'match', item) | map(attribute='package_name') }}"
_plugin_data: >-
{{ _plugin_data + (bareos_fd_plugin_list | selectattr('name', 'equalto', item) | list) }}
loop: "{{ bareos_fd_plugins }}"
vars:
_plugin_data: [] # empty list to append to

- name: plugins | Install Bareos plugin packages
ansible.builtin.package:
name: "{{ _plugin_packages }}"
name: "{{ item.packages }}"
state: present
loop: "{{ _plugin_data }}"
notify:
- Check configuration
- Restart bareos-filedaemon
18 changes: 4 additions & 14 deletions roles/bareos_fd/templates/myself.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,11 @@ Client {
{% endif %}

{#
bareos_fd_plugins is defined on host/group level,
while bareos_fd_plugin_list is a role var, with all available plugins
# `bareos_fd_plugins` is a list defined on host/group level,
# while `bareos_fd_plugin_name` and `bareos_fd_plugin_dir` are role vars
#}
{% if bareos_fd_plugins is defined %}
{% for plugin in bareos_fd_plugins %}
{% for item in bareos_fd_plugin_list if item.name == plugin %}

{% if item.plugin_dir is defined %}
Plugin Directory = "{{ item.plugin_dir }}"
{% endif %}
{% if item.plugin_names is defined %}
Plugin Names = "{{ item.plugin_names }}"
{% endif %}

{% endfor %}
{% endfor %}
Plugin Names = "{{ bareos_fd_plugin_name }}"
Plugin Directory = "{{ bareos_fd_plugin_dir }}"
{% endif %}
}
9 changes: 9 additions & 0 deletions roles/bareos_fd/vars/Archlinux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---

bareos_fd_encryption_packages:
- python-cryptography

bareos_fd_service: bareos-fd

bareos_fd_debug_packages:
- bareos-devel
1 change: 1 addition & 0 deletions roles/bareos_fd/vars/CentOS_7.yml
25 changes: 25 additions & 0 deletions roles/bareos_fd/vars/Debian.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---

bareos_fd_debug_packages:
- bareos-dbg
- gdb

bareos_fd_plugin_dir: "/usr/lib/bareos/plugins"
bareos_fd_plugin_name: python3
bareos_fd_plugin_list:
- name: mariabackup
packages:
- bareos-filedaemon-mariabackup-python-plugin

- name: mysql
packages:
- python3-mysqldb

- name: postgresql
packages:
- bareos-filedaemon-postgresql-python-plugin

- name: ldap
packages:
- python3-ldap
- bareos-filedaemon-ldap-python-plugin
26 changes: 26 additions & 0 deletions roles/bareos_fd/vars/RedHat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---

bareos_fd_debug_packages:
- bareos-filedaemon-debuginfo
- gdb

bareos_fd_plugin_dir: "/usr/lib64/bareos/plugins"
bareos_fd_plugin_name: python3
bareos_fd_plugin_list:
- name: mariabackup
packages:
- bareos-filedaemon-mariabackup-python-plugin

# TODO RHEL offers no python-mysqlclient package per default.
# Check if PyMySQL is working with the plugin
- name: mysql
packages:
- python3-PyMySQL

- name: postgresql
packages:
- bareos-filedaemon-postgresql-python-plugin

- name: ldap
packages:
- bareos-filedaemon-ldap-python-plugin
27 changes: 27 additions & 0 deletions roles/bareos_fd/vars/RedHat_7.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---

bareos_fd_encryption_packages:
- python2-cryptography

bareos_fd_debug_packages:
- bareos-debuginfo
- gdb

bareos_fd_plugin_dir: "/usr/lib64/bareos/plugins"
bareos_fd_plugin_name: python
bareos_fd_plugin_list:
- name: mariabackup
packages:
- bareos-filedaemon-mariabackup-python-plugin

- name: mysql
packages:
- MySQL-python

- name: postgresql
packages:
- bareos-filedaemon-postgresql-python-plugin

- name: ldap
packages:
- bareos-filedaemon-ldap-python-plugin
23 changes: 23 additions & 0 deletions roles/bareos_fd/vars/Suse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---

bareos_fd_debug_packages:
- gdb

bareos_fd_plugin_dir: "/usr/lib64/bareos/plugins"
bareos_fd_plugin_name: python3
bareos_fd_plugin_list:
- name: mariabackup
packages:
- bareos-filedaemon-mariabackup-python-plugin

- name: mysql
packages:
- python3-mysqlclient

- name: postgresql
packages:
- bareos-filedaemon-postgresql-python-plugin

- name: ldap
packages:
- bareos-filedaemon-ldap-python-plugin
51 changes: 7 additions & 44 deletions roles/bareos_fd/vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,12 @@
---
# vars file for bareos_fd

# A map to define the packages to install for encryption.
_bareos_fd_encryption_packages:
default:
- python3-cryptography
Archlinux:
- python-cryptography
RedHat-7:
- python2-cryptography
bareos_fd_encryption_packages: "{{ _bareos_fd_encryption_packages[ansible_os_family ~ '-' ~ ansible_distribution_major_version] | default(_bareos_fd_encryption_packages[ansible_os_family]) | default(_bareos_fd_encryption_packages['default']) }}"
bareos_fd_encryption_packages:
- python3-cryptography

# A map to define the service name to manage.
_bareos_fd_service:
default: bareos-filedaemon
Archlinux: bareos-fd
bareos_fd_service: "{{ _bareos_fd_service[ansible_os_family] | default(_bareos_fd_service['default']) }}"
bareos_fd_service: bareos-filedaemon
bareos_fd_plugin_name: python3

# A map to define the packages to install for debugging.
_bareos_fd_debug_packages:
default:
- bareos-filedaemon-debuginfo
- gdb
Archlinux:
- bareos-devel
Debian:
- bareos-dbg
- gdb
RedHat-7:
- bareos-debuginfo
- gdb
bareos_fd_debug_packages: "{{ _bareos_fd_debug_packages[ansible_os_family ~ '-' ~ ansible_distribution_major_version] | default(_bareos_fd_debug_packages[ansible_os_family]) | default(_bareos_fd_debug_packages['default']) }}"

# A list of Bareos FD plugins and their packages
bareos_fd_plugin_list:
- name: mariabackup
package_name: bareos-filedaemon-mariabackup-python-plugin
plugin_dir: "/usr/lib64/bareos/plugins"
plugin_names: python3
- name: mysql
plugin_dir: "/usr/lib64/bareos/plugins"
plugin_names: python3
- name: postgresql
package_name: bareos-filedaemon-postgresql-python-plugin
plugin_dir: "/usr/lib64/bareos/plugins"
plugin_names: python3
- name: ldap
package_name: bareos-filedaemon-ldap-python-plugin
# define the following stuff on Distro level (vars/<Distro.yml>). If a Distro is not there, it's not supported.
# bareos_fd_plugin_list: every distro might have different package names and dependencies
# bareos_fd_plugin_dir: /usr/lib on Debian, /usr/lib64 on "others"

0 comments on commit 5ea54c5

Please sign in to comment.