Ansible repo for digital ocean projects
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

53 строки
1.2 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: 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: copy private key
  23. copy:
  24. src: "./sshfs-key"
  25. dest: "/home/sshfs/.ssh/"
  26. owner: sshfs
  27. group: sshfs
  28. mode: '0700'
  29. - name: "sshfs mount {{ item }}"
  30. file:
  31. path: "{{ localpath}}{{ item }}/"
  32. state: directory
  33. owner: root
  34. group: root
  35. mode: '0777'
  36. loop: "{{ share }}"
  37. - name: setup service sshfs
  38. template:
  39. src: sshfs.service.j2
  40. dest: "/usr/lib/systemd/system/sshfs-{{ item }}.service"
  41. mode: 0644
  42. owner: root
  43. group: root
  44. loop: "{{ share }}"
  45. - name: "Sshfs {{ item }} service start"
  46. systemd:
  47. name: "sshfs-{{ item }}"
  48. state: started
  49. enabled: yes
  50. masked: no
  51. daemon_reload: yes
  52. loop: "{{ share }}"