playbookUpdateSupport.yml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. ---
  2. - name: Launch docker for mysql database. Tag=start_mysql
  3. hosts: 127.0.0.1
  4. connection: local
  5. tags: start_mysql
  6. tasks:
  7. - name: Docker mysql up
  8. command: "docker-compose up -d mysql"
  9. - name: Launch docker for amqp. Tag=start_amqp
  10. hosts: 127.0.0.1
  11. connection: local
  12. tags: start_base
  13. tasks:
  14. - name: Docker amqp up
  15. command: "docker-compose up -d amqp"
  16. - name: "Wait for amqp. Timeout: 1 minutes"
  17. pause:
  18. minutes: 1
  19. - name: Launch docker for module base. Tag=start_base
  20. hosts: 127.0.0.1
  21. connection: local
  22. tags: start_base
  23. tasks:
  24. - name: Docker base up
  25. command: "docker-compose up -d base"
  26. - name: Configure module base. Tag=configure_base
  27. hosts: base
  28. connection: docker
  29. tags: configure_base
  30. vars:
  31. uris: ""
  32. tasks:
  33. - name: Chmod cache
  34. file:
  35. path: /opt/base/var/cache/
  36. recurse: yes
  37. mode: 777
  38. - name: Clean cache
  39. file:
  40. state: absent
  41. path: "/opt/base/var/cache/"
  42. - name: Load redirections
  43. set_fact:
  44. uris: "{{ uris }} --redirect_uri=https://{{ item }}.{{ lookup('env', 'CLIENT') }}.{{ lookup('env', 'DOMAIN') }}/login_check"
  45. with_items: "{{ lookup('env', 'MODULES_INSTALL').split(',') }}"
  46. - name: Load redirections app_dev
  47. set_fact:
  48. uris: "{{ uris }} --redirect_uri=https://{{ item }}.{{ lookup('env', 'CLIENT') }}.{{ lookup('env', 'DOMAIN') }}/app_dev.php/login_check"
  49. with_items: "{{ lookup('env', 'MODULES_INSTALL').split(',') }}"
  50. - name: Create oauth client
  51. shell: "bin/console oauth:client:updateRedirects {{ uris }} "
  52. args:
  53. executable: /bin/bash
  54. - name: "Launch docker's. Tag=launch_dockers"
  55. hosts: 127.0.0.1
  56. connection: local
  57. tags: launch_dockers
  58. tasks:
  59. - name: "Dockers up"
  60. command: "docker-compose up -d {{ item }}"
  61. with_items: "{{ lookup('env', 'MODULES_INSTALL').split(',') }}"
  62. - name: "Wait to load containers. Timeout: 10 minutes. Tag=run_modules"
  63. hosts: "{{ lookup('env', 'MODULES_INSTALL') }}"
  64. connection: docker
  65. tags: run_modules
  66. tasks:
  67. - name: "Waiting"
  68. wait_for:
  69. path: "./vendor/composer/autoload_classmap.php"
  70. state: present
  71. sleep: 30
  72. timeout: 600
  73. - name: "Run doctrine:schema:update for modules. Tag=dsu_modules"
  74. hosts: "{{ lookup('env', 'MODULES_INSTALL') }}"
  75. connection: docker
  76. tags: dsu_modules
  77. tasks:
  78. - name: "Doctrine schema update"
  79. shell: "bin/console doctrine:schema:update --force"
  80. - name: "Kea files"
  81. hosts: 127.0.0.1
  82. connection: local
  83. tags: kea_files
  84. tasks:
  85. - name: Check if get_kea_files.sh exists
  86. stat:
  87. path: get_kea_files.sh
  88. register: kea_files_result
  89. - name: Get kea image
  90. command: docker-compose pull kea
  91. when: kea_files_result.stat.exists == True
  92. - name: Run chmod +x
  93. command: chmod +x get_kea_files.sh
  94. when: kea_files_result.stat.exists == True
  95. - name: Execute get_kea_files.sh
  96. command: sh get_kea_files.sh
  97. when: kea_files_result.stat.exists == True
  98. - name: "Run up all. Tag=up_all"
  99. hosts: 127.0.0.1
  100. connection: local
  101. tags: up_all
  102. tasks:
  103. - name: Docker up all modules
  104. command: "docker-compose up -d "
  105. - name: Docker stop nginx
  106. command: "docker-compose stop nginx "
  107. - name: Docker up nginx
  108. command: "docker-compose up -d nginx"