|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- ---
- - 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: "/home/sshfs/.ssh/"
- owner: sshfs
- group: sshfs
- mode: '0700'
- - name: copy ssh config
- copy:
- src: "./ssh-config"
- dest: "/home/sshfs/.ssh/config"
- owner: sshfs
- group: sshfs
- 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.command: "/usr/bin/sshfs -o allow_root {{ [username,'@',hostname,':',remotepath,item,'/',' ',localpath,item,'/' ]|join() }}"
- become_user: sshfs
- loop: "{{ share }}"
|