Ansible repo for digital ocean projects
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

43 行
1.1 KiB

  1. ---
  2. - hosts: mpdb, mpdf
  3. vars:
  4. share:
  5. - 'MUSIC'
  6. - 'MOVIES'
  7. localpath: '/mnt/'
  8. remotepath: '/pool/'
  9. hostname: "home.thrace-lan.info"
  10. username: "sshfs"
  11. sshfsport: 22000
  12. tasks:
  13. - name: sshfs install
  14. apt:
  15. name: sshfs
  16. state: latest
  17. update_cache: yes
  18. - name: copy private key
  19. copy:
  20. src: "./sshfs-key"
  21. dest: "/root/.ssh/"
  22. owner: root
  23. group: root
  24. mode: '0700'
  25. - name: copy ssh config
  26. copy:
  27. src: "./ssh-config"
  28. dest: "/root/.ssh/config"
  29. owner: root
  30. group: root
  31. mode: '0700'
  32. - name: "sshfs mount {{ item }}"
  33. file:
  34. path: "{{ localpath}}{{ item }}/"
  35. state: directory
  36. owner: root
  37. group: root
  38. mode: '0777'
  39. loop: "{{ share }}"
  40. - name: "mount {{ item}}"
  41. ansible.builtin.shell: "/usr/bin/sshfs -o reconnect,allow_root,allow_other,_netdev {{ [username,'@',hostname,':',remotepath,item,'/',' ',localpath,item,'/' ]|join() }}"
  42. loop: "{{ share }}"