main.yml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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,py311-pip,fish,direnv,jpeg-turbo,tiff,webp,lcms2,freetype2,yarn-node16,cairo,pango,gmake,libxml2,libxslt,py311-psycopg2,py311-xmlsec,py311-cairocffi,py311-sqlite3,py311-numpy,bash,py311-libcst,cmake,ninja
  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/fifteen5.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: Create python bin link for yarn
  29. file:
  30. src: /usr/local/bin/python3.11
  31. dest: /usr/bin/python
  32. owner: root
  33. state: link
  34. - name: 15Five source deployed
  35. git:
  36. repo: "git@github.com:15five/fifteen5.git"
  37. dest: /usr/local/src/fifteen5
  38. accept_hostkey: yes
  39. update: yes
  40. ignore_errors: true
  41. tags:
  42. - deploy
  43. - name: Syncthing ignore file installed
  44. copy:
  45. src: stignore
  46. dest: /usr/local/src/fifteen5/.stignore
  47. mode: 0775
  48. - name: Syncthing running as root
  49. shell: sysrc syncthing_user="root"
  50. notify: Syncthing restarted
  51. - name: Environment file installed
  52. template:
  53. src: envrc.j2
  54. dest: /usr/local/src/fifteen5/.envrc
  55. mode: 0600
  56. tags:
  57. - deploy
  58. - name: Allow environment file
  59. shell:
  60. cmd: direnv allow
  61. chdir: /usr/local/src/fifteen5
  62. tags:
  63. - deploy
  64. - cron:
  65. name: "Cron job to clear out tmp files every 5 minutes installed"
  66. minute: "5"
  67. job: 'find /usr/local/src/fifteen5 -type f -name ".syncthing*.tmp" -delete'
  68. - cron:
  69. name: "Cron job to clear out syncthing conflicts every 30 min"
  70. minute: "30"
  71. job: 'find /usr/local/src/fifteen5 -type f -name "*.sync-conflict*" -delete'
  72. - name: 15Five requirements up to date
  73. pip:
  74. requirements: /usr/local/src/fifteen5/requirements/test.pip
  75. executable: pip
  76. tags:
  77. - deploy
  78. - name: 15Five personal reqs up to date
  79. pip:
  80. name:
  81. - asciitree
  82. - colorlog
  83. - logging_tree
  84. - django-pdb
  85. - pgcli
  86. - ipython
  87. - python-json-logger
  88. - git+https://github.com/sureapp/sqlformatter#egg=sqlformatter
  89. - git+https://github.com/zensourcer/clearbit-python.git#egg=clearbit
  90. executable: pip
  91. tags:
  92. - deploy
  93. - name: 15Five migrations up to date
  94. command: bash -lc "direnv exec /usr/local/src/fifteen5 /usr/local/bin/python3.11 /usr/local/src/fifteen5/manage.py migrate"
  95. tags:
  96. - deploy
  97. - name: 15Five frontend files generated and copied
  98. command: bash -lc "direnv exec /usr/local/src/fifteen5 /usr/local/bin/yarn"
  99. args:
  100. chdir: "/usr/local/src/fifteen5"
  101. tags:
  102. - deploy
  103. - name: 15Five frontend files generated
  104. command: bash -lc "direnv exec /usr/local/src/fifteen5 /usr/local/bin/python3.11 manage.py collectstatic --noinput && direnv exec /usr/local/src/fifteen5 /usr/local/bin/python3.11 manage.py collectstatic_js_reverse"
  105. args:
  106. chdir: "/usr/local/src/fifteen5"
  107. tags:
  108. - deploy
  109. - name: Fifteen5 uvicorn immortal file installed
  110. template:
  111. src: uvicorn-immortal.yml.j2
  112. dest: /usr/local/etc/immortal/fifteen5-uvicorn.yml
  113. owner: root
  114. mode: 0644
  115. notify: Immortal restarted
  116. - name: Fifteen5 celery immortal file installed
  117. template:
  118. src: celery-immortal.yml.j2
  119. dest: /usr/local/etc/immortal/fifteen5-celery.yml
  120. owner: root
  121. mode: 0644
  122. notify: Immortal restarted