Skip to content
Snippets Groups Projects
Commit b0291072 authored by nimrod's avatar nimrod
Browse files

Nicer use of variables.

parent df566382
Branches
No related tags found
No related merge requests found
--- ---
- name: Find a mountpoint for {{ device }}
# There can be multiple once with bind mounts or subvolumes, we only need
# one.
set_fact:
# yamllint disable rule:line-length
btrfs_mountpoint: |-
{{ (ansible_facts.mounts|selectattr("device", "equalto", device)|first)["mount"] }}
# yamllint enable rule:line-length
- name: Install btrfs packages - name: Install btrfs packages
apt: apt:
cache_valid_time: 3600 cache_valid_time: 3600
...@@ -34,6 +25,10 @@ ...@@ -34,6 +25,10 @@
src: btrfs_scrub.{{ item }}.j2 src: btrfs_scrub.{{ item }}.j2
vars: &vars vars: &vars
name: '{{ device|replace("/", "_") }}' name: '{{ device|replace("/", "_") }}'
# yamllint disable rule:line-length
mountpoint: |-
{{ (ansible_facts.mounts|selectattr("device", "equalto", device)|first)["mount"] }}
# yamllint enable rule:line-length
tags: [scrub] tags: [scrub]
- name: Enable btrfs scrub timers - name: Enable btrfs scrub timers
......
...@@ -6,4 +6,4 @@ After=network-online.target ...@@ -6,4 +6,4 @@ After=network-online.target
[Service] [Service]
Type=exec Type=exec
ExecStart=mnpw --warn -- /usr/lib/nagios-btrfs/plugins/check_btrfs --mountpoint {{ btrfs_mountpoint }} ExecStart=mnpw --warn -- /usr/lib/nagios-btrfs/plugins/check_btrfs --mountpoint {{ mountpoint }}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment