简体   繁体   中英

Ansible Role: MySQL unable to read configuration file

I've received the following error.

'msg': 'AnsibleError: unable to read /the-ansibles/roles/mysql/templates/etc_mysql_my.cnf.j2', 'failed': True

I tried the following playbook configure.yml.

# file: roles/mysql/tasks/configure.yml
---
- hosts: test
  remote_user: root
  tasks:
   - name: MySQL | Update the my.cnf
     action: template src=/the-ansibles/roles/mysql/templates/etc_mysql_my.cnf.j2 dest=/etc/mysql/my.cnf owner=root group=root mode=0644
     notify:
       - restart mysql
`
while executimg this by this command: ansible-playbook configure.yml
the following error appears.
>>>>>
fatal: [test] => {'msg': 'AnsibleError: unable to read /the-ansibles/roles/mysql/templates/etc_mysql_my.cnf.j2', 'failed': True}
fatal: [test] => {'msg': 'AnsibleError: unable to read /the-ansibles/roles/mysql/templates/etc_mysql_my.cnf.j2', 'failed': True}

What is wrong with my configuration?

Does the file /the-ansibles/roles/mysql/templates/etc_mysql_my.cnf.j2 exist on the machine that ansible is running from?

Templated files need to be on the local machine not the remote.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM