main.yml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. ---
  2. - name: Dependencies installed
  3. # We install xmlsec and cairocffi using pkg because python-Levenshtein is tricky to install on FreeBSD
  4. community.general.pkgng:
  5. name: git-tiny,direnv,jpeg-turbo,tiff,webp,lcms2,freetype2,yarn-node16,cairo,pango,gmake,xmlsec1,libxml2,libxslt,bash,cmake,ninja,postgresql13-client
  6. state: latest
  7. - name: Tmux config installed
  8. copy:
  9. src: tmux.conf
  10. dest: /root/.tmux.conf
  11. mode: 0644
  12. - name: Github SSH key installed
  13. template:
  14. src: sshkey.j2
  15. dest: /root/.ssh/id_ed25519
  16. mode: 0400
  17. - name: Nginx location file installed
  18. copy:
  19. src: nginx-location.conf
  20. dest: /usr/local/etc/nginx/locations/surepreme.conf
  21. mode: 0644
  22. notify: Nginx restarted
  23. - name: Source folder exists
  24. file:
  25. path: /usr/local/src
  26. mode: 0755
  27. state: directory
  28. - name: surepreme source deployed
  29. git:
  30. repo: "git@github.com:sureapp/surepreme.git"
  31. dest: /usr/local/src/surepreme
  32. accept_hostkey: yes
  33. update: yes
  34. ignore_errors: true
  35. tags:
  36. - deploy
  37. - name: Syncthing ignore file installed
  38. copy:
  39. src: stignore
  40. dest: /usr/local/src/surepreme/.stignore
  41. mode: 0775
  42. - name: Syncthing running as root
  43. shell: sysrc syncthing_user="root"
  44. notify: Syncthing restarted
  45. - name: Environment file installed
  46. template:
  47. src: envrc.j2
  48. dest: /usr/local/src/surepreme/.envrc
  49. mode: 0600
  50. tags:
  51. - deploy
  52. - name: Allow environment file
  53. shell:
  54. cmd: direnv allow
  55. chdir: /usr/local/src/surepreme
  56. tags:
  57. - deploy
  58. - cron:
  59. name: "Cron job to clear out tmp files every 5 minutes installed"
  60. minute: "5"
  61. job: 'find /usr/local/src/surepreme -type f -name ".syncthing*.tmp" -delete'
  62. - cron:
  63. name: "Cron job to clear out syncthing conflicts every 30 min"
  64. minute: "30"
  65. job: 'find /usr/local/src/surepreme -type f -name "*.sync-conflict*" -delete'
  66. - name: surepreme migrations up to date
  67. command: bash -lc "direnv exec /usr/local/src/surepreme /usr/local/bin/python3.10 /usr/local/src/surepreme/manage.py migrate"
  68. tags:
  69. - deploy
  70. - name: surepreme frontend files generated and copied
  71. command: bash -lc "direnv exec /usr/local/src/surepreme /usr/local/bin/yarn"
  72. args:
  73. chdir: "/usr/local/src/surepreme"
  74. tags:
  75. - deploy
  76. - name: Surepreme uvicorn immortal file installed
  77. template:
  78. src: uvicorn-immortal.yml.j2
  79. dest: /usr/local/etc/immortal/surepreme-uvicorn.yml
  80. owner: root
  81. mode: 0644
  82. notify: Immortal restarted