diff --git a/src/main/resources/ansible_step/ansible-playbook.sh.ftl b/src/main/resources/ansible_step/ansible-playbook.sh.ftl index f1c8871..5b6e6bd 100644 --- a/src/main/resources/ansible_step/ansible-playbook.sh.ftl +++ b/src/main/resources/ansible_step/ansible-playbook.sh.ftl @@ -31,14 +31,13 @@ cat ansible_step/inventory/xldeploy_ansible_inventory echo "= extra vars = " cat ansible_step/xldeploy_extravars.json - echo "------ " find . -ls echo "------ " cp -r . /tmp/ANSIBLE/ -echo "${ansibleController.ansiblePlaybookPath} --inventory-file=ansible_step/inventory/xldeploy_ansible_inventory ${verbose} --extra-vars "@ansible_step/xldeploy_extravars.json" ./xldeploy_playbook.yml" +echo "${ansibleController.ansiblePlaybookPath} --inventory-file=ansible_step/inventory/xldeploy_ansible_inventory ${verbose} --extra-vars "@ansible_step/xldeploy_extravars.json" ./xldeploy_playbook.yml" ${ansibleController.ansiblePlaybookPath} --inventory-file=ansible_step/inventory/xldeploy_ansible_inventory ${verbose} --extra-vars "@ansible_step/xldeploy_extravars.json" ./xldeploy_playbook.yml diff --git a/src/main/resources/ansible_step/inventory/xldeploy_ansible_inventory.ftl b/src/main/resources/ansible_step/inventory/xldeploy_ansible_inventory.ftl index 5ab9424..0454826 100644 --- a/src/main/resources/ansible_step/inventory/xldeploy_ansible_inventory.ftl +++ b/src/main/resources/ansible_step/inventory/xldeploy_ansible_inventory.ftl @@ -10,6 +10,7 @@ --> # Generated by XLDeploy + <#if host.type == 'overthere.LocalHost'> #http://ansible.pickle.io/post/86598332429/running-ansible-playbook-in-localhost ${host.name} ansible_connection=local ansible_python_interpreter=/usr/local/bin/python diff --git a/src/main/resources/devops-as-code/apply.sh.ftl b/src/main/resources/devops-as-code/apply.sh.ftl index 0e7ad0a..e113256 100644 --- a/src/main/resources/devops-as-code/apply.sh.ftl +++ b/src/main/resources/devops-as-code/apply.sh.ftl @@ -10,4 +10,4 @@ --> -/usr/local/bin/xl --xl-deploy-password ${ansibleController.devopsAsCodePassword} --xl-deploy-username ${ansibleController.devopsAsCodeUsername} --xl-deploy-url ${ansibleController.devopsAsCodeUrl} apply -f ${yaml_file} \ No newline at end of file +/usr/local/bin/xl --xl-deploy-password ${ansibleController.devopsAsCodePassword} --xl-deploy-username ${ansibleController.devopsAsCodeUsername} --xl-deploy-url ${ansibleController.devopsAsCodeUrl} apply -f ${yaml_file} diff --git a/xebialabs.yaml b/xebialabs.yaml index c3cabaa..53e01ff 100644 --- a/xebialabs.yaml +++ b/xebialabs.yaml @@ -3,4 +3,5 @@ kind: Import metadata: imports: - xebialabs/defaults.yaml - - xebialabs/application.yaml \ No newline at end of file + - xebialabs/application.yaml + - xebialabs/configuration.yaml \ No newline at end of file diff --git a/xebialabs/application.yaml b/xebialabs/application.yaml index 066bba3..cbe8aab 100644 --- a/xebialabs/application.yaml +++ b/xebialabs/application.yaml @@ -21,12 +21,15 @@ spec: roles: - tomcat8 variables: - public_key_path: ./keypairs/id_rsa.pub + public_key_path: /Users/bmoussaud/.ssh/demo_keypairs/id_rsa.pub - name: bdd type: ansible.RolesSpec scanPlaceholders: False includeDevOpsAsCodeTask: True file: !file "artifacts/provision-calculator/0.0.12/roles_backend" + variables: + cng_password: '{{database_password}}' + database_name: '{{database_name}}' tags: - backend roles: diff --git a/xebialabs/artifacts/provision-calculator/0.0.12/roles_backend/mysql/defaults/main.yml b/xebialabs/artifacts/provision-calculator/0.0.12/roles_backend/mysql/defaults/main.yml index e7e5caa..a33e2f5 100644 --- a/xebialabs/artifacts/provision-calculator/0.0.12/roles_backend/mysql/defaults/main.yml +++ b/xebialabs/artifacts/provision-calculator/0.0.12/roles_backend/mysql/defaults/main.yml @@ -1,4 +1,5 @@ # This will configure a default manager-gui and admin-gui user: mysql_root_password: password -cng_password: cng_password \ No newline at end of file +cng_password: cng_password +database_name: petdatabase \ No newline at end of file diff --git a/xebialabs/artifacts/provision-calculator/0.0.12/roles_backend/mysql/tasks/main.yml b/xebialabs/artifacts/provision-calculator/0.0.12/roles_backend/mysql/tasks/main.yml index 1d8fea6..880d347 100644 --- a/xebialabs/artifacts/provision-calculator/0.0.12/roles_backend/mysql/tasks/main.yml +++ b/xebialabs/artifacts/provision-calculator/0.0.12/roles_backend/mysql/tasks/main.yml @@ -13,9 +13,9 @@ - name: Copy my.cnf file with root password credentials in /etc/mysql/mysql.cnf template: src=templates/my.cnf.j2 dest=/etc/mysql/mysql.cnf owner=root mode=0600 -- name: Create a new database with name 'congruencias' +- name: Create a new database with name '{{database_name}}' mysql_db: - name: congruencias + name: '{{database_name}}' state: present - name: Update mysql root password for all root accounts @@ -25,8 +25,8 @@ - ::1 - localhost -- name: Create cng_user user for congruencias - mysql_user: user="cng_user" host="%" password={{cng_password}} priv=congruencias.*:ALL,GRANT +- name: Create cng_user user for {{database_name}} + mysql_user: user="cng_user" host="%" password={{cng_password}} priv={{database_name}}.*:ALL,GRANT - name: Copy configuration file copy: src=mysqld.cnf dest=/etc/mysql/mysql.conf.d owner=root mode=0640 diff --git a/xebialabs/artifacts/provision-calculator/0.0.12/roles_backend/mysql/templates/xldeploy.yaml.j2 b/xebialabs/artifacts/provision-calculator/0.0.12/roles_backend/mysql/templates/xldeploy.yaml.j2 index 99b58de..fa10de3 100644 --- a/xebialabs/artifacts/provision-calculator/0.0.12/roles_backend/mysql/templates/xldeploy.yaml.j2 +++ b/xebialabs/artifacts/provision-calculator/0.0.12/roles_backend/mysql/templates/xldeploy.yaml.j2 @@ -7,4 +7,4 @@ spec: username: cng_user password: {{cng_password}} mySqlHome: /usr - databaseName: congruencias + databaseName: {{database_name}} diff --git a/xebialabs/artifacts/provision-calculator/0.0.12/roles_frontend/tomcat8/files/axis2.war b/xebialabs/artifacts/provision-calculator/0.0.12/roles_frontend/tomcat8/files/axis2.war deleted file mode 100644 index 26affb1..0000000 Binary files a/xebialabs/artifacts/provision-calculator/0.0.12/roles_frontend/tomcat8/files/axis2.war and /dev/null differ diff --git a/xebialabs/artifacts/provision-calculator/0.0.12/roles_frontend/tomcat8/tasks/main.yml b/xebialabs/artifacts/provision-calculator/0.0.12/roles_frontend/tomcat8/tasks/main.yml index 0ef6f61..59bf45e 100644 --- a/xebialabs/artifacts/provision-calculator/0.0.12/roles_frontend/tomcat8/tasks/main.yml +++ b/xebialabs/artifacts/provision-calculator/0.0.12/roles_frontend/tomcat8/tasks/main.yml @@ -47,9 +47,6 @@ copy: src=context.xml dest=/opt/apache-tomcat-8.5.8/webapps/manager/META-INF/context.xml mode=0640 notify: restart tomcat -- name: Install axis2 war - copy: src=axis2.war dest=/opt/apache-tomcat-8.5.8/webapps/axis2.war mode=0644 - - name: systemd daemon-reload shell: systemctl daemon-reload diff --git a/xebialabs/condiguration.yaml b/xebialabs/condiguration.yaml new file mode 100644 index 0000000..e0c8ece --- /dev/null +++ b/xebialabs/condiguration.yaml @@ -0,0 +1,10 @@ +--- +apiVersion: xl-deploy/v1 +kind: Environments +spec: +- name: Environments/calculator/provisioning.config.dev + type: udm.Dictionary + entries: + database_name: my_dev_database + encryptedEntries: + database_password: scott00Tiger