29 lines
841 B
YAML
29 lines
841 B
YAML
- ansible.builtin.import_role:
|
|
role: ensuredir
|
|
become: true
|
|
vars:
|
|
path: "{{ subvpath | dirname }}"
|
|
|
|
- name: check if btrfs subv exists
|
|
register: btrfssubvexists
|
|
become: true
|
|
failed_when: false
|
|
changed_when: false
|
|
ansible.builtin.shell: "btrfs subv list {{ subvpath | mandatory | dirname }} | grep -qF {{ subvpath | basename }}"
|
|
|
|
- block:
|
|
- name: "create btrfs subv {{ subvpath | mandatory }}"
|
|
when: btrfssubvexists.rc != 0
|
|
become: true
|
|
ansible.builtin.command:
|
|
cmd: "btrfs subv create {{ subvpath }}"
|
|
- name: "set owner:group of subv {{ subvpath }}"
|
|
when: btrfssubvexists.rc != 0
|
|
become: true
|
|
ansible.builtin.file:
|
|
state: touch
|
|
path: "{{ subvpath | mandatory }}"
|
|
owner: "{{ owner | mandatory }}"
|
|
group: "{{ group | default(owner) }}"
|
|
|