Files
dotfiles/config/ansible/tasks/servers/cifs.yml
2025-03-11 18:46:31 +01:00

46 lines
1.4 KiB
YAML

---
- name: Configure CIFS
block:
- name: Install CIFS utilities
become: true
ansible.builtin.package:
name: cifs-utils
state: present
- name: Create mount point directory
become: true
ansible.builtin.file:
path: /mnt/storage-box
state: directory
mode: '0755'
- name: Create credentials file
become: true
ansible.builtin.copy:
dest: /root/.smbcredentials
content: |
username=u451316
password={{ lookup('onepassword', '5j5y5axfjr3f3sn5nixb6htg4y', vault='j7nmhqlsjmp2r6umly5t75hzb4') | default('CHANGE_ME') }}
mode: '0600'
- name: Add fstab entry for storage-box
become: true
ansible.builtin.lineinfile:
path: /etc/fstab
line: "//u451316.your-storagebox.de/backup /mnt/storage-box cifs credentials=/root/.smbcredentials,uid=1000,gid=100,iocharset=utf8,vers=3.0 0 0"
regexp: "^//u451316.your-storagebox.de/backup"
state: present
notify: Systemctl daemon-reload
- name: Mount storage-box
become: true
ansible.builtin.mount:
path: /mnt/storage-box
src: //u451316.your-storagebox.de/backup
fstype: cifs
opts: credentials=/root/.smbcredentials,uid=1000,gid=100,iocharset=utf8,vers=3.0
state: mounted
- name: Handlers
ansible.builtin.meta: flush_handlers