main.yml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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,postgresql12-client,py38-xmlsec,py38-cairocffi,py38-sqlite3,bash,py38-libcst
  6. state: latest
  7. - name: Root shell is fish
  8. ansible.builtin.user: name=root shell=/usr/local/bin/fish
  9. - name: Tmux config installed
  10. copy:
  11. src: tmux.conf
  12. dest: /root/.tmux.conf
  13. mode: 0644
  14. - name: Github SSH key installed
  15. template:
  16. src: sshkey.j2
  17. dest: /root/.ssh/id_ed25519
  18. mode: 0400
  19. - name: Nginx location file installed
  20. copy:
  21. src: nginx-location.conf
  22. dest: /usr/local/etc/nginx/locations/fifteen5.conf
  23. mode: 0644
  24. notify: Nginx restarted
  25. - name: Source folder exists
  26. file:
  27. path: /usr/local/src
  28. mode: 0755
  29. state: directory
  30. - name: Create python bin link for yarn
  31. file:
  32. src: /usr/local/bin/python3.8
  33. dest: /usr/bin/python
  34. owner: root
  35. state: link
  36. - name: 15Five source deployed
  37. git:
  38. repo: "git@github.com:15five/fifteen5.git"
  39. dest: /usr/local/src/fifteen5
  40. accept_hostkey: yes
  41. update: yes
  42. ignore_errors: true
  43. tags:
  44. - deploy
  45. - name: Syncthing ignore file installed
  46. copy:
  47. src: stignore
  48. dest: /usr/local/src/fifteen5/.stignore
  49. mode: 0775
  50. - name: Syncthing running as root
  51. shell:
  52. cmd: 'sed -i -e ''/^: ${syncthing_user/s/"syncthing"/"root"/'' /usr/local/etc/rc.d/syncthing'
  53. warn: false
  54. notify: Syncthing restarted
  55. - name: Environment file installed
  56. template:
  57. src: envrc.j2
  58. dest: /usr/local/src/fifteen5/.envrc
  59. mode: 0600
  60. tags:
  61. - deploy
  62. - name: Allow environment file
  63. shell:
  64. cmd: direnv allow
  65. chdir: /usr/local/src/fifteen5
  66. tags:
  67. - deploy
  68. - name: Hack patch for clearbit bullshit
  69. shell:
  70. cmd: 'sed -i -e "s/clearbit/#clearbit/g" /usr/local/src/fifteen5/requirements/common.txt'
  71. warn: false
  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. - git+git://github.com/sureapp/sqlformatter
  88. - python-json-logger
  89. - git+git://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.8 /usr/local/src/fifteen5/manage.py migrate"
  95. tags:
  96. - deploy
  97. - name: 15Five BE supervisor file installed
  98. copy:
  99. src: fifteen5-supervisor.conf
  100. dest: /usr/local/etc/supervisor/conf.d/uvicorn.conf
  101. owner: root
  102. mode: 0644
  103. notify: Supervisor restarted
  104. - name: 15Five FE supervisor file installed
  105. copy:
  106. src: fifteen5-yarn-supervisor.conf
  107. dest: /usr/local/etc/supervisor/conf.d/yarn.conf
  108. owner: root
  109. mode: 0644
  110. notify: Supervisor restarted
  111. - name: 15Five celery supervisor file installed
  112. copy:
  113. src: celery-supervisor.conf
  114. dest: /usr/local/etc/supervisor/conf.d/celery.conf
  115. owner: root
  116. mode: 0644
  117. notify: Supervisor restarted
  118. - name: 15Five frontend files generated and copied
  119. command: bash -lc "direnv exec /usr/local/src/fifteen5 /usr/local/bin/yarn"
  120. args:
  121. chdir: "/usr/local/src/fifteen5"
  122. tags:
  123. - deploy
  124. - name: 15Five frontend files generated
  125. 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"
  126. args:
  127. chdir: "/usr/local/src/fifteen5"
  128. tags:
  129. - deploy
  130. - name: 15Five reset database
  131. command: bash -lc "RESET_DB=True direnv exec /usr/local/src/fifteen5 /usr/local/bin/python3.8 /usr/local/src/fifteen5/manage.py run_local_scripts && direnv exec /usr/local/src/fifteen5 /usr/local/bin/python3.8 /usr/local/src/fifteen5/manage.py clearsessions"
  132. tags:
  133. - db-refresh
  134. - never