Skip to content

Commit

Permalink
Merge pull request #18 from adfinis/chore/bareos_dir_overwrite_dir_conf
Browse files Browse the repository at this point in the history
chore: add bareos_dir_overwrite_dir_conf option
  • Loading branch information
adf-patrickha authored Jan 7, 2025
2 parents 116dc27 + a913c65 commit 1c11399
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 22 deletions.
8 changes: 6 additions & 2 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
# The director has these configuration parameters.

# Backup the configuration files.
bareos_dir_backup_configurations: no
bareos_dir_backup_configurations: false

# Install debug packages. This requires the debug repositories to be enabled.
bareos_dir_install_debug_packages: no
bareos_dir_install_debug_packages: false

# The hostname of the Director.
bareos_dir_hostname: "{{ inventory_hostname }}"
Expand Down Expand Up @@ -80,3 +80,7 @@ bareos_dir_storages: []

# Enable PAM authentication
bareos_dir_pam_auth_enable: false

# Overwrite Director config
# /etc/bareos/bareos-dir.d/director/bareos-dir.conf
bareos_dir_overwrite_dir_conf: true
13 changes: 11 additions & 2 deletions meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ argument_specs:
bareos_dir_pam_auth_username:
type: "str"
default: "pam-adduser"
description: >
description: >-
Technical user account for the Bareos Console connection.
Required to be able to add the user resources in Bareos, after a successful PAM authentication.
bareos_dir_pam_auth_password:
Expand All @@ -201,7 +201,16 @@ argument_specs:
bareos_dir_pam_auth_tls_enable:
type: "bool"
default: false
description: >
description: >-
If TLS should be used for the Bareos Console
WebUI does not support pre-shared keys (PSK), so if this is desired,
an actual CA and certificates need to be in place.
bareos_dir_overwrite_dir_conf:
type: "bool"
default: true
description: >-
This variable is used to control the behavior of applying the bareos-dir.conf template
in /etc/bareos/bareos-dir.d/director/bareos-dir.conf everytime.
The bareos_dir role is also intended to deploy the client (Filedaemon) configurations on
the Director. If multiple separate repositories are used then this variable can be set to false,
so not all repositories overwrite the "global" Director configuration.
36 changes: 18 additions & 18 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
- name: Converge
hosts: all
become: yes
gather_facts: yes
become: true
gather_facts: true

roles:
- role: ansible-role-bareos_dir
bareos_dir_backup_configurations: yes
bareos_dir_install_debug_packages: yes
bareos_dir_backup_configurations: true
bareos_dir_install_debug_packages: false
bareos_dir_hostname: bareos-dir
bareos_dir_password: "MySecretPassword"
bareos_dir_catalogs:
Expand Down Expand Up @@ -36,7 +36,7 @@
password: "MySecretPassword"
maximum_concurrent_jobs: 3
- name: "disabled-client"
enabled: no
enabled: false
bareos_dir_filesets:
- name: LinuxAll
description: "Backup all regular filesystems, determined by filesystem type."
Expand All @@ -46,7 +46,7 @@
exclude_dirs_containing: nobackup
options:
signature: MD5
one_fs: no
one_fs: false
fs_types:
- btrfs
- ext2
Expand Down Expand Up @@ -108,7 +108,7 @@
":db_host=/run/postgresql/"
":wal_archive_dir=/var/lib/pgsql/wal_archive/"
- name: disabled-fileset
enabled: no
enabled: false
bareos_dir_jobdefs:
- name: DefaultJob-1
type: Backup
Expand All @@ -131,7 +131,7 @@
":module_name=bareos-dir-class-plugins"
":testoption=testparam"
- name: disabled-jobdef
enabled: no
enabled: false
bareos_dir_jobs:
- name: my_job
description: "My backup job"
Expand All @@ -142,7 +142,7 @@
storage: File-1
messages: Standard
- name: disabled_job
enabled: no
enabled: false
- name: BackupCatalog
description: "Backup the catalog database (after the nightly save)"
jobdefs: DefaultJob
Expand Down Expand Up @@ -174,7 +174,7 @@
- "!skipped"
- "!saved"
- name: "disabled-message"
enabled: no
enabled: false
- name: Daemon
description: "Message delivery for daemon messages (no job)."
mailcommand: '/usr/bin/bsmtp -h localhost -f \"\(Bareos\) \<%r\>\" -s \"Bareos daemon message\" %r'
Expand Down Expand Up @@ -210,14 +210,14 @@
bareos_dir_pools:
- name: Full
pool_type: Backup
recycle: yes
autoprune: yes
recycle: true
autoprune: true
volume_retention: 365 days
maximum_volume_bytes: 50G
maximum_volumes: 100
label_format: "Full-"
- name: "disabled-pool"
enabled: no
enabled: false
bareos_dir_profiles:
- name: webui-admin
jobacl:
Expand Down Expand Up @@ -252,7 +252,7 @@
pluginoptionsacl:
- "*all*"
- name: "disabled-message"
enabled: no
enabled: false
bareos_dir_schedules:
- name: WeeklyCycle
run:
Expand All @@ -264,18 +264,18 @@
run:
- Full mon-fri at 21:10
- name: "disabled-schedule"
enabled: no
enabled: false
bareos_dir_storages:
- name: File-1
address: dir-1
password: "MySecretPassword"
device: FileStorage
media_type: File
tls_enable: yes
tls_verify_peer: no
tls_enable: true
tls_verify_peer: false
maximum_concurrent_jobs: 3
- name: "disabled-storage"
enabled: no
enabled: false
bareos_dir_plugins:
- director-python
Expand Down
7 changes: 7 additions & 0 deletions tasks/assert.yml
Original file line number Diff line number Diff line change
Expand Up @@ -213,3 +213,10 @@
- bareos_dir_plugin_list is defined
- bareos_dir_plugin_list is iterable
quiet: true

- name: assert | Test bareos_dir_overwrite_dir_conf
ansible.builtin.assert:
that:
- bareos_dir_overwrite_dir_conf is defined
- bareos_dir_overwrite_dir_conf is boolean
quiet: true
2 changes: 2 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@
group: bareos
mode: "0640"
backup: "{{ bareos_dir_backup_configurations }}"
when:
- bareos_dir_overwrite_dir_conf
notify:
- Check configuration
- Reload bareos-dir
Expand Down

0 comments on commit 1c11399

Please sign in to comment.