O seguinte erro aparece ao executar o playbook
TASK [Criar usuario no MySQL] ******************************************************
[WARNING]: Module did not set no_log for update_********word
Apesar de a mensagem final informar que o usuário foi criado, identifiquei que o teste de PHP não consegue se conectar à VM Mysql.
Testando conexao
Conexão falhou: Connection refused
Copiei os códigos disponibilizados pelo professor e colei no meu arquivo.
Versão do Ansible instalado:
ansible 2.9.9
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/home/vagrant/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/dist-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.17 (default, Apr 15 2020, 17:20:14) [GCC 7.5.0]
trecho do código do playbook referente a criação de usuário:
- name: 'Criar usuario no MySQL'
mysql_user:
login_user: root
name: phpuser
password: pass
priv: '*.*:ALL'
host: '%'
state: present
become: yes
Retorno completo ao executar o playbook
vagrant@ubuntu-bionic:~$ ansible-playbook -i /vagrant/configs/ansible/hosts /vagrant/configs/ansible/playbook.yml
PLAY [all] *************************************************************************
TASK [Gathering Facts] *************************************************************
ok: [192.168.1.19]
TASK [Instalar MySQL Server] *******************************************************
ok: [192.168.1.19]
TASK [Criar usuario no MySQL] ******************************************************
[WARNING]: Module did not set no_log for update_********word
ok: [192.168.1.19]
TASK [Copiar arquivo mysqld.cnf] ***************************************************
ok: [192.168.1.19]
PLAY RECAP *************************************************************************
192.168.1.19 : ok=4 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0