Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

报错 #3

Open
lihulanxx opened this issue May 14, 2022 · 1 comment
Open

报错 #3

lihulanxx opened this issue May 14, 2022 · 1 comment

Comments

@lihulanxx
Copy link

给另一台远程服务器 config 报错
ansible-linux]# ansible-playbook -u root -i inventory/all playbooks/config.yml
TASK [configure hosts] **********************************************************************************
fatal: [202]: FAILED! => {"changed": false, "msg": "Could not find or access 'files/hosts.j2'\nSearched in:\n\t/root/ansible-linux/playbooks/templates/files/hosts.j2\n\t/root/ansible-linux/playbooks/files/hosts.j2\n\t/root/ansible-linux/playbooks/templates/files/hosts.j2\n\t/root/ansible-linux/playbooks/files/hosts.j2 on the Ansible Controller.\nIf you are using a module and expect the file to exist on the remote, see the remote_src option"}
需要在哪里添加remote_src
ansible-linux]# ansible-playbook -u root -i inventory/all playbooks/config.yml
远程系统如下
[root@202 ~]# uname -a
Linux 202 5.17.7-1.el7.elrepo.x86_64 #1 SMP PREEMPT Tue May 10 17:29:34 EDT 2022 x86_64 x86_64 x86_64 GNU/Linux
[root@202 ~]#

@Leif160519
Copy link
Owner

项目的hosts.j2是放在ansible-linux/files/hosts.j2里的,看报错信息是没有找到,请确认一下实际的hosts.j2的位置,另外playbooks里有files的软链接,所以可以直接在剧本中使用files/xxx直接引用jinjia文件

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants