Ansible角色:MySQL无法读取配置文件

时间:2015-06-23 15:20:57

标签: mysql yaml

我收到了以下错误。

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

我尝试了以下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}

我的配置有什么问题?

1 个答案:

答案 0 :(得分:0)

在运行ansible的计算机上是否存在/the-ansibles/roles/mysql/templates/etc_mysql_my.cnf.j2文件?

模板化文件需要位于本地计算机上而不是远程计算机上。