Initial commit

Signed-off-by: Julien Riou <julien@riou.xyz>
This commit is contained in:
Julien Riou 2024-04-27 15:18:41 +02:00
parent d547c7f607
commit 096a3e0540
No known key found for this signature in database
GPG key ID: A2EB1F2CA8E3F677
69 changed files with 1650 additions and 0 deletions

View file

@ -0,0 +1,15 @@
{{ ansible_managed | comment }}
{% for client in bacula_clients %}
Client {
Name = {{ client['name'] }}
Address = {{ client['address'] }}
FDPort = 9102
Catalog = {{ client['catalog'] }}
Password = "{{ client['password'] }}"
File Retention = {{ client['file_retention'] }}
Job Retention = {{ client['job_retention'] }}
AutoPrune = {{ client['autoprune'] }}
}
{% endfor %}

View file

@ -0,0 +1,32 @@
{{ ansible_managed | comment }}
{% for fileset in bacula_filesets %}
FileSet {
Name = {{ fileset['name'] }}
{% if 'include' in fileset %}
Include {
{% if 'options' in fileset['include'] %}
Options {
{% if 'signature' in fileset['include']['options'] %}
signature = {{ fileset['include']['options']['signature'] }}
{% endif %}
{% if 'compression' in fileset['include']['options'] %}
compression = {{ fileset['include']['options']['compression'] }}
{% endif %}
}
{% endif %}
{% for file in fileset['include']['files'] | default([]) | sort %}
File = "{{ file }}"
{% endfor %}
}
{% endif %}
{% if 'exclude' in fileset %}
Exclude {
{% for file in fileset['exclude']['files'] | default([]) | sort %}
File = "{{ file }}"
{% endfor %}
}
{% endif %}
}
{% endfor %}

View file

@ -0,0 +1,60 @@
{{ ansible_managed | comment }}
JobDefs {
Name = BackupDefaults
Type = Backup
Storage = {{ bacula_storage_name }}
Schedule = DefaultSchedule
Priority = 10
Messages = Standard
Pool = FullFile
Full Backup Pool = FullFile
Differential Backup Pool = DiffFile
Incremental Backup Pool = IncrFile
}
{% for job in bacula_jobs %}
Job {
Name = {{ job['name'] }}
JobDefs = BackupDefaults
Client = {{ job['client'] }}
FileSet = {{ job['fileset'] }}
{% if 'priority' in job %}
Priority = {{ job['priority'] }}
{% endif %}
{% if 'level' in job %}
Level = {{ job['level'] }}
{% endif %}
{% if 'schedule' in job %}
Schedule = {{ job['schedule'] }}
{% endif %}
{% if 'run_before_job' in job %}
RunBeforeJob = "{{ job['run_before_job'] }}"
{% endif %}
{% if 'run_after_job' in job %}
RunAfterJob = "{{ job['run_after_job'] }}"
{% endif %}
{% if 'client_run_before_job' in job %}
ClientRunBeforeJob = "{{ job['client_run_before_job'] }}"
{% endif %}
{% if 'client_run_after_job' in job %}
ClientRunAfterJob = "{{ job['client_run_after_job'] }}"
{% endif %}
{% if 'pool' in job %}
Pool = {{ job['pool'] }}
{% endif %}
{% if 'storage' in job %}
Storage = {{ job['storage'] }}
{% endif %}
{% if 'messages' in job %}
Messages = {{ job['messages'] }}
{% endif %}
{% if 'where' in job %}
Where = {{ job['where'] }}
{% endif %}
{% if 'type' in job %}
Type = {{ job['type'] }}
{% endif %}
}
{% endfor %}

View file

@ -0,0 +1,22 @@
Messages {
Name = Standard
{% if bacula_email_address is defined %}
mailcommand = "/usr/bin/mail -r \"Bacula \<%r\>\" -s \"Bacula: %t %e of %c %l\" %r"
operatorcommand = "/usr/bin/mail -r \"Bacula \<%r\>\" -s \"Bacula: Intervention needed for %j\" %r"
mail on error = {{ bacula_email_address }} = all, !skipped, !terminate
{% endif %}
operator = root = mount
console = all, !skipped, !saved
append = "/var/log/bacula/bacula.log" = all, !skipped
catalog = all
}
Messages {
Name = Daemon
{% if bacula_email_address is defined %}
mailcommand = "/usr/bin/mail -r \"Bacula \<%r\>\" -s \"Bacula daemon message\" %r"
mail on error = {{ bacula_email_address }} = all, !skipped, !terminate
{% endif %}
console = all, !skipped, !saved
append = "/var/log/bacula/bacula.log" = all, !skipped
}

View file

@ -0,0 +1,16 @@
{{ ansible_managed | comment }}
{% for pool in bacula_pools | default([]) %}
Pool {
Name = {{ pool['name'] }}
Pool Type = {{ pool['pool_type'] }}
Recycle = {{ pool['recycle'] }}
AutoPrune = {{ pool['auto_prune'] }}
Volume Retention = {{ pool['volume_retention'] }}
Storage = {{ pool['storage'] }}
Maximum Volume Bytes = {{ pool['maximum_volume_bytes'] }}
Maximum Volumes = {{ pool['maximum_volumes'] }}
LabelFormat = "{{ pool['labelformat'] }}"
}
{% endfor %}

View file

@ -0,0 +1,11 @@
{{ ansible_managed | comment }}
{% for schedule in bacula_schedules | default([]) %}
Schedule {
Name = {{ schedule['name'] }}
{% for run in schedule['runs'] %}
Run = {% for k, v in run.get('job_overrides', {}).items() %}{{ k }}={{ v }} {% endfor %} {{ run['datetime'] }}
{% endfor %}
}
{% endfor %}

View file

@ -0,0 +1,12 @@
{{ ansible_managed | comment }}
{% for storage in bacula_storages | default([]) %}
Storage {
Name = {{ storage['name'] }}
Address = {{ storage['address'] }}
Password = "{{ storage['password'] }}"
Device = {{ storage['device'] }}
Media Type = {{ storage['media_type'] }}
}
{% endfor %}