SHARE
TWEET

Untitled

a guest Jan 25th, 2019 131 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ##Create a new company Database,  & create a user with all privileges on that DB
  2. ---
  3. - hosts: localhost
  4.   sudo: no
  5.   connection: local
  6.   vars:
  7.     playbook_version: 1.0
  8.     vars_files:
  9.     - db_details.yml
  10.   tasks:
  11.   - name: Create a new database with name xyz
  12.     mysql_db:
  13.       login_host: {{ DB_HOST }}
  14.       login_user: {{ DB_MASTER_USER }}
  15.       login_port: 3306
  16.       login_password: {{ DB_MASTER_PASSWD }}
  17.       name: {{ DB_NAME }}
  18.       state: present
  19.   - name: Create a new user with name {{ DB_USER }}
  20.     mysql_user:
  21.       login_host: {{ DB_HOST }}
  22.       login_user: {{ DB_MASTER_USER }}
  23.       login_port: 3306
  24.       login_password: {{ DB_MASTER_PASSWD }}
  25.       name: {{ DB_USER }}
  26.       password: {{DB_CUSTOMER_PASSWD}}
  27.       host: '%'
  28.       priv: '{{ DB_NAME }}.*:ALL'
  29.       state: present
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top