Ansible repo for digital ocean projects
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

54 linhas
1.3 KiB

  1. ---
  2. - hosts: mpdb
  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
  14. ansible.builtin.group:
  15. name: sshfs
  16. state: present
  17. - name: sshfs
  18. ansible.builtin.user:
  19. name: sshfs
  20. state: present
  21. group: sshfs
  22. - name: make ssh home directory
  23. file:
  24. path: "/home/sshfs/.ssh/"
  25. state: directory
  26. owner: sshfs
  27. group: sshfs
  28. mode: '0700'
  29. - name: copy private key
  30. copy:
  31. src: "./sshfs-key"
  32. dest: "/home/sshfs/.ssh/"
  33. owner: sshfs
  34. group: sshfs
  35. mode: '0700'
  36. - name: copy ssh config
  37. copy:
  38. src: "./ssh-config"
  39. dest: "/home/sshfs/.ssh/config"
  40. owner: sshfs
  41. group: sshfs
  42. mode: '0700'
  43. - name: "sshfs mount {{ item }}"
  44. file:
  45. path: "{{ localpath}}{{ item }}/"
  46. state: directory
  47. owner: root
  48. group: root
  49. mode: '0777'
  50. loop: "{{ share }}"
  51. - name: "mount {{ item}}"
  52. ansible.builtin.shell: "/usr/bin/sshfs -o allow_root,allow_other,default_permissions {{ [username,'@',hostname,':',remotepath,item,'/',' ',localpath,item,'/' ]|join() }}"
  53. loop: "{{ share }}"