You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by la...@apache.org on 2016/10/01 23:46:40 UTC
[18/49] airavata git commit: start mysql on aws ami
start mysql on aws ami
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/6e0715b4
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/6e0715b4
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/6e0715b4
Branch: refs/heads/lahiru/AIRAVATA-2107
Commit: 6e0715b48039e16b1864c1eb7ad69fd3e4867a20
Parents: 86a3919
Author: Shameera Rathnayaka <sh...@gmail.com>
Authored: Thu Aug 18 01:13:26 2016 -0400
Committer: Shameera Rathnayaka <sh...@gmail.com>
Committed: Thu Aug 18 01:13:26 2016 -0400
----------------------------------------------------------------------
group_vars/all | 3 ++-
roles/database/handlers/main.yml | 2 ++
roles/database/tasks/main.yml | 14 +++++++++++++-
roles/database/tasks/secure_install.yml | 10 +++++++---
roles/database/templates/my.cnf | 4 ----
roles/database/templates/my.cnf.j2 | 4 ++++
site.yml | 1 +
7 files changed, 29 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/6e0715b4/group_vars/all
----------------------------------------------------------------------
diff --git a/group_vars/all b/group_vars/all
index e1b8187..da3b24e 100644
--- a/group_vars/all
+++ b/group_vars/all
@@ -5,7 +5,7 @@ ansible_ssh_user: centos
ansible_ssh_private_key_file: /Users/syodage/Projects/airavata-ansible/shameera-aws.pem.txt
user: centos
-group: centos
+group: centos
user_home: "/home/{{ user }}"
deployment_dir: "{{ user_home }}/master-deployment"
@@ -13,6 +13,7 @@ airavata_dist: "apache-airavata-server-0.17-SNAPSHOT"
airavata_dist_name: "{{ airavata_dist }}-bin.tar.gz"
db_server: "gw62.iu.xsede.org"
+db_server_port: "3306"
db_user: "airavata"
db_password: "airavata"
app_catalog: "app_catalog"
http://git-wip-us.apache.org/repos/asf/airavata/blob/6e0715b4/roles/database/handlers/main.yml
----------------------------------------------------------------------
diff --git a/roles/database/handlers/main.yml b/roles/database/handlers/main.yml
index 85269b8..5400e8b 100644
--- a/roles/database/handlers/main.yml
+++ b/roles/database/handlers/main.yml
@@ -1,8 +1,10 @@
---
- name: start mariadb
service: name=mariadb state=started enabled=yes
+ become: yes
- name: stop mariadb
service: name=mariadb state=stopped
+ become: yes
...
http://git-wip-us.apache.org/repos/asf/airavata/blob/6e0715b4/roles/database/tasks/main.yml
----------------------------------------------------------------------
diff --git a/roles/database/tasks/main.yml b/roles/database/tasks/main.yml
index 0babc12..5fb75e4 100644
--- a/roles/database/tasks/main.yml
+++ b/roles/database/tasks/main.yml
@@ -3,11 +3,17 @@
# yum: name=* state=latest
# Install Mysql
+- name: install epel release
+ yum: name=epel-release state=present
+ become: yes
+
- name: install pip
- yum: name=python-pip state=latest
+ yum: name=python-pip state=latest update_cache=yes
+ become: yes
- name: install pexpect
pip: name=pexpect
+ become: yes
# - name: Adds Python MySQL support on Debian/Ubuntu
# apt: pkg="python-mysqldb" state=present
@@ -15,14 +21,17 @@
- name: Adds Python MySQL support on RedHat/CentOS
yum: name=MySQL-python state=present
+ become: yes
# when: ansible_os_family == 'RedHat'
- name: install mariadb
yum: name="{{ item }}" state=latest update_cache=yes
with_items: "{{ mysql_packages }}"
+ become: yes
- name: start mariadb
service: name=mariadb state=started enabled=yes
+ become: yes
- include: secure_install.yml
@@ -38,4 +47,7 @@
- name: create new user {{ db_user }} with all privilege
mysql_user: name="{{ db_user }}" password="{{ db_password }}" priv=*.*:ALL state=present
+- name: open database port
+ firewalld: port="{{ db_server_port }}/tcp" zone=public permanent=true state=enabled immediate=yes
+ become: yes
...
http://git-wip-us.apache.org/repos/asf/airavata/blob/6e0715b4/roles/database/tasks/secure_install.yml
----------------------------------------------------------------------
diff --git a/roles/database/tasks/secure_install.yml b/roles/database/tasks/secure_install.yml
index cfb790b..39ced65 100644
--- a/roles/database/tasks/secure_install.yml
+++ b/roles/database/tasks/secure_install.yml
@@ -1,16 +1,20 @@
---
# This is ansible equivalent for mysql_secure_installation
- name: Sets the root password
- mysql_user: user=root password="{{ mysql_root_password }}" host=localhost
+ mysql_user: user=root
+ password="{{ mysql_root_password }}"
+ host=localhost
+ login_user=root
- name: Copy .my.cnf file
- template: src=my.cnf dest=/root/.my.cnf
+ template: src=my.cnf.j2 dest="{{ user_home }}/.my.cnf"
+ # become: yes
- 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
+ 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/6e0715b4/roles/database/templates/my.cnf
----------------------------------------------------------------------
diff --git a/roles/database/templates/my.cnf b/roles/database/templates/my.cnf
deleted file mode 100644
index ebe5b5b..0000000
--- a/roles/database/templates/my.cnf
+++ /dev/null
@@ -1,4 +0,0 @@
-# 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/6e0715b4/roles/database/templates/my.cnf.j2
----------------------------------------------------------------------
diff --git a/roles/database/templates/my.cnf.j2 b/roles/database/templates/my.cnf.j2
new file mode 100644
index 0000000..ebe5b5b
--- /dev/null
+++ b/roles/database/templates/my.cnf.j2
@@ -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/6e0715b4/site.yml
----------------------------------------------------------------------
diff --git a/site.yml b/site.yml
index 6a7a634..6dd294e 100644
--- a/site.yml
+++ b/site.yml
@@ -35,6 +35,7 @@
- hosts: database
tags: mysql
roles:
+ - env_setup
- database
- hosts: wso2is