Skip to content

Commit c5a02f6

Browse files
authored
Merge pull request #37 from mila-iqia/repos_templates_etc
Add Bareos 23 capability, templates upgrades, fixes
2 parents 4aa71eb + 23759d6 commit c5a02f6

File tree

13 files changed

+49
-25
lines changed

13 files changed

+49
-25
lines changed

.github/workflows/molecule.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
fail-fast: false
2121
matrix:
2222
distro:
23-
- debian-systemd:bullseye
23+
- debian-systemd:bookworm
2424

2525
env:
2626
MOLECULE_DISTRO: ${{ matrix.distro }}

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ __Note:__ More options can be seen in `defaults/main.yml`
1717
- `bareos_director` - If you need to override backup director IP address on your client's /etc/hosts
1818
- `bareos_repo` - Defaults to Bareos Community Repository. Can be changed to use the Bareos Subscription Repository
1919
- `bareos_sd_max_concurrent_jobs` - [Optional] SD-level maximum concurrent jobs, defaults to 50
20+
- `bareos_catalog_backup_script` - You need to set it to `/usr/lib/bareos/scripts/make_catalog_backup` if using Bareos >=23
2021
```
2122
bareos_director:
2223
ip: 10.0.0.1
@@ -86,7 +87,7 @@ bareos_pools:
8687
bareos_dir_storage:
8788
- name: FileFoo
8889
device: FileStorageFoo
89-
bareos_dir_ip: 10.0.0.1
90+
bareos_sd_ip: 10.0.0.1
9091
media_type: File2 # optional, defaults to 'File'
9192
max_concurrent_jobs: 42 # optional, defaults to '50'
9293
```
@@ -97,7 +98,7 @@ bareos_dir_storage:
9798
devices:
9899
- FileStorageFoo
99100
- FileStorageBar
100-
bareos_dir_ip: 10.0.0.1
101+
bareos_sd_ip: 10.0.0.1
101102
media_type: File2 # optional, defaults to 'File'
102103
max_concurrent_jobs: 42 # optional, defaults to '50'
103104
```
@@ -161,7 +162,7 @@ __NOTES:__
161162
Some tasks will be delegated from backup server to this client
162163
- `enable_backup_job` - Will create backup job `DefaultJobLinux`
163164
- `state` - When set to `absent`, client will be removed from server config (default: `present`)
164-
- `autostart` - Schedule first backup right away (default: `true`)
165+
- `autostart` - Schedule first backup right away (default: `false`)
165166
- `director_ip` - [Optional] Same as `bareos_director`, just different place to setup
166167
- `director_name` - [Optional] Same as `bareos_director`, just different place to setup
167168

defaults/main.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
---
2-
bareos_release: 21
3-
bareos_db_package: postgresql-12
2+
bareos_release: 23
3+
bareos_db_package: postgresql-15
44
bareos_install_client: false
55
bareos_install_server: false
66
bareos_register_clients: true
77
bareos_email: 'root@localhost'
88

99
# Defaults to Bareos Community Repository
1010
bareos_repo: "https://download.bareos.org/current/{{ bareos_os_version }}"
11+
bareos_repo_key: "{{ bareos_repo }}/Release.key"
12+
bareos_repository: "deb {{ bareos_repo }}/ /"
1113
# Bareos Subscription Repository
1214
# bareos_repo: "http://download.bareos.com/bareos/release/{{ bareos_release }}/{{ bareos_os_version }}"
1315

@@ -35,3 +37,4 @@ bareos_apt_monitoring_packages:
3537
- python3-psycopg2
3638
- python3-mysqldb
3739
- gpg
40+
bareos_catalog_backup_script: /usr/lib/bareos/scripts/make_catalog_backup.pl

meta/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ galaxy_info:
55
namespace: mila
66
description: Role for managing bareos server & clients
77
license: MIT
8-
min_ansible_version: '2.14'
8+
min_ansible_version: '2.16'
99
platforms:
1010
- name: Debian
1111
versions:

molecule/default/molecule.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ driver:
55
name: docker
66
platforms:
77
- name: server
8-
image: "quay.io/actatux/${MOLECULE_DISTRO:-debian-systemd:bullseye}"
8+
image: "quay.io/actatux/${MOLECULE_DISTRO:-debian-systemd:bookworm}"
99
override_command: false
1010
privileged: true
1111
pre_build_image: true
1212
groups:
1313
- servers
1414
- name: client
15-
image: "quay.io/actatux/${MOLECULE_DISTRO:-debian-systemd:bullseye}"
15+
image: "quay.io/actatux/${MOLECULE_DISTRO:-debian-systemd:bookworm}"
1616
override_command: false
1717
privileged: true
1818
pre_build_image: true

tasks/bareos_server.yml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@
1313
line: ' dbpassword = "{{ bareos_postgres_pass }}"'
1414
when: bareos_postgres_pass is defined
1515

16-
- name: Remove dbaddress from catalog configuration
17-
ansible.builtin.lineinfile:
18-
path: /etc/bareos/bareos-dir.d/catalog/MyCatalog.conf
19-
regexp: '^ dbaddress ='
20-
state: absent
21-
2216
- name: Ensure bareos postgresql is installed
2317
apt:
2418
name: bareos-database-postgresql
@@ -39,6 +33,14 @@
3933
- name: Setup bareos DB
4034
when: bareos_setup_db
4135
block:
36+
- name: Recursively change bareos-dir directory ownership group to postgres
37+
ansible.builtin.file:
38+
path: "/etc/bareos/bareos-dir.d/"
39+
state: directory
40+
recurse: true
41+
group: postgres
42+
changed_when: false
43+
4244
- name: Check that bareos DB exists
4345
shell: psql -lqt | cut -d \| -f 1 | grep -qw bareos
4446
become: true
@@ -56,6 +58,14 @@
5658
/usr/lib/bareos/scripts/grant_bareos_privileges
5759
when: _bareos_db_exists.rc != 0
5860

61+
- name: Recursively change bareos-dir directory ownership group to bareos
62+
ansible.builtin.file:
63+
path: "/etc/bareos/bareos-dir.d/"
64+
state: directory
65+
recurse: true
66+
group: bareos
67+
changed_when: false
68+
5969
- name: Setup bareos DB monitoring
6070
when: bareos_setup_db_sensu
6171
block:

tasks/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717

1818
- name: Add BareOS apt-key
1919
apt_key:
20-
url: "{{ bareos_repo }}/Release.key"
20+
url: "{{ bareos_repo_key }}"
2121
when: ansible_os_family == 'Debian'
2222

2323
- name: Ensure BareOS repo is present Debian
24-
apt_repository:
25-
repo: "deb {{ bareos_repo }}/ /"
24+
ansible.builtin.apt_repository:
25+
repo: "{{ bareos_repository }}"
2626
when: ansible_os_family == 'Debian'
2727

2828
- name: Import GPG key

tasks/register_client.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
register: _bconsole_output
104104
failed_when: ('Error' in _bconsole_output.stdout) or ('Failed' in _bconsole_output.stdout) or ('not found' in _bconsole_output.stdout)
105105
when:
106-
- item.autostart | default(true)
106+
- item.autostart | default(false)
107107
- _bareos_backup_job.changed
108108

109109
- name: Update client address if changed

templates/bareos-dir/job/BackupCatalog.conf.j2

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ Job {
77
Schedule = "WeeklyCycleAfterBackup"
88

99
# This creates an ASCII copy of the catalog
10-
# Arguments to make_catalog_backup.pl are:
11-
# make_catalog_backup.pl <catalog-name>
12-
RunBeforeJob = "/usr/lib/bareos/scripts/make_catalog_backup.pl MyCatalog"
10+
# Arguments to make_catalog_backup are:
11+
# make_catalog_backup <catalog-name>
12+
RunBeforeJob = "{{ bareos_catalog_backup_script }} MyCatalog"
1313

1414
# This deletes the copy of the catalog
1515
RunAfterJob = "/usr/lib/bareos/scripts/delete_catalog_backup"

templates/bareos-dir/jobdefs/jobdef.conf.j2

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,13 @@ Keep the legacy defaults when the template is used to define JobDefs resources
7272
{% elif _resource_type == 'JobDefs' %}
7373
Cancel Queued Duplicates = yes
7474
{% endif %}
75+
{% if item.selection_type is defined %}
76+
Selection Type = {{ item.selection_type }}
77+
{% endif %}
78+
{% if item.spool_data is defined %}
79+
Spool Data = {{ item.spool_data }}
80+
{% endif %}
81+
{% if item.enabled is defined %}
82+
Enabled = {{ item.enabled }}
83+
{% endif %}
7584
}

0 commit comments

Comments
 (0)