You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 line
2.6KB

  1. ---
  2. - name: create openproject environment configuration
  3. template:
  4. src: '{{item}}.yml.j2'
  5. dest: '{{openproject_path}}/openproject/config/{{item}}.yml'
  6. with_items:
  7. - database
  8. #- configuration
  9. notify: restart openproject
  10. # https://community.openproject.com/projects/openproject/work_packages/26147/activity
  11. # - name: fix openproject bug \#26147
  12. # copy:
  13. # src: "{{ item }}.rb"
  14. # dest: '{{openproject_path}}/openproject/config/{{item}}.rb'
  15. # with_items:
  16. # - additional_environment
  17. # - additional_boot
  18. - name: set up database
  19. command: ./bin/rake db:create
  20. args:
  21. chdir: '{{openproject_path}}/openproject'
  22. become: yes
  23. become_user: '{{openproject_user}}'
  24. become_method: su
  25. register: rake_db_create_all
  26. changed_when: '"already exists" not in rake_db_create_all.stderr'
  27. environment:
  28. PATH: "{{openproject_env_path}}:{{ ansible_env.PATH }}"
  29. RAILS_ENV: production
  30. notify: restart openproject
  31. - name: generate secret token
  32. command: ./bin/rake generate_secret_token
  33. args:
  34. chdir: '{{openproject_path}}/openproject'
  35. creates: '{{openproject_path}}/openproject/config/secret_token.yml'
  36. become: yes
  37. become_user: '{{openproject_user}}'
  38. become_method: su
  39. environment:
  40. PATH: "{{openproject_env_path}}:{{ ansible_env.PATH }}"
  41. RAILS_ENV: production
  42. notify: restart openproject
  43. - name: migrate database
  44. command: ./bin/rake db:migrate
  45. args:
  46. chdir: '{{openproject_path}}/openproject'
  47. become: yes
  48. become_user: '{{openproject_user}}'
  49. become_method: su
  50. register: generate_migration
  51. changed_when: generate_migration.stdout != ""
  52. environment:
  53. PATH: "{{openproject_env_path}}:{{ ansible_env.PATH }}"
  54. RAILS_ENV: production
  55. notify: restart openproject
  56. - name: seed database
  57. command: ./bin/rake db:seed
  58. args:
  59. chdir: '{{openproject_path}}/openproject'
  60. become: yes
  61. become_user: '{{openproject_user}}'
  62. become_method: su
  63. register: seed_database
  64. changed_when: '"Skipping" not in seed_database.stdout'
  65. environment:
  66. PATH: "{{openproject_env_path}}:{{ ansible_env.PATH }}"
  67. RAILS_ENV: production
  68. LOCALE: "{{openproject_locale}}"
  69. notify: restart openproject
  70. - name: precompile assets
  71. command: ./bin/rake assets:precompile
  72. args:
  73. chdir: '{{openproject_path}}/openproject'
  74. become: yes
  75. become_user: '{{openproject_user}}'
  76. become_method: su
  77. async: 3600
  78. poll: 1
  79. register: precompile_assets
  80. changed_when: '"Writing" in seed_database.stdout'
  81. environment:
  82. PATH: "{{openproject_env_path}}:{{ ansible_env.PATH }}"
  83. RAILS_ENV: production
  84. notify: restart openproject