homeserver/roles/mgrote_mount_cifs/tasks/main.yml
Michael Grote bc6f8fdc9e
All checks were successful
ansible-lint / gitleaks (push) Successful in 5s
ansible-lint / Ansible Lint (push) Successful in 1m0s
add no_log as global variable (#233)
Reviewed-on: #233
Co-authored-by: Michael Grote <michael.grote@posteo.de>
Co-committed-by: Michael Grote <michael.grote@posteo.de>
2024-11-10 15:56:59 +01:00

44 lines
1.2 KiB
YAML

---
- name: install cifs-utils
become: true
ansible.builtin.package:
name: cifs-utils
state: present
when: cifs_mounts is defined
- name: create mount directory
become: true
ansible.builtin.file:
path: "{{ item.dest }}"
state: directory
mode: "0777"
loop: "{{ cifs_mounts }}"
no_log: "{{ no_debug | default('true') }}"
when: cifs_mounts is defined
- name: create credential-file
become: true
ansible.builtin.template:
src: smb_passwords
dest: /root/.smb_passwords_{{ item.name }}
owner: root
group: root
mode: '0400'
loop: "{{ cifs_mounts }}"
no_log: "{{ no_debug | default('true') }}"
when: cifs_mounts is defined
- name: mount cifs volumes
become: true
ansible.posix.mount:
src: "{{ item.src }}"
path: "{{ item.dest }}"
opts: credentials=/root/.smb_passwords_{{ item.name }},domain={{ item.domain }},uid={{ item.uid | default('1000') }},gid={{ item.gid | default('1000') }}{{ item.extra_opts | default(omit) }}"
state: "{{ item.state }}"
fstype: "{{ item.type }}"
backup: true
dump: "0"
passno: "0"
loop: "{{ cifs_mounts }}"
no_log: "{{ no_debug | default('true') }}"
when: cifs_mounts is defined