main.yml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. ---
  2. - name: Package cache updated
  3. shell: pkg update -f
  4. - name: Dependencies installed
  5. # We install xmlsec and cairocffi using pkg because python-Levenshtein can't be installed on FreeBSD
  6. community.general.pkgng:
  7. name: "git py37-pip py37-supervisor nginx vim-console tmux fish direnv jpeg-turbo tiff webp lcms2 freetype2 syncthing yarn-node14 redis cairo pango gmake libxml2 libxslt postgresql12-client py37-xmlsec py37-cairocffi"
  8. state: latest
  9. - name: Supervisor enabled
  10. shell: sysrc supervisord_enable="YES"
  11. - name: Redis enabled
  12. shell: sysrc redis_enable="YES"
  13. - name: Redis started
  14. shell: service redis restart
  15. - name: Nginx key file installed
  16. copy:
  17. src: key.pem
  18. dest: /usr/local/etc/nginx/key.pem
  19. owner: root
  20. mode: 0644
  21. - name: Nginx cert file installed
  22. copy:
  23. src: cert.pem
  24. dest: /usr/local/etc/nginx/cert.pem
  25. owner: root
  26. mode: 0644
  27. - name: Nginx conf file installed
  28. copy:
  29. src: nginx.conf
  30. dest: /usr/local/etc/nginx/nginx.conf
  31. owner: root
  32. mode: 0644
  33. notify: Nginx restarted
  34. - name: Source folder exists
  35. file:
  36. path: /usr/local/src
  37. owner: root
  38. mode: 0755
  39. state: directory
  40. - name: Create python bin link for yarn
  41. file:
  42. src: /usr/local/bin/python3.7
  43. dest: /usr/bin/python
  44. owner: root
  45. state: link
  46. - name: 15Five source deployed
  47. git:
  48. repo: "git@github.com:15five/fifteen5.git"
  49. dest: /usr/local/src/fifteen5
  50. accept_hostkey: yes
  51. update: yes
  52. - name: Environment file installed
  53. template:
  54. src: envrc
  55. dest: /usr/local/src/fifteen5/.envrc
  56. owner: root
  57. mode: 0644
  58. - name: Allow environment file
  59. shell:
  60. cmd: direnv allow
  61. chdir: /usr/local/src/fifteen5
  62. - name: Supervisor config file patched
  63. patch:
  64. src: supervisord.conf.patch
  65. dest: /usr/local/etc/supervisord.conf
  66. notify: Supervisor restarted
  67. - name: 15Five requirements up to date
  68. pip:
  69. requirements: /usr/local/src/fifteen5/requirements/test.pip
  70. executable: pip
  71. - name: 15Five personal reqs up to date
  72. pip:
  73. name:
  74. - asciitree
  75. - colorlog
  76. - logging_tree
  77. - django-pdb
  78. - pgcli
  79. - ipython
  80. - git+git://github.com/sureapp/sqlformatter
  81. executable: pip
  82. notify: Redis restarted
  83. - name: 15Five migrations up to date
  84. command: bash -lc "direnv exec /usr/local/src/fifteen5 /usr/local/bin/python3.7 /usr/local/src/fifteen5/manage.py migrate"
  85. tags:
  86. - deploy
  87. - name: Ensures supervisor conf dir exists
  88. file: path=/usr/local/etc/supervisor/conf.d state=directory
  89. - name: 15Five supervisor file installed
  90. copy:
  91. src: fifteen5-supervisor.conf
  92. dest: /usr/local/etc/supervisor/conf.d/
  93. owner: root
  94. mode: 0644
  95. notify: Supervisor restarted
  96. - name: 15Five frontend files generated
  97. command: bash -lc "direnv exec /usr/local/src/fifteen5 /usr/local/bin/yarn && direnv exec /usr/local/bin/yarn build && direnv exec /usr/local/bin/python3.7 manage.py collectstatic --no-input"
  98. args:
  99. chdir: "/usr/local/src/fifteen5"
  100. tags:
  101. - deploy
  102. - name: Static files collected
  103. command: bash -lc "direnv exec /usr/local/bin/python3.7 /usr/local/src/fifteen5/manage.py collectstatic --noinput"
  104. args:
  105. chdir: "/usr/local/src/fifteen5"
  106. tags:
  107. - deploy