Praveen Kv:
<#CLGL1N5J7|ansible>, I’m trying to create Mysql DB by referring Advanced Ansible course. For some reason, it is failing. Please find my playbook below, and find the error message,
Al West:
What OS are you using?
Al West:
Also it helps to paste output in text blocks. We don’t want to type out playbooks by hand from screenshots.
Al West:
Also do you have a link to the lab, I am unable to find one for installing mysql.
Praveen Kv:
- name: Deploy Web apps
hosts: target*
gather_facts: no
tasks:-
name: Install the pre-requesites for the web development
apt: name={{item}} state=present
with_items:- python
- python-setuptools
- python-dev
- build-essential
- python-pip
- python-mysqldb
-
name: Install mysql components
apt: name={{item}} state=present
with_items:- mysql-server
- mysql-client
-
name: Start the service
service:
name: mysql
state: started
enabled: yes -
name: Create new DB
mysql_db:
name: employee_db
state: present
-
Praveen Kv:
I’m using Ubuntu OS. and the session to install Mysql is at Session2-Web Development-15th recording at 8:11 min
Al West:
Which version of ubuntu OS - paste output of /etc/lsb-release
Praveen Kv:
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION=“Ubuntu 16.04.5 LTS”
Al West:
16.04 LTS is End of life - why are you using such an old version?
Praveen Kv:
I’m not aware, I used mumshad image. I used the below command to create the container.
docker run -d mmumshad/ubuntu-ssh-enabled
Al West:
You can’t do this in a docker container. It isn’t a full Linux environment. Use a VM like the video shows.
Praveen Kv:
Then probably we need to remove the video-8(Docker Image- ssh Enabled) from the course, which leads to confusion.
Al West:
No there is no need - the section you first refer to clearly shows VMs are used.
Al West:
Also Python 2 is end of life - use Python 3 now. I have edited you playbook to work on a newer version of Ubuntu and to use become:
---
- name: Deploy Web apps
hosts: sql
gather_facts: no
tasks:
- name: Install the pre-requesites for the web development
apt: name={{item}} state=present
become: yes
with_items:
- python3
- python3-setuptools
- python3-dev
- build-essential
- python3-pip
- python3-mysqldb
- name: Install mysql components
apt: name={{item}} state=present
become: yes
with_items:
- mysql-server
- mysql-client
- name: Start the service
become: yes
service:
name: mysql
state: started
enabled: yes
- name: Create new DB
become: yes
mysql_db:
name: employee_db
state: present
Praveen Kv:
Thank you so much