mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-04-08 11:40:33 -07:00
document how to use mysql_info to clone accounts to another server
This commit is contained in:
parent
213d6b8a5a
commit
77c6a68a02
1 changed files with 25 additions and 0 deletions
|
@ -125,6 +125,31 @@ EXAMPLES = r'''
|
||||||
- databases
|
- databases
|
||||||
exclude_fields: db_size
|
exclude_fields: db_size
|
||||||
return_empty_dbs: true
|
return_empty_dbs: true
|
||||||
|
|
||||||
|
- name: Clone users on another server - Step 1
|
||||||
|
delegate_to: server_source
|
||||||
|
community.mysql.mysql_info:
|
||||||
|
filter:
|
||||||
|
- users_privs
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- name: Clone users on another server - Step 2
|
||||||
|
community.mysql.mysql_user:
|
||||||
|
name: "{{ item.name }}"
|
||||||
|
host: "{{ item.host }}"
|
||||||
|
plugin: "{{ item.plugin | default(omit) }}"
|
||||||
|
plugin_auth_string: "{{ item.auth_string | default(omit) }}"
|
||||||
|
tls_require: "{{ item.tls_require | default(omit) }}"
|
||||||
|
priv: "{{ item.priv | default(omit) }}"
|
||||||
|
resource_limits: "{{ item.resource_limits | default(omit) }}"
|
||||||
|
state: present
|
||||||
|
loop: "{{ result.users_privs }}"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ item.name }}@{{ item.host }}"
|
||||||
|
when:
|
||||||
|
- item.name != 'root' # In case you don't want to import admin accounts
|
||||||
|
- item.name != 'mariadb.sys'
|
||||||
|
- item.name != 'mysql'
|
||||||
'''
|
'''
|
||||||
|
|
||||||
RETURN = r'''
|
RETURN = r'''
|
||||||
|
|
Loading…
Add table
Reference in a new issue