set password in samba share volume mounts

pull/41/head
Cian Hatton 3 years ago
parent 3be65ad154
commit b9f20716ed

@ -6,6 +6,7 @@ services:
- name: linkding - name: linkding
- name: pihole - name: pihole
- name: hasteypaste - name: hasteypaste
- name: vpn-stack
- name: dashboards - name: dashboards
template_vars: template_vars:
dashy: false dashy: false

@ -35,25 +35,51 @@
- name: Samba Clients - name: Samba Clients
hosts: sambaclients hosts: sambaclients
become: true become: true
tags: [samba]
pre_tasks: pre_tasks:
- name: Include vault variables. - name: Include vault variables.
ansible.builtin.include_vars: '../{{ vault_file }}' ansible.builtin.include_vars: '../{{ vault_file }}'
tags: [always] tags: [always]
tasks: tasks:
- name: Install CIFS and other required packages for mounting with apt
apt:
name: "{{ item }}"
state: present
with_items:
- smbclient
- cifs-utils
- name: Check mountpoint exists. - name: Check mountpoint exists.
ansible.builtin.file: ansible.builtin.file:
path: "/mnt/mergerfs" path: "/mnt/mergerfs"
state: directory state: directory
mode: '0755' mode: '0755'
owner: root owner: cianhatton
group: root group: cianhatton
- name: Mount share.
tags: [samba] - name: Check mountpoint exists.
ansible.builtin.file:
path: "/mnt/ssd0"
state: directory
mode: '0755'
owner: cianhatton
group: cianhatton
- name: Mount shares.
mount: mount:
state: "mounted" state: "mounted"
fstype: "cifs" fstype: "cifs"
path: /mnt/mergerfs path: /mnt/mergerfs
src: '//192.168.178.42/mergerfs' src: '//192.168.178.42/mergerfs'
opts: 'username=cianhatton,password={{ cianhatton_password }}'
- name: Mount shares.
mount:
state: "mounted"
fstype: "cifs"
path: /mnt/ssd0
src: '//192.168.178.42/ssd0'
opts: 'username=cianhatton,password={{ cianhatton_password }}'
- name: Install Docker on Docker hosts. - name: Install Docker on Docker hosts.
hosts: docker hosts: docker

@ -8,4 +8,21 @@ map to guest = Bad User
# the order in which it checks for host names # the order in which it checks for host names
name resolve order = bcast host name resolve order = bcast host
# include a separate config # include a separate config
include = /etc/samba/shares.conf
# the user that we're going to force this to be shared as
force user = smbuser
force group = smbgroup
# permissions for new files
create mask = 0664
force create mode = 0664
# permissions for new directories
directory mask = 0775
force directory mode = 0775
public = yes
writable = yes
[mergerfs]
path = /mnt/mergerfs
[ssd0]
path = /mnt/ssd0

@ -1,11 +1,4 @@
--- ---
#- name: Install samba packages using apt.
# ansible.builtin.apt:
# name:
# - samba
# state: present
# update_cache: true
- name: Ensure samba group exists. - name: Ensure samba group exists.
ansible.builtin.group: ansible.builtin.group:
name: '{{ samba_group }}' name: '{{ samba_group }}'

Loading…
Cancel
Save