Skip to content

Commit

Permalink
feat: add device options, set defaults
Browse files Browse the repository at this point in the history
Add missing option "count" for devices.
Add defaults for boolean options for devices.
  • Loading branch information
adf-patrickha committed Nov 20, 2024
1 parent 2d89ff7 commit aa67f29
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
13 changes: 13 additions & 0 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,19 @@
autochanger: true
- name: "disabled-device"
enabled: false
- name: Count_Device
count: 10
media_type: "File"
archive_device: "/var/lib/bareos/storage"
label_media: false
removable_media: true
maximum_concurrent_jobs: 55
label_media: true
random_access: true
automatic_mount: true
removable_media: false
always_open: false
auto_select: true
bareos_sd_directors:
- name: bareos-dir
password: "somepassword"
Expand Down
1 change: 0 additions & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@
- Check configuration
- Restart bareos-sd


- name: Start and enable bareos-sd service
ansible.builtin.service:
name: bareos-sd
Expand Down
18 changes: 12 additions & 6 deletions templates/device.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

{% if item.enabled is defined and item.enabled or item.enabled is not defined %}
Device {
{% if item.count is defined %}
# multiply this device Count times
Count = {{ item.count }}

{% endif %}
Name = "{{ item.name }}"
{% if item.description is defined %}
Description = "{{ item.description }}"
Expand All @@ -17,12 +22,13 @@ Device {
{% if item.device_options is defined %}
Device Options = "{{ item.device_options }}"
{% endif %}
LabelMedia = {{ item.label_media | ternary('yes', 'No') }}
Random Access = {{ item.random_access | ternary('yes', 'No') }}
AutomaticMount = {{ item.automatic_mount | ternary('yes', 'No') }}
RemovableMedia = {{ item.removable_media | ternary('yes', 'No') }}
AlwaysOpen = {{ item.always_open | ternary('yes', 'No') }}
Autochanger = {{ item.autochanger | ternary('yes', 'No') }}
AlwaysOpen = {{ item.always_open | default(true) | ternary('yes', 'No') }}
Autochanger = {{ item.autochanger | default(false) | ternary('yes', 'No') }}
AutomaticMount = {{ item.automatic_mount | default(false) | ternary('yes', 'No') }}
AutoSelect = {{ item.auto_select | default(true) | ternary('yes', 'No') }}
LabelMedia = {{ item.label_media | default(false) | ternary('yes', 'No') }}
Random Access = {{ item.random_access | default(false) | ternary('yes', 'No') }}
RemovableMedia = {{ item.removable_media | default(true) | ternary('yes', 'No') }}
}
{% else %}
# This file is not enabled.
Expand Down

0 comments on commit aa67f29

Please sign in to comment.