|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- ---
- - hosts: mpdb
- vars:
- share:
- - 'MUSIC'
- - 'MOVIES'
- localpath: '/mnt/'
- remotepath: '/pool/'
- hostname: "home.thrace-lan.info"
- username: "sshfs"
- sshfsport: 22000
- tasks:
- - name: sshfs
- ansible.builtin.group:
- name: sshfs
- state: present
- - name: sshfs
- ansible.builtin.user:
- name: sshfs
- state: present
- group: sshfs
- - name: make ssh home directory
- file:
- path: "/home/sshfs/.ssh/"
- state: directory
- owner: sshfs
- group: sshfs
- mode: '0700'
- - name: copy private key
- copy:
- src: "./sshfs-key"
- dest: "/root/.ssh/"
- owner: root
- group: root
- mode: '0700'
- - name: copy ssh config
- copy:
- src: "./ssh-config"
- dest: "/root/.ssh/config"
- owner: root
- group: root
- mode: '0700'
- - name: "sshfs mount {{ item }}"
- file:
- path: "{{ localpath}}{{ item }}/"
- state: directory
- owner: root
- group: root
- mode: '0777'
- loop: "{{ share }}"
- - name: "mount {{ item}}"
- ansible.builtin.shell: "/usr/bin/sshfs -o reconnect,allow_root,allow_other,_netdev,uid=108 {{ [username,'@',hostname,':',remotepath,item,'/',' ',localpath,item,'/' ]|join() }}"
- loop: "{{ share }}"
|