Install MySQL 8 Using Ansible on Vagrant AlmaLinux 8 System

Published: 02 June 2022
on channel: theurbanpenguin
2,434
57

In this video we look at installing MySQL 8 on AlmaLinux 8 by using an Ansible Playbook. We start by using Vagrant and Install the epel repo and ansible using the shell provisioner. We could use the ansible provisioner or even ansible_local but we will choose to use ansible from the gust system after vagrant has started. The Playbook will instal MySQL and set the MySQL root account password. Of course we manage the service but additionally add a database and data and a test user account

---
- name: Install Pre-Reqs
hosts: localhost
gather_facts: false
become: true
tasks:
- name: Install Python3
dnf:
name: python3
state: present

- name: Install and Manage MySQL 8.0 AlmaLinux 8
hosts: localhost
become: false
vars:
- ansible_python_interpreter: /usr/bin/python3
- password: Password1
tasks:
- name: install python mysql connector
become: true
dnf:
name:
- python3-PyMySQL
- mysql-server
- mysql
state: present
- name: service
become: true
service:
name: mysqld
state: started
enabled: true
- name: root mysql
become: true
mysql_user:
login_user: root
login_password: "{{ password }}"
name: root
password: "{{ password }}"
check_implicit_admin: true
- name: import
mysql_db:
login_user: root
login_password: "{{ password }}"
name: all
state: import
target: "{{ item }}"
loop:
- /vagrant/sakila-schema.sql
- /vagrant/sakila-data.sql
- name: user mysql
mysql_user:
name: tux
host: localhost
password: "{{ password }}"
login_user: root
login_password: "{{ password }}"
priv: "sakila.*:SELECT,GRANT"
update_password: on_create

Additionally you can find my video courses on Pluralsight: http://pluralsight.com/training/Autho... and take time to see my own site http://www.theurbanpenguin.com
00:00 Introduction
01:06 Vagrantfile
02:12 View Ansible Playbook
07:02 Vagrant up
08:49 Execute Ansible Playbook
10:37 Test MySQL

~-~~-~~~-~~-~
Please watch: "RHCSA 9 Working With Podman Containers"
   • How To Use Podman Containers  
~-~~-~~~-~~-~


Watch video Install MySQL 8 Using Ansible on Vagrant AlmaLinux 8 System online without registration, duration hours minute second in high quality. This video was added by user theurbanpenguin 02 June 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 2,43 once and liked it 5 people.