No ansible, ao copiar o arquivo, parece que houve um erro ao executar o comando "notify", segue a mensagem de erro:
TASK [Copiar arquivo mysqld.cnf] ****************************************************************************************************
fatal: [192.168.0.172]: FAILED! => {"changed": false, "checksum": "a8c3b949ad73978b5d98c29ae23065f1d7c8b73a", "msg": "Unsupported parameters for (copy) module: become, notify Supported parameters include: _original_basename, attributes, backup, checksum, content, delimiter, dest, directory_mode, follow, force, group, local_follow, mode, owner, regexp, remote_src, selevel, serole, setype, seuser, src, unsafe_writes, validate"}
Meu Playbook:
- 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