From ccf32c64feee6bc912c77da0943bd20959be67e8 Mon Sep 17 00:00:00 2001 From: Markus Katharina Brechtel Date: Tue, 20 Dec 2016 05:36:07 +0000 Subject: [PATCH] current --- tasks/main.yml | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index bfc4527..928a7fd 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,20 +1,42 @@ --- +- setup: + gather_subset: "!all" + +- name: install btrfsutils + apt: + pkg: btrfs-tools + state: installed + when: ansible_os_family=="Debian" + +- name: unmount filesystems + mount: + name: "{{ root_target_directory | default('') }}/{{ item.mount_point }}" + state: unmounted + with_items: "{{ filesystems[::-1] }}" + when: + filesystems_state == "unmounted" or + filesystems_state == "formated" + - name: filesystems filesystem: fstype: "{{ item.fstype }}" dev: "{{ item.device }}" - force: yes + opts: "-U {{ item.uuid }}" + force: "{{ filesystems_state == 'formated' }}" with_items: "{{ filesystems }}" + when: + item.device is defined and ( + filesystems_state == "mounted" or + filesystems_state == "formated" ) - name: mount filesystems mount: - name: "{{ mount_directory_target }}/{{ item.mount_point }}" - src: "{{ item.device }}" + name: "{{ root_target_directory | default('') }}/{{ item.mount_point }}" + src: "UUID={{ item.uuid }}" fstype: "{{ item.fstype }}" state: mounted with_items: "{{ filesystems }}" - -- name: sync - command: sync - \ No newline at end of file + when: + filesystems_state == "mounted" or + filesystems_state == "formated" \ No newline at end of file