Não consegui executar o comando sudo ansible-playbook -i /vagrant/configs/ansible/hosts /vagrant/configs/ansible/playbook.yml aparece o erro:
TASK [Gathering Facts] **************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ValueError: No closing quotation
fatal: [192.168.77.203]: FAILED! => {"msg": "Unexpected failure during module execution.", "stdout": ""}
PLAY RECAP **************************************************************************************
192.168.77.203 : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
Meu arquivo hosts está assim:
[mysqlserver]
192.168.77.203
[mysqlserver:vars]
ansible_user=vagrant
ansible_ssh_private_key_file=/home/vagrant/id_bionic
ansible_python_interpreter=/usr/bin/python3
ansible_ssh_common_args='-o StrictHostKeyChecking=no'/home/vagrant/id_bionic"
o playbook.yml
- hosts: all
handlers:
- name: restart mysql
service:
name: mysql
state: restarted
become: yes
tasks:
- name: 'Instalar MySQL Server'
apt:
update_cache: yes
cache_valid_time: 3600 #1 hora
name: ["mysql-server-5.7", "python3-mysqldb"]
state: latest
become: yes
- name: 'Criar usuario no MySQL'
mysql_user:
login_user: root
name: phpuser
password: pass
priv: '*.*:ALL'
host: '%'
state: present
become: yes
- name: 'Copiar arquivo mysqld.cnf'
copy:
src: /vagrant/configs/mysqld.cnf
dest: /etc/mysql/mysql.conf.d/mysqld.cnf
owner: root
group: root
mode: 0644
become: yes
notify:
- restart mysql