'Ansible : Ansible playbook / tasks for MySQL operations for windows machine
Good Day..
As per the ansible documentation, I can not find MySQL related tasks for Wondows machine. I need to create manual tasks to perform automated tasks for windows machine.
I have performed these tasks successfully
- name: Install mysql-connector
win_chocolatey:
name: mysql-connector
version: '8.0.28'
state: present
- name: Connection
raw: mysql -h localhost --user=root --password= --execute "CREATE DATABASE testDB"
- This tasks installs mysql and creates database named testDB in my virtual windows machine.
Now I want to create table inside that database. I have tried 2 ways. both are having issues for me
1.
- name: Create Table
raw : mysql -h localhost --user=root --password= --execute "CREATE TABLE `testDB`.`test1` (`employeeName` VARCHAR(20) NULL,`email` VARCHAR(45) NULL);"
-- Here, ` sign is behaving odd. Error: Unknown database 'estDB'\r\n", // It is omitting first character from testDB
2. I am trying to use dumped .sql file and want to import it directly. So that it can import DB with tables and fields.
- name: Table creation1
raw: mysql -h localhost --user=root --password= --execute "test < teamManagementApp.sql"
But here, < this character shows as reserved character for windows machine
Can someone help here?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|