---
- name: Enable suid_file for Debian based distros
  debconf:
    name: davfs2
    question: davfs2/suid_file
    value: true
    vtype: boolean
  when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'

- name: Install davfs2 package
  package:
    name: davfs2
    state: present

- name: setuid /usr/sbin/mount.davfs
  file:
    path: /usr/sbin/mount.davfs
    state: file
    mode: 'u=rws,g=rx,o=rx'

- name: Disable use_locks in /etc/davfs2/davfs2.conf
  replace:
    dest: /etc/davfs2/davfs2.conf
    regexp: '#\suse_locks\s+1'
    replace: 'use_locks 0'

- name: Add user to davfs2 group
  user:
    name: '{{ default_user }}'
    groups: davfs2
    append: yes

- name: Copy cloudstor-setup script
  copy:
    src: cloudstor-setup
    dest: /usr/local/bin
    mode: 0755
  

---
- name: Enable suid_file for Debian based distros
  debconf:
    name: davfs2
    question: davfs2/suid_file
    value: true
    vtype: boolean
  when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'

- name: Add openSUSE repo
  zypper_repository:
    name: filesystems
    repo: "http://download.opensuse.org/repositories/filesystems/openSUSE_Leap_{{ ansible_distribution_version }}"
    auto_import_keys: yes
    state: present
  when: ansible_distribution == 'openSUSE Leap'

- name: Install davfs2 package
  package:
    name: davfs2
    state: present

- name: Remove openSUSE repo
  zypper_repository:
    name: filesystems
    state: absent
  when: ansible_distribution == 'openSUSE Leap'

- name: setuid /usr/sbin/mount.davfs
  file:
    path: /usr/sbin/mount.davfs
    state: file
    mode: 'u=rws,g=rx,o=rx'

- name: Disable use_locks in /etc/davfs2/davfs2.conf
  replace:
    dest: /etc/davfs2/davfs2.conf
    regexp: '#\suse_locks\s+1'
    replace: 'use_locks 0'

- name: Add user to davfs2 group
  user:
    name: '{{ default_user }}'
    groups: davfs2
    append: yes

- name: Copy cloudstor-setup script
  copy:
    src: cloudstor-setup
    dest: /usr/local/bin
    mode: 0755
  

Add extra repo for davfs2 on openSUSE 42
Add extra repo for davfs2 on openSUSE 42

Change-Id: I5fbf5a33ab6707bc0e29e7ebd06e0a252f7e4a61
