GithubHelp home page GithubHelp logo

leogallego / ansible-role-mysql-root-password Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 19 KB

Ansible role to reset the root password for mysql and mariadb

License: GNU General Public License v3.0

ansible-role-mysql-root-password's Introduction

Role Name

A very simple role to reset the mysql or mariadb server root password

Requirements

  • MySQL or MariaDB Server must be installed.
  • The role checks for the /etc/init.d/mysql file to proceed.
  • You should have sudo or root for the role to work due to become (see example below)
  • python-mysqldb or python3-mysqldb is needed depending on python version

Role Variables

Right now it only has 2 variables:

mysql_root_username: root
mysql_root_password: "{{ mysql_root_password }}"

They have default values in defaults/main.yml, so they are not mandatory. You have the option to pass the mysql_root_password variable inline, in the vars/main.yml or with a ansible-vault file /vars/vault.yml

If you pass it with a vault file, keep in mind you should enter the vault password inline. Examples below.

Vault support is a work in progress.

Dependencies

A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.

Example Playbook

- hosts: dbservers
  become: true
  vars_files:
    - vars/main.yml
    - vars/vault.yml
  roles:
    - role: leogallego.mysql-root-password

Run it with the mysql password inline and ask for sudo password:

ansible-playbook -i mysql.hosts playbook-mysql-reset.yml -e "mysql_root_password=INLINEPASS" --ask-pass --ask-become-pass

Run it with variables in vars/main.yml:

ansible-playbook -i mysql.hosts playbook-mysql-reset.yml --ask-pass  --ask-become-pass

Run it with {{ mysql_root_password }} defined in vars/vault.yml:

ansible-playbook -i mysql.hosts playbook-mysql-reset.yml --ask-pass --ask-vault-pass --ask-become-pass

License

GPLv3

Author Information

Leonardo Gallego

ansible-role-mysql-root-password's People

Contributors

leogallego avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.