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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3023 by tamasb, Thu Mar 17 17:51:45 2016 UTC revision 3024 by tamasb, Tue May 24 11:37:13 2016 UTC
# Line 7  Line 7 
7    with_items: "{{ mysql_packages }}"    with_items: "{{ mysql_packages }}"
8    register: mysql_installation    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  # Start MySQL Server
19    
20  - name: Start the MySQL service  - name: Start the MySQL service
# Line 21  Line 29 
29      - localhost      - localhost
30    when: mysql_installation.changed    when: mysql_installation.changed
31    
32  # check OA4MP Client DB  # check OA4MP Server DB
33    
34  - name: check OA4MP Client DB  - name: Create MP Server DB
35    mysql_db:    mysql_db:
36      name: "{{mp_client_db}}"      name: "{{ mp_server_db }}"
37      state: present      state: present
38      login_user: root      login_user: root
39      login_password: "{{ mysql_root_password }}"      login_password: "{{ mysql_root_password }}"
40    register: client_db    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 oa4mp client sql script  - name: copy MP Server sql script
57    template:    template:
58      src: mp-oa2-client-mysql.sql.j2      src: mp-oa2-server-mysql.sql.j2
59      dest: /tmp/mp-oa2-client-mysql.sql      dest: /tmp/mp-oa2-server-mysql.sql
60    when: client_db.changed    when: server_db is defined and server_db.changed
61    
62  - name: execute oa4mp client sql script  - name: execute MP Server sql script
63    mysql_db:    mysql_db:
64      state: import      state: import
65      name: all      name: all
66      target: /tmp/mp-oa2-client-mysql.sql      target: /tmp/mp-oa2-server-mysql.sql
67      login_user: root      login_user: root
68      login_password: "{{ mysql_root_password }}"      login_password: "{{ mysql_root_password }}"
69    when: client_db.changed    when: server_db is defined and server_db.changed
70    
71  # check OA4MP Server DB  - 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  - name: Create OA4MP Client DB  # check OA4MP Client DB
78    
79    - name: check MP Client DB
80    mysql_db:    mysql_db:
81      name: "{{mp_server_db}}"      name: "{{ mp_client_db }}"
82      state: present      state: present
83      login_user: root      login_user: root
84      login_password: "{{ mysql_root_password }}"      login_password: "{{ mysql_root_password }}"
85    register: server_db    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 oa4mp server sql script  - name: copy MP Client sql script
102    template:    template:
103      src: mp-oa2-server-mysql.sql.j2      src: mp-oa2-client-mysql.sql.j2
104      dest: /tmp/mp-oa2-server-mysql.sql      dest: /tmp/mp-oa2-client-mysql.sql
105    when: server_db.changed    when: client_db is defined and client_db.changed
106    
107  - name: execute oa4mp server sql script  - name: execute MP Client sql script
108    mysql_db:    mysql_db:
109      state: import      state: import
110      name: all      name: all
111      target: /tmp/mp-oa2-server-mysql.sql      target: /tmp/mp-oa2-client-mysql.sql
112      login_user: root      login_user: root
113      login_password: "{{ mysql_root_password }}"      login_password: "{{ mysql_root_password }}"
114    when: server_db.changed    when: client_db is defined and client_db.changed
115    
116  - name: remove oa4mp server sql script  - name: remove MP Client sql script
117    file:    file:
118      path: /tmp/oa4mp-server-mysql.sql      path: /tmp/mp-oa2-client-mysql.sql
119      state: absent      state: absent
120    when: server_db.changed    when: client_db is defined and client_db.changed
121    

Legend:
Removed from v.3023  
changed lines
  Added in v.3024

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