Ansible repo for digital ocean projects
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

sshfs.yaml 1.5 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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: 2200
  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: setup service sshfs
  52. template:
  53. src: sshfs.service.j2
  54. dest: "/usr/lib/systemd/system/sshfs-{{ item }}.service"
  55. mode: 0644
  56. owner: root
  57. group: root
  58. loop: "{{ share }}"
  59. - name: "Sshfs {{ item }} service start"
  60. systemd:
  61. name: "sshfs-{{ item }}"
  62. state: started
  63. enabled: yes
  64. masked: no
  65. daemon_reload: yes
  66. loop: "{{ share }}"