airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shame...@apache.org
Subject [12/29] airavata git commit: Added database role to install mariadb on centos 7 , fix #2
Date Sat, 24 Sep 2016 01:58:37 GMT
Added database role to install mariadb on centos 7 , fix #2


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/414c0e9c
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/414c0e9c
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/414c0e9c

Branch: refs/heads/develop
Commit: 414c0e9c7ff89d12550ca373e4b06a5eb2938f49
Parents: 1fb4369
Author: Shameera Rathnayaka <shameerainfo@gmail.com>
Authored: Mon Aug 1 20:35:21 2016 -0400
Committer: Shameera Rathnayaka <shameerainfo@gmail.com>
Committed: Mon Aug 1 20:35:21 2016 -0400

----------------------------------------------------------------------
 group_vars/all                          |  4 +--
 hosts                                   | 18 ++++++++----
 roles/database/handlers/main.yml        |  8 ++++++
 roles/database/tasks/main.yml           | 41 ++++++++++++++++++++++++++++
 roles/database/tasks/secure_install.yml | 18 ++++++++++++
 roles/database/templates/my.cnf         |  4 +++
 roles/database/vars/main.yml            |  7 +++++
 site.yml                                |  6 ++++
 8 files changed, 98 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/414c0e9c/group_vars/all
----------------------------------------------------------------------
diff --git a/group_vars/all b/group_vars/all
index 2c2cb95..6098bc1 100644
--- a/group_vars/all
+++ b/group_vars/all
@@ -12,8 +12,8 @@ airavata_dist: "apache-airavata-server-0.17-SNAPSHOT"
 airavata_dist_name: "{{ airavata_dist }}-bin.tar.gz"
 
 db_server: "gw62.iu.xsede.org"
-db_user: "SciGaP15Deploy"
-db_password: "xxxxxxxxxxx"
+db_user: "airavata"
+db_password: "airavata"
 app_catalog: "app_catalog"
 exp_catalog: "exp_catalog"
 replica_catalog: "replica_catalog"

http://git-wip-us.apache.org/repos/asf/airavata/blob/414c0e9c/hosts
----------------------------------------------------------------------
diff --git a/hosts b/hosts
index 66f650f..2865ff1 100644
--- a/hosts
+++ b/hosts
@@ -1,19 +1,25 @@
 # inventory file : production
 
 [api-orch]
-149.165.156.196 host_name=js-156-196 host_address=149.165.156.196
-#149.165.171.11 host_name=js-171-11 host_address=149.165.171.11
+#149.165.156.196 host_name=js-156-196 host_address=149.165.156.196
+149.165.171.11 host_name=js-171-11 host_address=149.165.171.11
 
 [gfac]
-149.165.156.196 host_name=js-156-196 host_address=149.165.156.196
-#149.165.171.11 host_name=js-171-11 host_address=149.165.171.11
+#149.165.156.196 host_name=js-156-196 host_address=149.165.156.196
+149.165.171.11 host_name=js-171-11 host_address=149.165.171.11
 
 [pga]
 #149.165.156.196
 149.165.171.11
 
 [zookeeper]
-149.165.156.196 host_name=js-156-196 host_address=149.165.156.196
+#149.165.156.196 host_name=js-156-196 host_address=149.165.156.196
+149.165.171.11 host_name=js-171-11 host_address=149.165.171.11
 
 [rabbitmq]
-149.165.156.196 host_name=js-156-196 host_address=149.165.156.196
+#149.165.156.196 host_name=js-156-196 host_address=149.165.156.196
+149.165.171.11 host_name=js-171-11 host_address=149.165.171.11
+
+[database]
+#149.165.156.196
+149.165.171.11

http://git-wip-us.apache.org/repos/asf/airavata/blob/414c0e9c/roles/database/handlers/main.yml
----------------------------------------------------------------------
diff --git a/roles/database/handlers/main.yml b/roles/database/handlers/main.yml
new file mode 100644
index 0000000..85269b8
--- /dev/null
+++ b/roles/database/handlers/main.yml
@@ -0,0 +1,8 @@
+---
+- name: start mariadb
+  service: name=mariadb state=started enabled=yes
+
+- name: stop mariadb
+  service: name=mariadb state=stopped
+
+...

http://git-wip-us.apache.org/repos/asf/airavata/blob/414c0e9c/roles/database/tasks/main.yml
----------------------------------------------------------------------
diff --git a/roles/database/tasks/main.yml b/roles/database/tasks/main.yml
new file mode 100644
index 0000000..0babc12
--- /dev/null
+++ b/roles/database/tasks/main.yml
@@ -0,0 +1,41 @@
+---
+# - name: yum update
+#   yum: name=* state=latest
+
+# Install Mysql
+- name: install pip
+  yum: name=python-pip state=latest
+
+- name: install pexpect
+  pip: name=pexpect
+
+# - name: Adds Python MySQL support on Debian/Ubuntu
+#   apt: pkg="python-mysqldb" state=present
+#   when: ansible_os_family == 'Debian'
+
+- name: Adds Python MySQL support on RedHat/CentOS
+  yum: name=MySQL-python state=present
+  # when: ansible_os_family == 'RedHat'
+
+- name: install mariadb
+  yum: name="{{ item }}" state=latest update_cache=yes
+  with_items: "{{ mysql_packages }}"
+
+- name: start mariadb
+  service: name=mariadb state=started enabled=yes
+
+- include: secure_install.yml
+
+- name: create databases
+  mysql_db: name="{{ item }}" state=present
+  with_items:
+    - "{{ app_catalog }}"
+    - "{{ exp_catalog }}"
+    - "{{ replica_catalog }}"
+    - "{{ workflow_catalog }}"
+    - "{{ credential_store }}"
+
+- name: create new user {{ db_user }} with all privilege
+  mysql_user: name="{{ db_user }}" password="{{ db_password }}" priv=*.*:ALL state=present
+
+...

http://git-wip-us.apache.org/repos/asf/airavata/blob/414c0e9c/roles/database/tasks/secure_install.yml
----------------------------------------------------------------------
diff --git a/roles/database/tasks/secure_install.yml b/roles/database/tasks/secure_install.yml
new file mode 100644
index 0000000..cfb790b
--- /dev/null
+++ b/roles/database/tasks/secure_install.yml
@@ -0,0 +1,18 @@
+---
+# This is ansible equivalent for mysql_secure_installation
+- name: Sets the root password
+  mysql_user: user=root password="{{ mysql_root_password }}" host=localhost
+
+- name: Copy .my.cnf file
+  template: src=my.cnf dest=/root/.my.cnf
+
+- name: Removes all anonymous user accounts
+  mysql_user: name='' host_all=yes state=absent
+
+- name: Secures the MySQL root user for all hosts
+  mysql_user: user="root" password="{{ mysql_root_password }}" host_all=yes
+
+- name: Removes the MySQL test database
+  mysql_db: db=test state=absent
+
+...

http://git-wip-us.apache.org/repos/asf/airavata/blob/414c0e9c/roles/database/templates/my.cnf
----------------------------------------------------------------------
diff --git a/roles/database/templates/my.cnf b/roles/database/templates/my.cnf
new file mode 100644
index 0000000..ebe5b5b
--- /dev/null
+++ b/roles/database/templates/my.cnf
@@ -0,0 +1,4 @@
+# Example .my.cnf file for setting the root password
+[client]
+user=root
+password="{{ mysql_root_password }}"

http://git-wip-us.apache.org/repos/asf/airavata/blob/414c0e9c/roles/database/vars/main.yml
----------------------------------------------------------------------
diff --git a/roles/database/vars/main.yml b/roles/database/vars/main.yml
new file mode 100644
index 0000000..3bbc070
--- /dev/null
+++ b/roles/database/vars/main.yml
@@ -0,0 +1,7 @@
+---
+mysql_packages:
+  - mariadb-server
+  - mariadb
+mysql_root_password: "admin"
+
+...

http://git-wip-us.apache.org/repos/asf/airavata/blob/414c0e9c/site.yml
----------------------------------------------------------------------
diff --git a/site.yml b/site.yml
index 7f775db..63c2fae 100644
--- a/site.yml
+++ b/site.yml
@@ -30,4 +30,10 @@
   tags: pga
   roles:
     - pga
+
+- hosts: database
+  tags: mysql
+  roles:
+    - database
+
 ...


Mime
View raw message