mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-07-03 15:10:22 -07:00
Linting
This commit is contained in:
parent
7cffcf3355
commit
978676a6dc
15 changed files with 75 additions and 59 deletions
|
@ -1,3 +1,4 @@
|
|||
---
|
||||
# test code to assert no mysql user
|
||||
# (c) 2014, Wayne Rosario <wrosario@ansible.com>
|
||||
|
||||
|
@ -22,4 +23,5 @@
|
|||
register: result
|
||||
|
||||
- name: assert mysql user is not present
|
||||
assert: { that: "'{{ user_name }}' not in result.stdout" }
|
||||
assert:
|
||||
that: "'{{ user_name }}' not in result.stdout"
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
---
|
||||
# test code to assert mysql user
|
||||
# (c) 2014, Wayne Rosario <wrosario@ansible.com>
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
---
|
||||
- name: "applying user {{ username }}@{{ host }} with update_password={{ update_password }}"
|
||||
mysql_user:
|
||||
login_user: '{{ mysql_parameters.login_user }}'
|
||||
|
@ -10,14 +11,17 @@
|
|||
password: "{{ password }}"
|
||||
update_password: "{{ update_password }}"
|
||||
register: result
|
||||
|
||||
- name: assert a change occurred
|
||||
assert:
|
||||
that:
|
||||
- "result.changed | bool == {{ expect_change }} | bool"
|
||||
- "result.password_changed == {{ expect_password_change }}"
|
||||
|
||||
- name: query the user
|
||||
command: "{{ mysql_command }} -BNe \"SELECT plugin, authentication_string FROM mysql.user where user='{{ username }}' and host='{{ host }}'\""
|
||||
register: existing_user
|
||||
|
||||
- name: assert the password is as set to expect_hash
|
||||
assert:
|
||||
that:
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
---
|
||||
# test code to create mysql user
|
||||
# (c) 2014, Wayne Rosario <wrosario@ansible.com>
|
||||
|
||||
|
@ -18,16 +19,16 @@
|
|||
|
||||
- vars:
|
||||
mysql_parameters: &mysql_params
|
||||
login_user: '{{ mysql_user }}'
|
||||
login_password: '{{ mysql_password }}'
|
||||
login_host: '{{ gateway_addr }}'
|
||||
login_port: '{{ mysql_primary_port }}'
|
||||
login_user: "{{ mysql_user }}"
|
||||
login_password: "{{ mysql_password }}"
|
||||
login_host: "{{ gateway_addr }}"
|
||||
login_port: "{{ mysql_primary_port }}"
|
||||
|
||||
block:
|
||||
- name: Drop mysql user if exists
|
||||
mysql_user:
|
||||
<<: *mysql_params
|
||||
name: '{{ user_name_1 }}'
|
||||
name: "{{ user_name_1 }}"
|
||||
state: absent
|
||||
ignore_errors: yes
|
||||
|
||||
|
@ -35,8 +36,8 @@
|
|||
- name: create mysql user {{user_name}}
|
||||
mysql_user:
|
||||
<<: *mysql_params
|
||||
name: '{{ user_name }}'
|
||||
password: '{{ user_password }}'
|
||||
name: "{{ user_name }}"
|
||||
password: "{{ user_password }}"
|
||||
state: present
|
||||
register: result
|
||||
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
- name: create mysql user {{ user_name_1 }}
|
||||
mysql_user:
|
||||
<<: *mysql_params
|
||||
name: '{{ user_name_1 }}'
|
||||
password: '{{ user_password_1 }}'
|
||||
name: "{{ user_name_1 }}"
|
||||
password: "{{ user_password_1 }}"
|
||||
state: present
|
||||
force_context: yes
|
||||
register: result
|
||||
|
|
|
@ -56,8 +56,8 @@
|
|||
- name: create mysql user that already exist (expect changed=false)
|
||||
mysql_user:
|
||||
<<: *mysql_params
|
||||
name: '{{user_name_1}}'
|
||||
password: '{{user_password_1}}'
|
||||
name: "{{ user_name_1 }}"
|
||||
password: "{{ user_password_1 }}"
|
||||
state: present
|
||||
register: result
|
||||
|
||||
|
@ -72,8 +72,8 @@
|
|||
- name: remove mysql user state=absent (expect changed=true)
|
||||
mysql_user:
|
||||
<<: *mysql_params
|
||||
name: '{{ user_name_1 }}'
|
||||
password: '{{ user_password_1 }}'
|
||||
name: "{{ user_name_1 }}"
|
||||
password: "{{ user_password_1 }}"
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
|
@ -90,8 +90,8 @@
|
|||
- name: remove mysql user that does not exist state=absent (expect changed=false)
|
||||
mysql_user:
|
||||
<<: *mysql_params
|
||||
name: '{{ user_name_1 }}'
|
||||
password: '{{ user_password_1 }}'
|
||||
name: "{{ user_name_1 }}"
|
||||
password: "{{ user_password_1 }}"
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
|
@ -108,8 +108,8 @@
|
|||
- name: create user with select privilege state=present (expect changed=true)
|
||||
mysql_user:
|
||||
<<: *mysql_params
|
||||
name: '{{ user_name_1 }}'
|
||||
password: '{{ user_password_1 }}'
|
||||
name: "{{ user_name_1 }}"
|
||||
password: "{{ user_password_1 }}"
|
||||
state: present
|
||||
register: result
|
||||
|
||||
|
@ -125,8 +125,8 @@
|
|||
- name: create user with select privilege state=present (expect changed=true)
|
||||
mysql_user:
|
||||
<<: *mysql_params
|
||||
name: '{{ user_name_2 }}'
|
||||
password: '{{ user_password_2 }}'
|
||||
name: "{{ user_name_2 }}"
|
||||
password: "{{ user_password_2 }}"
|
||||
state: present
|
||||
priv: '*.*:SELECT'
|
||||
register: result
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
---
|
||||
# test code to remove mysql user
|
||||
# (c) 2014, Wayne Rosario <wrosario@ansible.com>
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
---
|
||||
# test code for resource_limits parameter
|
||||
- vars:
|
||||
mysql_parameters: &mysql_params
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
---
|
||||
# Test code to ensure that appending privileges will not result in unnecessary changes when the current privileges
|
||||
# are a superset of the new privileges that have been defined.
|
||||
- vars:
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
---
|
||||
# Test code to ensure that subtracting privileges will not result in unnecessary changes.
|
||||
- vars:
|
||||
mysql_parameters: &mysql_params
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
---
|
||||
# test code for privileges for mysql_user module
|
||||
# (c) 2014, Wayne Rosario <wrosario@ansible.com>
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
---
|
||||
# Tests scenarios for both plaintext and encrypted user passwords.
|
||||
|
||||
- vars:
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
---
|
||||
# https://github.com/ansible-collections/community.mysql/issues/231
|
||||
- vars:
|
||||
mysql_parameters: &mysql_params
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
---
|
||||
# Tests scenarios for both plaintext and encrypted user passwords.
|
||||
|
||||
- vars:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue