main.yml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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,py38-pip,fish,direnv,jpeg-turbo,tiff,webp,lcms2,freetype2,syncthing,yarn-node14,cairo,pango,gmake,libxml2,libxslt,py38-psycopg2,py38-xmlsec,py38-cairocffi,py38-sqlite3,bash,py38-libcst
  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.8
  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:
  50. cmd: 'sed -i -e ''/^: ${syncthing_user/s/"syncthing"/"root"/'' /usr/local/etc/rc.d/syncthing'
  51. warn: false
  52. notify: Syncthing restarted
  53. - name: Environment file installed
  54. template:
  55. src: envrc.j2
  56. dest: /usr/local/src/fifteen5/.envrc
  57. mode: 0600
  58. tags:
  59. - deploy
  60. - name: Allow environment file
  61. shell:
  62. cmd: direnv allow
  63. chdir: /usr/local/src/fifteen5
  64. tags:
  65. - deploy
  66. - name: Hack patch for clearbit bullshit
  67. shell:
  68. cmd: 'sed -i -e "s/clearbit/#clearbit/g" /usr/local/src/fifteen5/requirements/common.txt'
  69. warn: false
  70. - name: 15Five requirements up to date
  71. pip:
  72. requirements: /usr/local/src/fifteen5/requirements/test.pip
  73. executable: pip
  74. tags:
  75. - deploy
  76. - name: 15Five personal reqs up to date
  77. pip:
  78. name:
  79. - asciitree
  80. - colorlog
  81. - logging_tree
  82. - django-pdb
  83. - pgcli
  84. - ipython
  85. - python-json-logger
  86. - git+https://github.com/sureapp/sqlformatter#egg=sqlformatter
  87. - git+https://github.com/zensourcer/clearbit-python.git#egg=clearbit
  88. executable: pip
  89. tags:
  90. - deploy
  91. - name: 15Five migrations up to date
  92. command: bash -lc "direnv exec /usr/local/src/fifteen5 /usr/local/bin/python3.8 /usr/local/src/fifteen5/manage.py migrate"
  93. tags:
  94. - deploy
  95. - name: 15Five frontend files generated and copied
  96. command: bash -lc "direnv exec /usr/local/src/fifteen5 /usr/local/bin/yarn"
  97. args:
  98. chdir: "/usr/local/src/fifteen5"
  99. tags:
  100. - deploy
  101. - name: 15Five frontend files generated
  102. command: bash -lc "direnv exec /usr/local/src/fifteen5 /usr/local/bin/python3.8 manage.py collectstatic --noinput && direnv exec /usr/local/src/fifteen5 /usr/local/bin/python3.8 manage.py collectstatic_js_reverse"
  103. args:
  104. chdir: "/usr/local/src/fifteen5"
  105. tags:
  106. - deploy
  107. - name: Fifteen5 uvicorn immortal file installed
  108. template:
  109. src: uvicorn-immortal.yml.j2
  110. dest: /usr/local/etc/immortal/fifteen5-uvicorn.yml
  111. owner: root
  112. mode: 0644
  113. notify: Immortal restarted
  114. - name: Fifteen5 celery immortal file installed
  115. template:
  116. src: celery-immortal.yml.j2
  117. dest: /usr/local/etc/immortal/fifteen5-celery.yml
  118. owner: root
  119. mode: 0644
  120. notify: Immortal restarted