mount samba share in snunmu

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

@ -12,12 +12,6 @@ users:
group: *main_user group: *main_user
passwordless_sudo: true passwordless_sudo: true
shares:
- /share
- /share/public_files
- /share/private_files
- /share/cian_files
directories: directories:
# path on qnap where downloads go # path on qnap where downloads go
downloads_dir: /mnt/ssd0/downloads downloads_dir: /mnt/ssd0/downloads

@ -8,6 +8,9 @@ snunmus
[qnaps] [qnaps]
qnap qnap
[sambaclients]
snunmu
[snunmus] [snunmus]
snunmu snunmu

@ -18,6 +18,12 @@
- role: setup_mergerfs - role: setup_mergerfs
tags: [mergerfs] tags: [mergerfs]
- name: Configure samba shares.
hosts: all
become: true
roles:
- role: geerlingguy.samba
tags: [samba]
- name: Configure samba shares. - name: Configure samba shares.
hosts: samba hosts: samba
@ -26,6 +32,28 @@
- role: setup_samba - role: setup_samba
tags: [samba] tags: [samba]
- name: Samba Clients
hosts: sambaclients
become: true
pre_tasks:
- name: Include vault variables.
ansible.builtin.include_vars: '../{{ vault_file }}'
tags: [always]
tasks:
- name: Check mountpoint exists.
ansible.builtin.file:
path: "/mnt/mergerfs"
state: directory
mode: '0755'
owner: root
group: root
- name: Mount share.
tags: [samba]
mount:
state: "mounted"
fstype: "cifs"
path: /mnt/mergerfs
src: '//192.168.178.42/mergerfs'
- name: Install Docker on Docker hosts. - name: Install Docker on Docker hosts.
hosts: docker hosts: docker

@ -3,6 +3,7 @@ roles:
- src: sprat.mergerfs - src: sprat.mergerfs
- src: geerlingguy.pip - src: geerlingguy.pip
- src: geerlingguy.docker - src: geerlingguy.docker
- src: geerlingguy.samba
collections: collections:
- name: https://github.com/chatton/ansible-portainer.git - name: https://github.com/chatton/ansible-portainer.git

@ -0,0 +1,4 @@
# These are supported funding model platforms
---
github: geerlingguy
patreon: geerlingguy

@ -0,0 +1,56 @@
# Configuration for probot-stale - https://github.com/probot/stale
# Number of days of inactivity before an Issue or Pull Request becomes stale
daysUntilStale: 90
# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
daysUntilClose: 30
# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled)
onlyLabels: []
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
exemptLabels:
- pinned
- security
- planned
# Set to true to ignore issues in a project (defaults to false)
exemptProjects: false
# Set to true to ignore issues in a milestone (defaults to false)
exemptMilestones: false
# Set to true to ignore issues with an assignee (defaults to false)
exemptAssignees: false
# Label to use when marking as stale
staleLabel: stale
# Limit the number of actions per hour, from 1-30. Default is 30
limitPerRun: 30
pulls:
markComment: |-
This pull request has been marked 'stale' due to lack of recent activity. If there is no further activity, the PR will be closed in another 30 days. Thank you for your contribution!
Please read [this blog post](https://www.jeffgeerling.com/blog/2020/enabling-stale-issue-bot-on-my-github-repositories) to see the reasons why I mark pull requests as stale.
unmarkComment: >-
This pull request is no longer marked for closure.
closeComment: >-
This pull request has been closed due to inactivity. If you feel this is in error, please reopen the pull request or file a new PR with the relevant details.
issues:
markComment: |-
This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!
Please read [this blog post](https://www.jeffgeerling.com/blog/2020/enabling-stale-issue-bot-on-my-github-repositories) to see the reasons why I mark issues as stale.
unmarkComment: >-
This issue is no longer marked for closure.
closeComment: >-
This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.

@ -0,0 +1,67 @@
---
name: CI
'on':
pull_request:
push:
branches:
- master
schedule:
- cron: "0 3 * * 4"
defaults:
run:
working-directory: 'geerlingguy.samba'
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Check out the codebase.
uses: actions/checkout@v2
with:
path: 'geerlingguy.samba'
- name: Set up Python 3.
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install test dependencies.
run: pip3 install yamllint ansible-lint
- name: Lint code.
run: |
yamllint .
ansible-lint
molecule:
name: Molecule
runs-on: ubuntu-latest
strategy:
matrix:
distro:
- centos7
- ubuntu2004
steps:
- name: Check out the codebase.
uses: actions/checkout@v2
with:
path: 'geerlingguy.samba'
- name: Set up Python 3.
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install test dependencies.
run: pip3 install ansible molecule[docker] docker
- name: Run Molecule tests.
run: molecule test
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
MOLECULE_DISTRO: ${{ matrix.distro }}

@ -0,0 +1,38 @@
---
# This workflow requires a GALAXY_API_KEY secret present in the GitHub
# repository or organization.
#
# See: https://github.com/marketplace/actions/publish-ansible-role-to-galaxy
# See: https://github.com/ansible/galaxy/issues/46
name: Release
'on':
push:
tags:
- '*'
defaults:
run:
working-directory: 'geerlingguy.samba'
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Check out the codebase.
uses: actions/checkout@v2
with:
path: 'geerlingguy.samba'
- name: Set up Python 3.
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install Ansible.
run: pip3 install ansible-base
- name: Trigger a new import on Galaxy.
run: ansible-galaxy role import --api-key ${{ secrets.GALAXY_API_KEY }} $(echo ${{ github.repository }} | cut -d/ -f1) $(echo ${{ github.repository }} | cut -d/ -f2)

@ -0,0 +1,3 @@
*.retry
*/__pycache__
*.pyc

@ -0,0 +1,10 @@
---
extends: default
rules:
line-length:
max: 120
level: warning
ignore: |
.github/stale.yml

@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2017 Jeff Geerling
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

@ -0,0 +1,31 @@
# Ansible Role: Samba (SMB)
[![CI](https://github.com/geerlingguy/ansible-role-samba/workflows/CI/badge.svg?event=push)](https://github.com/geerlingguy/ansible-role-samba/actions?query=workflow%3ACI)
Installs Samba client and server for RHEL/CentOS.
## Requirements
Samba requires ports 137, 138, 139, 445 to be open to function properly. For easy firewall configuration, you can use the `geerlingguy.firewall` role.
## Role Variables
None.
## Dependencies
None.
## Example Playbook
- hosts: servers
roles:
- geerlingguy.samba
## License
MIT / BSD
## Author Information
This role was created in 2014 by [Jeff Geerling](https://www.jeffgeerling.com/), author of [Ansible for DevOps](https://www.ansiblefordevops.com/).

@ -0,0 +1,3 @@
---
- name: restart smb
service: "name={{ samba_daemon }} state=restarted"

@ -0,0 +1,2 @@
install_date: Fri 16 Sep 18:30:26 2022
version: 1.2.0

@ -0,0 +1,33 @@
---
dependencies: []
galaxy_info:
role_name: samba
author: geerlingguy
description: "Samba for RHEL/CentOS."
company: "Midwestern Mac, LLC"
license: "license (BSD, MIT)"
min_ansible_version: 2.0
platforms:
- name: EL
versions:
- 7
- 8
- name: Fedora
versions:
- all
- name: Ubuntu
versions:
- all
- name: Debian
versions:
- all
galaxy_tags:
- networking
- system
- samba
- windows
- filesystem
- fileshare
- sharing
- files

@ -0,0 +1,12 @@
---
- name: Converge
hosts: all
become: true
pre_tasks:
- name: Update apt cache.
apt: update_cache=true cache_valid_time=600
when: ansible_os_family == 'Debian'
roles:
- role: geerlingguy.samba

@ -0,0 +1,17 @@
---
dependency:
name: galaxy
driver:
name: docker
platforms:
- name: instance
image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
privileged: true
pre_build_image: true
provisioner:
name: ansible
playbooks:
converge: ${MOLECULE_PLAYBOOK:-converge.yml}

@ -0,0 +1,27 @@
---
- name: Include OS-specific variables.
include_vars: "{{ ansible_os_family }}.yml"
- name: Ensure Samba-related packages are installed (RedHat).
package:
name:
- samba
- samba-client
- samba-common
- cifs-utils
state: present
when: ansible_os_family == 'RedHat'
- name: Ensure Samba-related packages are installed (Debian).
apt:
name:
- samba
- samba-common
state: present
when: ansible_os_family == 'Debian'
- name: Ensure Samba is running and set to start on boot.
service:
name: "{{ samba_daemon }}"
state: started
enabled: true

@ -0,0 +1,2 @@
---
samba_daemon: smbd

@ -0,0 +1,2 @@
---
samba_daemon: smb

@ -3,8 +3,3 @@ samba_group: smbgroup
samba_user: smbuser samba_user: smbuser
users: users:
- name: cianhatton - name: cianhatton
shares:
- /share
- /share/public_files
- /share/private_files
- /share/cian_files

@ -1,9 +1,13 @@
[Cian Private Files] [mergerfs]
comment= My Private Files path = /mnt/mergerfs
path = /share/cian_files # the user that we're going to force this to be shared as
valid users = cianhatton force user = smbuser
public = no 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 writable = yes
browsable = yes
printable = no
create mask = 0765

@ -1,18 +1,17 @@
--- ---
- name: Install samba packages using apt. #- name: Install samba packages using apt.
ansible.builtin.apt: # ansible.builtin.apt:
name: # name:
- samba # - samba
state: present # state: present
update_cache: true # 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 }}'
state: present state: present
system: true system: true
notify: notify: reload-samba
- reload-samba
- name: Ensure samba user. - name: Ensure samba user.
ansible.builtin.user: ansible.builtin.user:
@ -21,8 +20,8 @@
group: '{{ samba_group }}' group: '{{ samba_group }}'
shell: /bin/false shell: /bin/false
create_home: false create_home: false
notify: system: true
- reload-samba notify: reload-samba
- name: Add the User(s) to Samba group. - name: Add the User(s) to Samba group.
ansible.builtin.user: ansible.builtin.user:
@ -31,18 +30,6 @@
append: true append: true
with_items: '{{ users }}' with_items: '{{ users }}'
- name: Ensure Share directories.
ansible.builtin.file:
path: '{{ item }}'
recurse: true
state: directory
owner: '{{ samba_user }}'
group: '{{ samba_group }}'
mode: u+rw,g+rw
with_items: '{{ shares }}'
notify:
- reload-samba
- name: Copy smb conf files. - name: Copy smb conf files.
ansible.builtin.copy: ansible.builtin.copy:
src: '{{ item }}' src: '{{ item }}'
@ -53,5 +40,4 @@
with_items: with_items:
- smb.conf - smb.conf
- shares.conf - shares.conf
notify: notify: reload-samba
- reload-samba

@ -1,56 +1,58 @@
$ANSIBLE_VAULT;1.1;AES256 $ANSIBLE_VAULT;1.1;AES256
36366133663433613231613961343232323738393961386166343066373337333633313564653266 38366336316537373531646663386366353637653033356132626234613030323164623166666562
3465326438343038323338653835363837323863663735370a333936383738303331366431636462 3161643863653338366165326266636230633263343463390a373062636335313365346139393562
35373964653835303530336139303163383162363164313333356535666339393231633461313162 39333837656436396562383665363631313761396438353965643038313466396439636463663564
3861663065633736620a306437666563616266386439373464643635396632633164623066613362 3336653637353634390a396137666430643131666430363131336163303938323931386336623262
63666666306634326638346466646635353333623730303136353761363439396631346665643134 39653331336539313931323465376637373039663033336261376230386134383665623339656561
61656133323461346639623534633331623533663430643739346261623766343933643937393263 30306265306331633035366465353730623366666638386536353136396336336561383364346566
65313431613064333361363165653632343462636262396435306666326136313139313837313539 34386365653234323930633437346137316464356366616264326361313236303235333664613737
34313939633538613661393065656438306537343863653135316530636133373933363638316332 34376435383239393432343136613837306431396666633431386663353334373237326536383731
64333738633332313233383833393932613535613037373637393236383835333363626332353763 30363861353035646664336663373730353738363435613533386364623732656464616332666164
31316163343633363463386465616439313661663236663734623438653262643831613932646561 33333165656133393138363730363664663765386366383637643665333163316235626263653866
30633034633364616338343463366233376663613536623865663036353333656366393134396332 30333031666564623038326432333630366466383164373061616532653235656632313837646232
39666666343963373539656665306366643736393962323138333636656366623666396638643662 39373232633062313634353463303735333037333264643266303535633736613763303432646563
32666533356661306137663037663563393634333166353938623434663563366466656463666334 66633738633439656361626534326633633365393437653063333863323664313838616432396436
39373831303835636331636235616361323435646434653638663561353161633037396634353863 61653061373465663665333663333838663664323335626664306330363363303830373035666262
66333065386439376537653530323431343834346636663564333835373635356233396334356438 61386131393230623533333136626239376136333636383661616636643936373166343361666164
61383537653533326565393536623639636434323934376537343030643364333134353731396438 63613630313366363561373439363437396430633730366337313738636439363731346365323966
31333766383063353630363465323330376139646537356165666361323036376535663433643865 34386262393162663032623637636336623163623966343065633930646263633066613633393664
38353461393937313833623263356134313935666639333032653434333739393438656561313138 32346364363461376633373938613463646531383861346334376564626466623866616561313436
64366434376637353139376566623764393562663134353330313162656239653064363136333363 64303936353130646365326462323566323636373161356562663866313932613237643935643133
30383266646331363338326633383263643739323031393766653833356130353366356535373361 62386133613936613034333362636531636166666466306135393236646431646465343539303439
36633261386336316361653433663637373034623963646561323132613066653337313031326563 37373861656461356638316465386539376139623432376262656363626161636661623363323066
63313962343730613436323966323562633563323664656234303064346666303164623831356561 37656536363637656362666662643664613832393666383563323339626561653539346237653664
31613664303331633830393165383135373563626261363930363362336131623965373136396634 61633366326334376364356530383332666363363631303532383035373133636438626339373932
38316232653739393439386133306338626462343566633330363336363238346562323561373237 33383033626637326630333239623866343438643739366632656138633162303466626531646336
66653831396135653032366637323839316533323661633264656432663039303737336535376635 61353834623661623537353537636364623431313435333635396661613364376564613736343638
32353064613964303738393936373561626661316662336634663637383465646337633964636364 36633764636638313332643830626566353566373661386463386662643230666438346164363562
30336166393463343664343062366532656365636634313766613766313132623962376665306439 35303736616561343831353631313033633864623730333339383364393964393239623133303537
31386133623734626338326165623762396338386134346364373336616139616330386166303433 66613630626338623734306565323634633562306336633464636639656133316531383162376333
32373338326366623237346561396663373839313833666238393937333937396231326465653939 65306338643433373663373937366661336361326166613364613337626665623335303130303730
35333439323439626332616461363165313732366434333462373464343338356230353630636139 63316234613430663766373566343539636161626138616236393263666264666534333038313964
61323837376134343061353666356531316565616539646162313964336334653237626431643034 31393235313962323364316163653139303637626161623266633437316135313861616139356466
35386664383030373037333537383437336234646136643233366339626266666233643563333965 62653036643761366438326663646561346234303032336131323066666664636336363062313865
30336364613566303634653530386136656239383763636338346436653833653434306438346534 30396438383631616332393463363134386436316664383664343439393339626634376534383030
65393131306365663837366365656335643763616162643064356561386635383064353339626335 62323933373161623639626262316531396234393462613663336235336439333032653337336263
31393438373137363937346236343035633363316661663637393661613066343862313464306165 66663438323036373237616230616431353562343631333262623639653732656264323164396232
30306561326131383336346263366637396362646138313136633466333833663033363961633466 35353332653035626461376166633164346334353438633433336565636264356566323532363837
31343439353863343264306238633064623763343863343564383163653639303164363461346437 65326531623332373438666663336532383763323338396264393963653565386563343832636634
33616433656566653065343932386466343436313531363263306637383235353666666233363666 39623535653862353635666432373434323564613131326361363862666464653565666264373034
62656537303237323034613731343561323766613336363064346334366263663737646132393130 33326364366434366435386232346235376633366666643232366530653733366535376431363663
36323466323262323937396137366161383066323537353136323832633066383866336365316535 66396239623336346466653032303335623031656437656236653533376534306630323462346231
37653530323365656633643837666538316537323033613431333839303133326337393233643238 62626463633134376165653961643137646264396262383836663764353433323534373965646634
30393630643439653733373733393330366466386564646431643232376234373734316637656130 32366566393639386266303638393233303737646437336664383266343637393339613532356132
34303262633331643736396635663232653332366366616636346539666430313266363736303036 36343835643038653137653132643264356163623165383930656438383533643262653164326133
66376530323538323439313834326262343234633361626130303535313162306365616265323131 34626633366238343536313139643362386335316436333431396230663166383339623564613630
32353663396434636134663033396264383061323637356438363362626332363163393734386531 64636136306161626562366363653232633066616138336638663539623931653262396135303436
62666365633335303264393230303730613731376433613462306464393836626434613961656430 61646365656538333666623036373461316632306465393864653636313834393438653834393561
31393761316666656637633666316335356433643966363565633934393133653166333731333930 34313162623861643266353435373061633138633562333635316636323735343638366164376461
31653430656365376133643964336237353064636533313135313965333738386365373638623138 38656366633636383038396464386539383038636565623764393734303862323135626138626232
65313432386463336338356134373564633938376233343361623932626264623938373333616536 31653230653666653335626436336431343764316636373736356465653564336664656535373066
64333361376165396665373163316666383830653262343732306536623432353065626532663731 65643634303166393633316533326536643163373564646336386361363838636463623234313936
63623434613866346532396564303634653565386661363838366339333338353633363437323636 61646631346333303263343135376561333362613838623966666432653834356538303039636138
37346331323836333561666165393661353730646164636233343362333334626133333934616462 62373365313238393861663935333434346366303738636362343463313934343161643138396638
66303532636436646632626632326632353732633833653330326632666538363334303965373262 35663966633163313236326234326435376137356337373333336238666566626434396562376566
38343639303730316235313538333636313438346130386535313334373434333239393366383661 33313734633965313232386361663265393234383634323033326239323631633964643566353266
373434663138393331353436313837313765 64323536313963313132663465613735333737343065623630633038373363636635323964383731
63373162303330646365616331313465626265346130383831646231636463653665653361303735
3561

Loading…
Cancel
Save