Ansible repo for digital ocean projects
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

54 lignes
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: "/root/.ssh/"
  33. owner: root
  34. group: root
  35. mode: '0700'
  36. - name: copy ssh config
  37. copy:
  38. src: "./ssh-config"
  39. dest: "/root/.ssh/config"
  40. owner: root
  41. group: root
  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 -v -o allow_root,allow_other,default_permissions {{ [username,'@',hostname,':',remotepath,item,'/',' ',localpath,item,'/' ]|join() }}"
  53. loop: "{{ share }}"