[root@localhost ~]# cat mariadb.yml
- hosts: all
# use priviledge (default : root)
become: yes
# the way to use priviledge
become_method: sudo
# remote_user: centos
# define tasks
tasks:
- name: mariadb is installed
yum: name=mariadb-server state=installed
- name: mariadb is running and enabled
service: name=mariadb state=started enabled=yes
root@localhost ~]# vagrant provision
==> default: Running provisioner: ansible...
Vagrant has automatically selected the compatibility mode '2.0'
according to the Ansible version installed (2.8.4).
Alternatively, the compatibility mode can be specified in your Vagrantfile:
https://www.vagrantup.com/docs/provisioning/ansible_common.html#compatibility_mode
default: Running ansible-playbook...
PLAY [all] *********************************************************************
TASK [Gathering Facts] *********************************************************
ok: [default]
TASK [mariadb is installed] ******************************************************
changed: [default]
TASK [mariadb is running and enabled] ********************************************
ok: [default]
PLAY RECAP *********************************************************************
default : ok=3 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
[root@localhost ~]# vagrant ssh
Last login: Tue Sep 3 04:58:21 2019 from 192.168.121.1
[vagrant@localhost ~]$ rpm -qa mysql*
[vagrant@localhost ~]$ rpm -qa mariadb*
mariadb-server-5.5.60-1.el7_5.x86_64
mariadb-libs-5.5.60-1.el7_5.x86_64
mariadb-5.5.60-1.el7_5.x86_64
[vagrant@localhost ~]$ [root@localhost ~]# vagrant provision
==> default: Running provisioner: ansible...
Vagrant has automatically selected the compatibility mode '2.0'
according to the Ansible version installed (2.8.4).
Alternatively, the compatibility mode can be specified in your Vagrantfile:
https://www.vagrantup.com/docs/provisioning/ansible_common.html#compatibility_mode
default: Running ansible-playbook...
PLAY [all] *********************************************************************
TASK [Gathering Facts] *********************************************************
ok: [default]
TASK [mariadb is installed] ****************************************************
ok: [default]
TASK [mariadb is running and enabled] ******************************************
changed: [default]
PLAY RECAP *********************************************************************
default : ok=3 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
[root@localhost ~]# vagrant ssh
Last login: Tue Sep 3 05:03:08 2019 from 192.168.121.1
[vagrant@localhost ~]$ mariadb
-bash: mariadb: command not found
[vagrant@localhost ~]$ mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.60-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
- hosts: all
# use priviledge (default : root)
become: yes
# the way to use priviledge
become_method: sudo
# remote_user: centos
# define tasks
tasks:
- name: mariadb is installed
yum: name=mariadb-server state=installed
- name: mariadb is running and enabled
service: name=mariadb state=started enabled=yes
root@localhost ~]# vagrant provision
==> default: Running provisioner: ansible...
Vagrant has automatically selected the compatibility mode '2.0'
according to the Ansible version installed (2.8.4).
Alternatively, the compatibility mode can be specified in your Vagrantfile:
https://www.vagrantup.com/docs/provisioning/ansible_common.html#compatibility_mode
default: Running ansible-playbook...
PLAY [all] *********************************************************************
TASK [Gathering Facts] *********************************************************
ok: [default]
TASK [mariadb is installed] ******************************************************
changed: [default]
TASK [mariadb is running and enabled] ********************************************
ok: [default]
PLAY RECAP *********************************************************************
default : ok=3 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
[root@localhost ~]# vagrant ssh
Last login: Tue Sep 3 04:58:21 2019 from 192.168.121.1
[vagrant@localhost ~]$ rpm -qa mysql*
[vagrant@localhost ~]$ rpm -qa mariadb*
mariadb-server-5.5.60-1.el7_5.x86_64
mariadb-libs-5.5.60-1.el7_5.x86_64
mariadb-5.5.60-1.el7_5.x86_64
[vagrant@localhost ~]$ [root@localhost ~]# vagrant provision
==> default: Running provisioner: ansible...
Vagrant has automatically selected the compatibility mode '2.0'
according to the Ansible version installed (2.8.4).
Alternatively, the compatibility mode can be specified in your Vagrantfile:
https://www.vagrantup.com/docs/provisioning/ansible_common.html#compatibility_mode
default: Running ansible-playbook...
PLAY [all] *********************************************************************
TASK [Gathering Facts] *********************************************************
ok: [default]
TASK [mariadb is installed] ****************************************************
ok: [default]
TASK [mariadb is running and enabled] ******************************************
changed: [default]
PLAY RECAP *********************************************************************
default : ok=3 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
[root@localhost ~]# vagrant ssh
Last login: Tue Sep 3 05:03:08 2019 from 192.168.121.1
[vagrant@localhost ~]$ mariadb
-bash: mariadb: command not found
[vagrant@localhost ~]$ mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.60-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
Comments
Post a Comment