Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- # this file is for instlaling DB
- - hosts: rancher
- remote_user: ansible
- become: yes
- become_method: sudo
- connection: ssh
- vars:
- my_sql_root_pass: root_password
- tasks:
- - name: Install Mysql
- apt: name={{item}} state=installed update_cache=true
- with_items:
- - mysql-server
- - python-mysqldb
- - build-essential
- - python-pip
- - name: install mysql-python using pip
- pip: name={{item}} state=present
- with_items:
- - pip
- - MySQL-python
- - name: Start mysql service
- service: name=mysqld state=started enabled=true
- - name: update mysql root password
- mysql_user: name=root password={{ my_sql_root_pass }} priv=*.*:ALL,GRANT
- - name: create a new DB
- mysql_db: name=cattle
- collation=utf8_general_ci
- encoding=utf8
- state=present
- - name: create a new DB user
- mysql_user: name=cattle
- password=user_password
- priv="cattle.*:ALL,GRANT"
- host=localhost
- state=present
- - name: restart mysql
- service: name=mysqld state=restarted
Add Comment
Please, Sign In to add comment