Ansible node not able to access a file in my host System
我试图通过Ansible Roles将文件从我的Host Mac系统复制到VM上的CentOS。
我有一个名为Ansible Roles的文件夹,在其下我使用了ansible-galaxy命令并创建了一个名为tomcatdoccfg的角色。 helloworld.war存在于根Ansible Roles文件夹中。
文件夹结构如下:
Mac上的Ansible tasks main.yml playbook如下:
1 2 3 4 | - name: Copy war file to tmp copy: src: ?helloworld.war dest: /tmp/helloworld.war |
用户abhilashdk(我的默认MAC用户名)应该可以访问helloworld.war文件。 CentOS VM还有一个名为abhilashdk的用户。我已经配置了ssh密钥。意思是我已经生成了ssh-keys -t rsa并使用ssh-copy-id将密钥移动到CentOS VM,我可以使用
我在根Ansible Roles文件夹中有一个main.yml文件,其内容如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | --- - hosts: node1 vars: webapp: app1: PORT: 8090 NAME: webapp1 app2: PORT: 8091 NAME: webapp2 become: true roles: - docinstall - tomcatdoccfg |
现在,当我运行命令
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: /Files/DevOps/Ansible/Ansible_roles/?helloworld.war
fatal: [node1]: FAILED! => {"changed": false,"msg":"Could not find or access '?helloworld.war'
Searched in:
\t/Files/DevOps/Ansible/Ansible_roles/tomcatdoccfg/files/?helloworld.war
\t/Files/DevOps/Ansible/Ansible_roles/tomcatdoccfg/?helloworld.war
\t/Files/DevOps/Ansible/Ansible_roles/tomcatdoccfg/tasks/files/?helloworld.war
\t/Files/DevOps/Ansible/Ansible_roles/tomcatdoccfg/tasks/?helloworld.war
\t/Files/DevOps/Ansible/Ansible_roles/files/?helloworld.war
\t/Files/DevOps/Ansible/Ansible_roles/?helloworld.war"}
我不明白我应该给hellowrold.war文件的权限,以便我在vm上的centos能够通过ansible playbook / roles访问它。
任何人都可以帮我解决这个问题。
提前致谢
添加为答案,所以我可以显示非拉丁字符,您在问题中附加的日志包括:
在
可能是Ansible无法在FS上找到该文件的原因。
为了安全起见,我会删除整个
这个参数将要求您为剧本操作提供sudo密码