forked from premkumarshamala/laravel-ansible-setup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
02_install_mysql.yml
executable file
·35 lines (32 loc) · 993 Bytes
/
02_install_mysql.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
---
- hosts: test
become: true
remote_user: ubuntu
vars:
mysql_root_username: root
mysql_root_password: admin@123
tasks:
- name: install mysql
apt: name="{{item}}" update_cache=yes cache_valid_time=3600 state=present
with_items:
- mysql-server
- mysql-client
- python3-mysqldb
- libmysqlclient-dev
- name: start up the mysql service
shell: "service mysql start"
- name: ensure mysql is enabled to run on startup
service: name=mysql state=started enabled=true
- name: update mysql root password for all root accounts
mysql_user:
name: root
host: "{{ item }}"
password: "{{ mysql_root_password }}"
login_user: "{{ mysql_root_username }}"
login_password: "{{ mysql_root_password }}"
check_implicit_admin: yes
priv: "*.*:ALL,GRANT"
with_items:
- 127.0.0.1
- ::1
- localhost