|
@@ -0,0 +1,157 @@
|
|
|
+---
|
|
|
+- name: Implementation parameters
|
|
|
+ hosts: 127.0.0.1
|
|
|
+ connection: local
|
|
|
+ tasks:
|
|
|
+ - name: Parameters for base
|
|
|
+ command: "cp /home/gabriel/dev/dind/installer/tools/galvez/base/app/config/parameters.yml.docker /home/gabriel/dev/dind/installer/tools/galvez/base/app/config/parameters.yml"
|
|
|
+
|
|
|
+ - name: "Parameters"
|
|
|
+ command: "cp /home/gabriel/dev/dind/installer/tools/galvez/{{ item }}/app/config/parameters.yml.docker /home/gabriel/dev/dind/installer/tools/galvez/{{ item }}/app/config/parameters.yml"
|
|
|
+ with_items: "{{ lookup('env', 'MODULES_INSTALL').split(',') }}"
|
|
|
+
|
|
|
+- name: Launch docker for mysql database. Tag=start_mysql
|
|
|
+ hosts: 127.0.0.1
|
|
|
+ connection: local
|
|
|
+ tags: start_mysql
|
|
|
+ tasks:
|
|
|
+ - name: Docker mysql up
|
|
|
+ command: "docker-compose up -d mysql"
|
|
|
+
|
|
|
+- name: Configure mysql database. Tag=configure_mysql
|
|
|
+ hosts: mysql
|
|
|
+ connection: docker
|
|
|
+ tags: configure_mysql
|
|
|
+ tasks:
|
|
|
+ - name: Wait for mysql be ready
|
|
|
+ wait_for:
|
|
|
+ host: 127.0.0.1
|
|
|
+ port: 3306
|
|
|
+ state: started
|
|
|
+ delay: 5
|
|
|
+ connect_timeout: 15
|
|
|
+ timeout: 360
|
|
|
+
|
|
|
+ - name: Create database base
|
|
|
+ mysql_db:
|
|
|
+ name: fd3_base
|
|
|
+ login_password: "{{ lookup('env', 'MYSQL_PASSWORD') }}"
|
|
|
+ state: present
|
|
|
+
|
|
|
+ - name: Create database ftth
|
|
|
+ mysql_db:
|
|
|
+ name: fd3_ftth
|
|
|
+ login_password: "{{ lookup('env', 'MYSQL_PASSWORD') }}"
|
|
|
+ state: present
|
|
|
+
|
|
|
+ - name: Create database mapas
|
|
|
+ mysql_db:
|
|
|
+ name: fd3_mapas
|
|
|
+ login_password: "{{ lookup('env', 'MYSQL_PASSWORD') }}"
|
|
|
+ state: present
|
|
|
+
|
|
|
+ - name: Create database stats
|
|
|
+ mysql_db:
|
|
|
+ name: fd3_stats
|
|
|
+ login_password: "{{ lookup('env', 'MYSQL_PASSWORD') }}"
|
|
|
+ state: present
|
|
|
+
|
|
|
+ - name: Create user iksop
|
|
|
+ mysql_user:
|
|
|
+ name: 'iksop'
|
|
|
+ password: "{{ lookup('env', 'MYSQL_PASSWORD') }}"
|
|
|
+ login_password: "{{ lookup('env', 'MYSQL_PASSWORD') }}"
|
|
|
+ priv: '*.*:ALL'
|
|
|
+ state: present
|
|
|
+
|
|
|
+- name: Launch docker for module base. Tag=start_base
|
|
|
+ hosts: 127.0.0.1
|
|
|
+ connection: local
|
|
|
+ tags: start_base
|
|
|
+ tasks:
|
|
|
+ - name: Docker base up
|
|
|
+ command: "docker-compose up -d base"
|
|
|
+
|
|
|
+- name: Configure module base. Tag=configure_base
|
|
|
+ hosts: base
|
|
|
+ connection: docker
|
|
|
+ tags: configure_base
|
|
|
+ vars:
|
|
|
+ uris: ""
|
|
|
+ tasks:
|
|
|
+ - name: "Wait for autoload_classmap.php. Timeout: 10 minutes"
|
|
|
+ wait_for:
|
|
|
+ path: /opt/base/vendor/composer/autoload_classmap.php
|
|
|
+ state: present
|
|
|
+ sleep: 30
|
|
|
+ timeout: 600
|
|
|
+
|
|
|
+ - name: "Wait for finished the process cache:clear"
|
|
|
+ pause:
|
|
|
+ minutes: 1
|
|
|
+
|
|
|
+ - name: Doctrine schema update
|
|
|
+ shell: "bin/console doctrine:schema:update --force"
|
|
|
+
|
|
|
+ - name: Load redirections
|
|
|
+ set_fact:
|
|
|
+ uris: "{{ uris }} --redirect_uri=http://{{ item }}.{{ lookup('env', 'DOMAIN') }}.flowdat.com/login_check"
|
|
|
+ with_items: "{{ lookup('env', 'MODULES_INSTALL').split(',') }}"
|
|
|
+
|
|
|
+ - name: Sacar el update de ik, el base no tiene esta version del oauth
|
|
|
+ shell: "eval $(ssh-agent);ssh-add /opt/keys/bitbucket.id_rsa;composer update ik/*"
|
|
|
+ args:
|
|
|
+ executable: /bin/bash
|
|
|
+
|
|
|
+ - name: Create oauth client
|
|
|
+ shell: "bin/console oauth:client:createRedirects {{ uris }} > oauth.data.log"
|
|
|
+ args:
|
|
|
+ executable: /bin/bash
|
|
|
+
|
|
|
+ - name: Copy file oauth.data.log to host
|
|
|
+ fetch:
|
|
|
+ src: /opt/base/oauth.data.log
|
|
|
+ dest: /tmp/
|
|
|
+
|
|
|
+- name: Configure oauth data for other container. Tag=configure_oauth
|
|
|
+ hosts: 127.0.0.1
|
|
|
+ connection: local
|
|
|
+ tags: configure_oauth
|
|
|
+ tasks:
|
|
|
+ - name: "Add outh client id"
|
|
|
+ shell: "cp /tmp/{{ lookup('env', 'DOMAIN') }}_base_1/opt/base/oauth.data.log {{ item }}.oauth.env"
|
|
|
+ args:
|
|
|
+ executable: /bin/bash
|
|
|
+ with_items: "{{ lookup('env', 'MODULES_INSTALL').split(',') }}"
|
|
|
+
|
|
|
+- name: "Launch docker's. Tag=launch_dockers"
|
|
|
+ hosts: 127.0.0.1
|
|
|
+ connection: local
|
|
|
+ tags: launch_dockers
|
|
|
+ tasks:
|
|
|
+ - name: "Dockers up"
|
|
|
+ command: "docker-compose up -d {{ item }}"
|
|
|
+ with_items: "{{ lookup('env', 'MODULES_INSTALL').split(',') }}"
|
|
|
+
|
|
|
+- name: "Run modules. Timeout: 10 minutes. Tag=run_modules"
|
|
|
+ hosts: "{{ lookup('env', 'MODULES_INSTALL') }}"
|
|
|
+ connection: docker
|
|
|
+ tags: run_modules
|
|
|
+ tasks:
|
|
|
+ - name: "Docker's schema update"
|
|
|
+ wait_for:
|
|
|
+ path: "./vendor/composer/autoload_classmap.php"
|
|
|
+ #path: "/opt/{{ play_hosts }}/vendor/composer/autoload_classmap.php"
|
|
|
+ state: present
|
|
|
+ sleep: 30
|
|
|
+ timeout: 600
|
|
|
+
|
|
|
+- name: "Run doctrine:schema:update for modules. Tag=dsu_modules"
|
|
|
+ hosts: "{{ lookup('env', 'MODULES_INSTALL') }}"
|
|
|
+ connection: docker
|
|
|
+ tags: dsu_modules
|
|
|
+ tasks:
|
|
|
+ - name: "Doctrine schema update"
|
|
|
+ shell: "bin/console doctrine:schema:update --force'"
|
|
|
+
|
|
|
+
|