Browse Source

running.env y correccion de playbook

Luciano Andrade 7 years ago
parent
commit
93a1cad778
2 changed files with 44 additions and 15 deletions
  1. 30 14
      tools/playbook.yml
  2. 14 1
      tools/src/Release.php

+ 30 - 14
tools/playbook.yml

@@ -32,11 +32,22 @@
         connect_timeout: 15
         connect_timeout: 15
         timeout: 360
         timeout: 360
 
 
+    - name: Create database fd_session
+      mysql_db:
+        name: fd_session
+        login_password: "{{ lookup('env', 'MYSQL_PASSWORD') }}"
+        state: present
+
+    - copy:
+        src: "{{ playbook_dir }}/mysql_scripts.sql"
+        dest: /tmp/mysql_scripts.sql
+
     - name: Run SQL commands against DB to create table
     - name: Run SQL commands against DB to create table
       mysql_db:
       mysql_db:
         login_password: "{{ lookup('env', 'MYSQL_PASSWORD') }}"
         login_password: "{{ lookup('env', 'MYSQL_PASSWORD') }}"
         state: import
         state: import
-        target: "{{ playbook_dir }}/mysql_scripts.sql"
+        name: fd3_session
+        target: "/tmp/mysql_scripts.sql"
 
 
     - name: Create database base
     - name: Create database base
       mysql_db:
       mysql_db:
@@ -62,6 +73,24 @@
         login_password: "{{ lookup('env', 'MYSQL_PASSWORD') }}"
         login_password: "{{ lookup('env', 'MYSQL_PASSWORD') }}"
         state: present
         state: present
 
 
+    - name: Create database cablemodem
+      mysql_db:
+        name: fd3_cablemodem
+        login_password: "{{ lookup('env', 'MYSQL_PASSWORD') }}"
+        state: present
+
+    - name: Create database Radius
+      mysql_db:
+        name: fd3_radius
+        login_password: "{{ lookup('env', 'MYSQL_PASSWORD') }}"
+        state: present
+
+    - name: Create database dhcp
+      mysql_db:
+        name: fd3_dhcp
+        login_password: "{{ lookup('env', 'MYSQL_PASSWORD') }}"
+        state: present
+
     - name: Create user iksop
     - name: Create user iksop
       mysql_user:
       mysql_user:
         name: 'iksop'
         name: 'iksop'
@@ -92,10 +121,6 @@
         sleep: 30
         sleep: 30
         timeout: 600
         timeout: 600
 
 
-    - name: "Wait for finished the process cache:clear"
-      pause:
-        minutes: 1
-
     - name: Doctrine schema update
     - name: Doctrine schema update
       shell: "bin/console doctrine:schema:update --force"
       shell: "bin/console doctrine:schema:update --force"
 
 
@@ -104,11 +129,6 @@
         uris: "{{ uris }} --redirect_uri=http://{{ item }}.{{ lookup('env', 'DOMAIN') }}.flowdat.com/login_check"
         uris: "{{ uris }} --redirect_uri=http://{{ item }}.{{ lookup('env', 'DOMAIN') }}.flowdat.com/login_check"
       with_items: "{{ lookup('env', 'MODULES_INSTALL').split(',') }}"
       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
     - name: Create oauth client
       shell: "bin/console oauth:client:createRedirects {{ uris }} > oauth.data.log"
       shell: "bin/console oauth:client:createRedirects {{ uris }} > oauth.data.log"
       args:
       args:
@@ -167,10 +187,6 @@
   connection: docker
   connection: docker
   tags: dsu_modules
   tags: dsu_modules
   tasks:
   tasks:
-    - name: "Wait for finished the process cache:clear"
-      pause:
-        minutes: 1
-
     - name: "Doctrine schema update"
     - name: "Doctrine schema update"
       shell: "bin/console doctrine:schema:update --force"
       shell: "bin/console doctrine:schema:update --force"
 
 

+ 14 - 1
tools/src/Release.php

@@ -151,7 +151,7 @@ class Release extends Command
                     'HTTPS_METHOD' => 'nohttps',
                     'HTTPS_METHOD' => 'nohttps',
                 ),
                 ),
                 'OAUTH' => false,
                 'OAUTH' => false,
-                'MODULE_INSTALL' => false
+                'MODULE_INSTALL' => true
             ),
             ),
             "pma" => array(
             "pma" => array(
                 'HOST_ENV' => true,
                 'HOST_ENV' => true,
@@ -202,6 +202,7 @@ class Release extends Command
             ->addOption('extra-build', null, InputOption::VALUE_REQUIRED, 'Generate image build', "false")
             ->addOption('extra-build', null, InputOption::VALUE_REQUIRED, 'Generate image build', "false")
             ->addOption('host-ip', null, InputOption::VALUE_REQUIRED, 'Ip of the runnning host to be added to the /etc/hosts file, eventually', "127.0.1.1")
             ->addOption('host-ip', null, InputOption::VALUE_REQUIRED, 'Ip of the runnning host to be added to the /etc/hosts file, eventually', "127.0.1.1")
             ->addOption('domain', null, InputOption::VALUE_REQUIRED, 'Domain where the flowdat will be installed', "flowdat.com")
             ->addOption('domain', null, InputOption::VALUE_REQUIRED, 'Domain where the flowdat will be installed', "flowdat.com")
+            ->addOption('client', null, InputOption::VALUE_REQUIRED, 'Client name, if is not provided uses, the dirname of the installation', false)
             ->addOption('modules', null, InputOption::VALUE_REQUIRED, 'List of modules to install separated by coma.', "all")
             ->addOption('modules', null, InputOption::VALUE_REQUIRED, 'List of modules to install separated by coma.', "all")
             ->addOption('inventory', null, InputOption::VALUE_REQUIRED, 'Write inventory.ini by default.', true)
             ->addOption('inventory', null, InputOption::VALUE_REQUIRED, 'Write inventory.ini by default.', true)
             ->addOption('docker-tag', null, InputOption::VALUE_REQUIRED, 'Docker tag to be used', "latest");
             ->addOption('docker-tag', null, InputOption::VALUE_REQUIRED, 'Docker tag to be used', "latest");
@@ -234,9 +235,14 @@ class Release extends Command
                 }
                 }
             }
             }
             $this->_domain = $input->getOption("domain");
             $this->_domain = $input->getOption("domain");
+            $this->_client = $input->getOption("client");
+	    if(!$this->_client){
+		$this->_client = basename(realpath($dir));
+	    }
             $docker_tag = $input->getOption("docker-tag");
             $docker_tag = $input->getOption("docker-tag");
 
 
             $this->_ansible_vars["DOMAIN"] = $this->_domain;
             $this->_ansible_vars["DOMAIN"] = $this->_domain;
+            $this->_ansible_vars["CLIENT"] = $this->_client;
 
 
             $dObj = new DevOps\FileSystem(realpath($dir));
             $dObj = new DevOps\FileSystem(realpath($dir));
             $dObj->dirExists()->realpath();
             $dObj->dirExists()->realpath();
@@ -325,6 +331,7 @@ class Release extends Command
                 ->restart($this->_docker_restart_default)
                 ->restart($this->_docker_restart_default)
                 ->addLinks("mysql:mysql")
                 ->addLinks("mysql:mysql")
                 ->addLinks("amqp")
                 ->addLinks("amqp")
+                ->addEnv_file("running.env")
                 ->addEnv_file($host_env_file)
                 ->addEnv_file($host_env_file)
                 ->addEnv_file($module . "." . $host_env_file)
                 ->addEnv_file($module . "." . $host_env_file)
                 ->addVolumes("./$module/", "/opt/$module");
                 ->addVolumes("./$module/", "/opt/$module");
@@ -350,6 +357,7 @@ class Release extends Command
                 ->addLinks("base")
                 ->addLinks("base")
                 ->addLinks("amqp")
                 ->addLinks("amqp")
                 ->addLinks("base", $this->getDomain("base"))
                 ->addLinks("base", $this->getDomain("base"))
+                ->addEnv_file("running.env")
                 ->addEnv_file($host_env_file)
                 ->addEnv_file($host_env_file)
                 ->addEnv_file($module . "." . $host_env_file)
                 ->addEnv_file($module . "." . $host_env_file)
                 ->addEnv_file($module . ".oauth.env")
                 ->addEnv_file($module . ".oauth.env")
@@ -379,6 +387,7 @@ class Release extends Command
                 //->addLinks("jsendpoint", "endpoint")
                 //->addLinks("jsendpoint", "endpoint")
                 //->addLinks("statsd", "statsd")
                 //->addLinks("statsd", "statsd")
                 ->addVolumes("./$module/", "/opt/$module")
                 ->addVolumes("./$module/", "/opt/$module")
+                ->addEnv_file("running.env")
                 ->addEnv_file($host_env_file)
                 ->addEnv_file($host_env_file)
                 ->addEnv_file($module . "." . $host_env_file)
                 ->addEnv_file($module . "." . $host_env_file)
                 ->addEnv_file("$module.oauth.env");
                 ->addEnv_file("$module.oauth.env");
@@ -404,6 +413,7 @@ class Release extends Command
                 ->addLinks("base")
                 ->addLinks("base")
                 ->addLinks("amqp")
                 ->addLinks("amqp")
                 ->addLinks("base", $this->getDomain("base"))
                 ->addLinks("base", $this->getDomain("base"))
+                ->addEnv_file("running.env")
                 ->addEnv_file($host_env_file)
                 ->addEnv_file($host_env_file)
                 ->addEnv_file($module . "." . $host_env_file)
                 ->addEnv_file($module . "." . $host_env_file)
                 ->addEnv_file("$module.oauth.env")
                 ->addEnv_file("$module.oauth.env")
@@ -431,6 +441,7 @@ class Release extends Command
                 ->addLinks("base")
                 ->addLinks("base")
                 ->addLinks("amqp")
                 ->addLinks("amqp")
                 ->addLinks("base", $this->getDomain("base"))
                 ->addLinks("base", $this->getDomain("base"))
+                ->addEnv_file("running.env")
                 ->addEnv_file($host_env_file)
                 ->addEnv_file($host_env_file)
                 ->addEnv_file($module . "." . $host_env_file)
                 ->addEnv_file($module . "." . $host_env_file)
                 ->addEnv_file("$module.oauth.env")
                 ->addEnv_file("$module.oauth.env")
@@ -458,6 +469,7 @@ class Release extends Command
                 ->addLinks("base")
                 ->addLinks("base")
                 ->addLinks("amqp")
                 ->addLinks("amqp")
                 ->addLinks("base", $this->getDomain("base"))
                 ->addLinks("base", $this->getDomain("base"))
+                ->addEnv_file("running.env")
                 ->addEnv_file($host_env_file)
                 ->addEnv_file($host_env_file)
                 ->addEnv_file($module . "." . $host_env_file)
                 ->addEnv_file($module . "." . $host_env_file)
                 ->addEnv_file("$module.oauth.env")
                 ->addEnv_file("$module.oauth.env")
@@ -484,6 +496,7 @@ class Release extends Command
                 ->addLinks("base")
                 ->addLinks("base")
                 ->addLinks("amqp")
                 ->addLinks("amqp")
                 ->addLinks("base", $this->getDomain("base"))
                 ->addLinks("base", $this->getDomain("base"))
+                ->addEnv_file("running.env")
                 ->addEnv_file($host_env_file)
                 ->addEnv_file($host_env_file)
                 ->addEnv_file($module . "." . $host_env_file)
                 ->addEnv_file($module . "." . $host_env_file)
                 ->addEnv_file("$module.oauth.env")
                 ->addEnv_file("$module.oauth.env")