Mysql Facts

mysql_databases

host.fact.mysql_databases(mysql_user=None, mysql_password=None, mysql_host=None, mysql_port=None)

Returns a dict of existing MySQL databases and associated data:

{
    'mysql': {
        'character_set': 'latin1',
        'collation_name': 'latin1_swedish_ci'
    },
}

mysql_user_grants

host.fact.mysql_user_grants(user, hostname='localhost', mysql_user=None, mysql_password=None, mysql_host=None, mysql_port=None)

Returns a dict of <database>`.<table> with granted privileges for each:

{
    '`pyinfra_stuff`.*': {
        'privileges': [
            'SELECT',
            'INSERT'
        ],
        "with_grant_option": false
    },
}

mysql_users

host.fact.mysql_users(mysql_user=None, mysql_password=None, mysql_host=None, mysql_port=None)

Returns a dict of MySQL user@host’s and their associated data:

{
    'user@host': {
        'privileges': ['Alter', 'Grant'],
        'max_connections': 5,
        ...
    },
}