Estou obtendo a mensagem de erro:
fatal: [192.168.0.122]: FAILED! => {"changed": false, "msg": "The MySQL-python module is required."}
Estou criando as máquinas virtuais via Vagrant no Windows .
Vagrantfile:
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/bionic64"
# Controladora
config.vm.define "ansible" do |ansible|
ansible.vm.network "public_network", ip: "192.168.0.126", bridge: "Qualcomm Atheros QCA9377 Wireless Network Adapter"
ansible.vm.provider "virtualbox" do |vb|
vb.memory = 1024
vb.cpus = 1
vb.name = "ubunto_bionic_ansible"
end
ansible.vm.provision "shell",
inline: "cp /vagrant/configs/bionic_key /home/vagrant && \
chmod 600 /home/vagrant/bionic_key && \
chown vagrant:vagrant /home/vagrant/bionic_key"
ansible.vm.provision "shell",
inline: "apt-get update && \
apt-get install -y software-properties-common && \
apt-get install -y ansible && \
apt-get install -y vagrant"
ansible.vm.provision "shell",
inline: "cat /vagrant/configs/bionic_key.pub >> .ssh/authorized_keys"
end
# Controladas
config.vm.define "wordpress" do |wordpress|
wordpress.vm.network "public_network", ip: "192.168.0.122", bridge: "Qualcomm Atheros QCA9377 Wireless Network Adapter"
wordpress.vm.provider "virtualbox" do |vb|
vb.memory = 1024
vb.cpus = 1
vb.name = "ubunto_bionic_wordpress"
end
wordpress.vm.provision "shell",
inline: "cat /vagrant/configs/bionic_key.pub >> .ssh/authorized_keys"
wordpress.vm.provision "shell",
inline: "cp /vagrant/configs/bionic_key /home/vagrant && \
chmod 600 /home/vagrant/bionic_key && \
chown vagrant:vagrant /home/vagrant/bionic_key"
wordpress.vm.provision "shell",
inline: "apt-get update && \
apt-get install -y python3"
end
end
Hosts:
[wordpress]
192.168.0.122
[wordpress:vars]
ansible_user=vagrant
ansible_ssh_private_key_file=/home/vagrant/bionic_key
ansible_python_interpreter=/usr/bin/python3
ansible_ssh_common_args='-o StrictHostKeyChecking=no'
playbook.yml:
---
- hosts: all
tasks:
- name: 'Instala pacotes de dependencia do sistema operacional'
apt:
name:
- php
- apache2
- libapache2-mod-php
- php-gd
- php-ssh2
- php-dev
- libmcrypt-dev
- php-pear
- mcrypt
- mysql-server
- python-mysqldb
- php-mysql
- python-pip
- python-pymysql
state: latest
become: yes
- name: Create mysql database - wordpress_db
mysql_db:
name: wordpress_db
state: present
become: yes