main.yml 3.1 KB

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