Last active
January 26, 2019 03:23
-
-
Save larsks/c0e94a8ee04760fcede315999af93bc5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
C_NAME: larsks | |
DB_CPASSWD: password |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
DB_HOST: 172.17.0.2 | |
DB_MUSER: root | |
DB_MPASSWD: secret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: localhost | |
vars_files: | |
- customer_details.yml | |
- db_details.yml | |
tasks: | |
- name: Create a new database with name {{ C_NAME }} Company | |
mysql_db: | |
login_host: '{{ DB_HOST }}' | |
login_user: "{{ DB_MUSER }}" | |
login_port: 3306 | |
login_password: "{{ DB_MPASSWD }}" | |
name: "{{ C_NAME }}" | |
state: present | |
- name: Create tables in the database with name {{ C_NAME }} Company | |
mysql_db: | |
login_host: "{{ DB_HOST }}" | |
login_user: "{{ DB_MUSER }}" | |
login_port: 3306 | |
login_password: "{{DB_MPASSWD}}" | |
name: "{{ C_NAME }}" | |
- name: Create a new user {{ C_NAME }} with all rights on {{ C_NAME }} database | |
mysql_user: | |
login_host: "{{ DB_HOST }}" | |
login_user: "{{ DB_MUSER }}" | |
login_port: 3306 | |
login_password: "{{ DB_MPASSWD }}" | |
name: "{{ C_NAME }}" | |
password: "{{DB_CPASSWD}}" | |
host: '%' | |
priv: "{{ C_NAME }}.*:ALL" | |
state: present |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment