Ansible repo for digital ocean projects
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

81 rader
1.8 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. notify:
  37. - SSHFS
  38. - name: copy ssh config
  39. copy:
  40. src: "./ssh-config"
  41. dest: "/home/sshfs/.ssh/config"
  42. owner: sshfs
  43. group: sshfs
  44. mode: '0700'
  45. notify:
  46. - SSHFS
  47. - name: "sshfs mount {{ item }}"
  48. file:
  49. path: "{{ localpath}}{{ item }}/"
  50. state: directory
  51. owner: root
  52. group: root
  53. mode: '0777'
  54. loop: "{{ share }}"
  55. notify:
  56. - SSHFS
  57. - name: setup service sshfs
  58. template:
  59. src: ./sshfs.mount.j2
  60. dest: "/usr/lib/systemd/system/sshfs-{{ item }}.service"
  61. mode: 0644
  62. owner: root
  63. group: root
  64. loop: "{{ share }}"
  65. notify:
  66. - SSHFS
  67. - name: "sshfs {{ item }} service start"
  68. systemd:
  69. name: "sshfs-{{ item }}"
  70. state: started
  71. enabled: yes
  72. masked: no
  73. daemon_reload: yes
  74. loop: "{{ share }}"
  75. handlers:
  76. - name: SSHFS
  77. ansible.builtin.service:
  78. name: sshfs {{ item }} service restart"
  79. state: restarted
  80. loop: "{{ share }}"