/[pdpsoft]/trunk/aarc.master-portal/ansible/roles/masterportal/tasks/dep-mysql.yml
ViewVC logotype

Contents of /trunk/aarc.master-portal/ansible/roles/masterportal/tasks/dep-mysql.yml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3024 - (show annotations) (download) (as text)
Tue May 24 11:37:13 2016 UTC (6 years, 1 month ago) by tamasb
File MIME type: text/x-yaml
File size: 3105 byte(s)
update db handling for mysql 

so that it would match the handling of mariadb

1 ---
2
3 # Install MySQL Server
4
5 - name: Install MySQL
6 yum: name={{ item }} state=present
7 with_items: "{{ mysql_packages }}"
8 register: mysql_installation
9
10 - name: make a link to the connector
11 file:
12 src: "{{ mysql_connector_path }}/{{ mysql_connector }}"
13 dest: "{{ catalina_home }}/lib/{{ mysql_connector }}"
14 owner: root
15 group: root
16 state: link
17
18 # Start MySQL Server
19
20 - name: Start the MySQL service
21 service: name=mysqld state=started enabled=yes
22
23 # Configure root password (but only on fresh mysql installations)
24
25 - name: update mysql root password for all root accounts
26 mysql_user: name=root host={{ item }} password={{ mysql_root_password }} priv=*.*:ALL,GRANT
27 with_items:
28 - 127.0.0.1
29 - localhost
30 when: mysql_installation.changed
31
32 # check OA4MP Server DB
33
34 - name: Create MP Server DB
35 mysql_db:
36 name: "{{ mp_server_db }}"
37 state: present
38 login_user: root
39 login_password: "{{ mysql_root_password }}"
40 register: server_db
41 when: mysql_root_password is defined
42
43 - name: update mysql MP Server user account
44 mysql_user:
45 name: "{{ mp_server_db_user }}"
46 host: "{{ item }}"
47 password: "{{ mp_server_db_pw }}"
48 priv: "{{ mp_server_db }}.*:ALL"
49 login_user: root
50 login_password: "{{ mysql_root_password }}"
51 with_items:
52 - 127.0.0.1
53 - localhost
54 when: mysql_root_password is defined
55
56 - name: copy MP Server sql script
57 template:
58 src: mp-oa2-server-mysql.sql.j2
59 dest: /tmp/mp-oa2-server-mysql.sql
60 when: server_db is defined and server_db.changed
61
62 - name: execute MP Server sql script
63 mysql_db:
64 state: import
65 name: all
66 target: /tmp/mp-oa2-server-mysql.sql
67 login_user: root
68 login_password: "{{ mysql_root_password }}"
69 when: server_db is defined and server_db.changed
70
71 - name: remove MP Server sql script
72 file:
73 path: /tmp/oa4mp-server-mysql.sql
74 state: absent
75 when: server_db is defined and server_db.changed
76
77 # check OA4MP Client DB
78
79 - name: check MP Client DB
80 mysql_db:
81 name: "{{ mp_client_db }}"
82 state: present
83 login_user: root
84 login_password: "{{ mysql_root_password }}"
85 register: client_db
86 when: mysql_root_password is defined
87
88 - name: update mysql MP Client user account
89 mysql_user:
90 name: "{{ mp_client_db_user }}"
91 host: "{{ item }}"
92 password: "{{ mp_client_db_pw }}"
93 priv: "{{ mp_client_db }}.*:ALL"
94 login_user: root
95 login_password: "{{ mysql_root_password }}"
96 with_items:
97 - 127.0.0.1
98 - localhost
99 when: mysql_root_password is defined
100
101 - name: copy MP Client sql script
102 template:
103 src: mp-oa2-client-mysql.sql.j2
104 dest: /tmp/mp-oa2-client-mysql.sql
105 when: client_db is defined and client_db.changed
106
107 - name: execute MP Client sql script
108 mysql_db:
109 state: import
110 name: all
111 target: /tmp/mp-oa2-client-mysql.sql
112 login_user: root
113 login_password: "{{ mysql_root_password }}"
114 when: client_db is defined and client_db.changed
115
116 - name: remove MP Client sql script
117 file:
118 path: /tmp/mp-oa2-client-mysql.sql
119 state: absent
120 when: client_db is defined and client_db.changed
121

grid.support@nikhef.nl
ViewVC Help
Powered by ViewVC 1.1.28