mysql modules: fix examples to use FQCN (#3)

This commit is contained in:
Andrew Klychkov 2020-07-13 12:52:49 +03:00 committed by GitHub
parent 4a3cfa6a32
commit c255d7ece2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 53 additions and 53 deletions

View file

@ -186,12 +186,12 @@ extends_documentation_fragment:
EXAMPLES = r'''
- name: Create a new database with name 'bobdata'
mysql_db:
community.mysql.mysql_db:
name: bobdata
state: present
- name: Create new databases with names 'foo' and 'bar'
mysql_db:
community.mysql.mysql_db:
name:
- foo
- bar
@ -204,26 +204,26 @@ EXAMPLES = r'''
dest: /tmp
- name: Restore database
mysql_db:
community.mysql.mysql_db:
name: my_db
state: import
target: /tmp/dump.sql.bz2
- name: Restore database ignoring errors
mysql_db:
community.mysql.mysql_db:
name: my_db
state: import
target: /tmp/dump.sql.bz2
force: yes
- name: Dump multiple databases
mysql_db:
community.mysql.mysql_db:
state: dump
name: db_1,db_2
target: /tmp/dump.sql
- name: Dump multiple databases
mysql_db:
community.mysql.mysql_db:
state: dump
name:
- db_1
@ -231,13 +231,13 @@ EXAMPLES = r'''
target: /tmp/dump.sql
- name: Dump all databases to hostname.sql
mysql_db:
community.mysql.mysql_db:
state: dump
name: all
target: /tmp/dump.sql
- name: Dump all databases to hostname.sql including master data
mysql_db:
community.mysql.mysql_db:
state: dump
name: all
target: /tmp/dump.sql
@ -247,7 +247,7 @@ EXAMPLES = r'''
- name: >
Import dump.sql with specific latin1 encoding,
similar to mysql -u <username> --default-character-set=latin1 -p <password> < dump.sql
mysql_db:
community.mysql.mysql_db:
state: import
name: all
encoding: latin1
@ -257,19 +257,19 @@ EXAMPLES = r'''
- name: >
Dump of Databse with specific latin1 encoding,
similar to mysqldump -u <username> --default-character-set=latin1 -p <password> <database>
mysql_db:
community.mysql.mysql_db:
state: dump
name: db_1
encoding: latin1
target: /tmp/dump.sql
- name: Delete database with name 'bobdata'
mysql_db:
community.mysql.mysql_db:
name: bobdata
state: absent
- name: Make sure there is neither a database with name 'foo', nor one with name 'bar'
mysql_db:
community.mysql.mysql_db:
name:
- foo
- bar
@ -278,14 +278,14 @@ EXAMPLES = r'''
# Dump database with argument not directly supported by this module
# using dump_extra_args parameter
- name: Dump databases without including triggers
mysql_db:
community.mysql.mysql_db:
state: dump
name: foo
target: /tmp/dump.sql
dump_extra_args: --skip-triggers
- name: Try to create database as root/nopassword first. If not allowed, pass the credentials
mysql_db:
community.mysql.mysql_db:
check_implicit_admin: yes
login_user: bob
login_password: 123456

View file

@ -76,31 +76,31 @@ EXAMPLES = r'''
# ansible databases -m mysql_info -a 'filter=!settings'
- name: Collect all possible information using passwordless root access
mysql_info:
community.mysql.mysql_info:
login_user: root
- name: Get MySQL version with non-default credentials
mysql_info:
community.mysql.mysql_info:
login_user: mysuperuser
login_password: mysuperpass
filter: version
- name: Collect all info except settings and users by root
mysql_info:
community.mysql.mysql_info:
login_user: root
login_password: rootpass
filter: "!settings,!users"
- name: Collect info about databases and version using ~/.my.cnf as a credential file
become: yes
mysql_info:
community.mysql.mysql_info:
filter:
- databases
- version
- name: Collect info about databases and version using ~alice/.my.cnf as a credential file
become: yes
mysql_info:
community.mysql.mysql_info:
config_file: /home/alice/.my.cnf
filter:
- databases
@ -108,7 +108,7 @@ EXAMPLES = r'''
- name: Collect info about databases including empty and excluding their sizes
become: yes
mysql_info:
community.mysql.mysql_info:
config_file: /home/alice/.my.cnf
filter:
- databases

View file

@ -53,12 +53,12 @@ extends_documentation_fragment:
EXAMPLES = r'''
- name: Simple select query to acme db
mysql_query:
community.mysql.mysql_query:
login_db: acme
query: SELECT * FROM orders
- name: Select query to db acme with positional arguments
mysql_query:
community.mysql.mysql_query:
login_db: acme
query: SELECT * FROM acme WHERE id = %s AND story = %s
positional_args:
@ -66,7 +66,7 @@ EXAMPLES = r'''
- test
- name: Select query to test_db with named_args
mysql_query:
community.mysql.mysql_query:
login_db: test_db
query: SELECT * FROM test WHERE id = %(id_val)s AND story = %(story_val)s
named_args:
@ -74,7 +74,7 @@ EXAMPLES = r'''
story_val: test
- name: Run several insert queries against db test_db in single transaction
mysql_query:
community.mysql.mysql_query:
login_db: test_db
query:
- INSERT INTO articles (id, story) VALUES (2, 'my_long_story')

View file

@ -165,61 +165,61 @@ seealso:
EXAMPLES = r'''
- name: Stop mysql slave thread
mysql_replication:
community.mysql.mysql_replication:
mode: stopslave
- name: Get master binlog file name and binlog position
mysql_replication:
community.mysql.mysql_replication:
mode: getmaster
- name: Change master to master server 192.0.2.1 and use binary log 'mysql-bin.000009' with position 4578
mysql_replication:
community.mysql.mysql_replication:
mode: changemaster
master_host: 192.0.2.1
master_log_file: mysql-bin.000009
master_log_pos: 4578
- name: Check slave status using port 3308
mysql_replication:
community.mysql.mysql_replication:
mode: getslave
login_host: ansible.example.com
login_port: 3308
- name: On MariaDB change master to use GTID current_pos
mysql_replication:
community.mysql.mysql_replication:
mode: changemaster
master_use_gtid: current_pos
- name: Change master to use replication delay 3600 seconds
mysql_replication:
community.mysql.mysql_replication:
mode: changemaster
master_host: 192.0.2.1
master_delay: 3600
- name: Start MariaDB standby with connection name master-1
mysql_replication:
community.mysql.mysql_replication:
mode: startslave
connection_name: master-1
- name: Stop replication in channel master-1
mysql_replication:
community.mysql.mysql_replication:
mode: stopslave
channel: master-1
- name: >
Run RESET MASTER command which will delete all existing binary log files
and reset the binary log index file on the master
mysql_replication:
community.mysql.mysql_replication:
mode: resetmaster
- name: Run start slave and fail the task on errors
mysql_replication:
community.mysql.mysql_replication:
mode: startslave
connection_name: master-1
fail_on_error: yes
- name: Change master and fail on error (like when slave thread is running)
mysql_replication:
community.mysql.mysql_replication:
mode: changemaster
fail_on_error: yes

View file

@ -137,26 +137,26 @@ extends_documentation_fragment:
EXAMPLES = r'''
- name: Removes anonymous user account for localhost
mysql_user:
community.mysql.mysql_user:
name: ''
host: localhost
state: absent
- name: Removes all anonymous user accounts
mysql_user:
community.mysql.mysql_user:
name: ''
host_all: yes
state: absent
- name: Create database user with name 'bob' and password '12345' with all database privileges
mysql_user:
community.mysql.mysql_user:
name: bob
password: 12345
priv: '*.*:ALL'
state: present
- name: Create database user using hashed password with all database privileges
mysql_user:
community.mysql.mysql_user:
name: bob
password: '*EE0D72C1085C46C5278932678FBE2C6A782821B4'
encrypted: yes
@ -164,14 +164,14 @@ EXAMPLES = r'''
state: present
- name: Create database user with password and all database privileges and 'WITH GRANT OPTION'
mysql_user:
community.mysql.mysql_user:
name: bob
password: 12345
priv: '*.*:ALL,GRANT'
state: present
- name: Create user with password, all database privileges and 'WITH GRANT OPTION' in db1 and db2
mysql_user:
community.mysql.mysql_user:
state: present
name: bob
password: 12345dd
@ -181,14 +181,14 @@ EXAMPLES = r'''
# Note that REQUIRESSL is a special privilege that should only apply to *.* by itself.
- name: Modify user to require SSL connections.
mysql_user:
community.mysql.mysql_user:
name: bob
append_privs: yes
priv: '*.*:REQUIRESSL'
state: present
- name: Ensure no user named 'sally'@'localhost' exists, also passing in the auth credentials.
mysql_user:
community.mysql.mysql_user:
login_user: root
login_password: 123456
name: sally
@ -199,7 +199,7 @@ EXAMPLES = r'''
Ensure no user named 'sally'@'localhost' exists, also passing in the auth credentials.
If mysql allows root/nopassword login, try it without the credentials first.
If it's not allowed, pass the credentials.
mysql_user:
community.mysql.mysql_user:
check_implicit_admin: yes
login_user: root
login_password: 123456
@ -207,20 +207,20 @@ EXAMPLES = r'''
state: absent
- name: Ensure no user named 'sally' exists at all
mysql_user:
community.mysql.mysql_user:
name: sally
host_all: yes
state: absent
- name: Specify grants composed of more than one word
mysql_user:
community.mysql.mysql_user:
name: replication
password: 12345
priv: "*.*:REPLICATION CLIENT"
state: present
- name: Revoke all privileges for user 'bob' and password '12345'
mysql_user:
community.mysql.mysql_user:
name: bob
password: 12345
priv: "*.*:USAGE"
@ -230,13 +230,13 @@ EXAMPLES = r'''
# mydb.*:INSERT,UPDATE/anotherdb.*:SELECT/yetanotherdb.*:ALL
- name: Example using login_unix_socket to connect to server
mysql_user:
community.mysql.mysql_user:
name: root
password: abc123
login_unix_socket: /var/run/mysqld/mysqld.sock
- name: Example of skipping binary logging while adding user 'bob'
mysql_user:
community.mysql.mysql_user:
name: bob
password: 12345
priv: "*.*:USAGE"
@ -244,7 +244,7 @@ EXAMPLES = r'''
sql_log_bin: no
- name: Create user 'bob' authenticated with plugin 'AWSAuthenticationPlugin'
mysql_user:
community.mysql.mysql_user:
name: bob
plugin: AWSAuthenticationPlugin
plugin_hash_string: RDS
@ -252,7 +252,7 @@ EXAMPLES = r'''
state: present
- name: Limit bob's resources to 10 queries per hour and 5 connections per hour
mysql_user:
community.mysql.mysql_user:
name: bob
resource_limits:
MAX_QUERIES_PER_HOUR: 10

View file

@ -57,11 +57,11 @@ extends_documentation_fragment:
EXAMPLES = r'''
- name: Check for sync_binlog setting
mysql_variables:
community.mysql.mysql_variables:
variable: sync_binlog
- name: Set read_only variable to 1 persistently
mysql_variables:
community.mysql.mysql_variables:
variable: read_only
value: 1
mode: persist