2018-11-09 17:59:19 +01:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: Issue test setup - drop database
|
|
|
|
mysql_db:
|
|
|
|
name: "{{ item }}"
|
|
|
|
state: absent
|
|
|
|
login_unix_socket: '{{ mysql_socket }}'
|
|
|
|
loop:
|
|
|
|
- foo
|
|
|
|
- bar
|
|
|
|
|
|
|
|
- name: Issue test setup - create database
|
|
|
|
mysql_db:
|
|
|
|
name: "{{ item }}"
|
|
|
|
state: present
|
|
|
|
login_unix_socket: '{{ mysql_socket }}'
|
|
|
|
loop:
|
|
|
|
- foo
|
|
|
|
- bar
|
|
|
|
|
2019-01-25 04:25:06 +01:00
|
|
|
- name: Copy SQL scripts to remote
|
|
|
|
copy:
|
|
|
|
src: "{{ item }}"
|
|
|
|
dest: "{{ remote_tmp_dir }}/{{ item | basename }}"
|
|
|
|
with_items:
|
|
|
|
- create-function.sql
|
|
|
|
- create-procedure.sql
|
|
|
|
|
2018-11-09 17:59:19 +01:00
|
|
|
- name: Create function for test
|
2019-01-25 04:25:06 +01:00
|
|
|
shell: "mysql < {{ remote_tmp_dir }}/create-function.sql"
|
2018-11-09 17:59:19 +01:00
|
|
|
|
|
|
|
- name: Create procedure for test
|
2019-01-25 04:25:06 +01:00
|
|
|
shell: "mysql < {{ remote_tmp_dir }}/create-procedure.sql"
|
2018-11-09 17:59:19 +01:00
|
|
|
|
|
|
|
- name: Create user with FUNCTION and PROCEDURE privileges
|
|
|
|
mysql_user:
|
|
|
|
name: '{{ user_name_2 }}'
|
|
|
|
password: '{{ user_password_2 }}'
|
|
|
|
state: present
|
|
|
|
priv: 'FUNCTION foo.function:EXECUTE/foo.*:SELECT/PROCEDURE bar.procedure:EXECUTE'
|
|
|
|
login_unix_socket: '{{ mysql_socket }}'
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- name: Assert Create user with FUNCTION and PROCEDURE privileges
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is success
|
|
|
|
- result is changed
|
|
|
|
|
|
|
|
- name: Create user with FUNCTION and PROCEDURE privileges - Idempotent check
|
|
|
|
mysql_user:
|
|
|
|
name: '{{ user_name_2 }}'
|
|
|
|
password: '{{ user_password_2 }}'
|
|
|
|
state: present
|
|
|
|
priv: 'FUNCTION foo.function:EXECUTE/foo.*:SELECT/PROCEDURE bar.procedure:EXECUTE'
|
|
|
|
login_unix_socket: '{{ mysql_socket }}'
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- name: Assert Create user with FUNCTION and PROCEDURE privileges
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is success
|
|
|
|
- result is not changed
|
|
|
|
|
|
|
|
- name: Remove user
|
|
|
|
mysql_user:
|
|
|
|
name: '{{ user_name_2 }}'
|
|
|
|
state: absent
|
|
|
|
login_unix_socket: '{{ mysql_socket }}'
|
|
|
|
|
|
|
|
- name: Issue test teardown - cleanup databases
|
|
|
|
mysql_db:
|
|
|
|
name: "{{ item }}"
|
|
|
|
state: absent
|
|
|
|
login_unix_socket: '{{ mysql_socket }}'
|
|
|
|
loop:
|
|
|
|
- foo
|
|
|
|
- bar
|