使用 ansible playbook 将 .war 文件复制到远程服务器时出错
Error while copying .war file to the remote server using ansible playbook
我正在尝试使用 ansible playbook 部署 .war
文件(从 /var/lib/jenkins/workspace/abc/target/abc.war
到 /home/tomcat/webapps/
),该 playbook 安装在与 jenkins 运行 相同的服务器中。出现以下错误,
Could not find or access '/var/lib/jenkins/workspace/abc/target/abc.war' on the Ansible Controller.\nIf you are using a module and expect the file to exist on the remote, see the remote_src option
已使用
通过 ssh 身份验证验证远程服务器连接
ansible all -m ping, output is 192.168.*.***
| SUCCESS
部署文件,
---
- name: Deploy war
hosts: Appservers
tasks:
- name: Stop Tomcat
command: /home/apache-tomcat-9.0.37/bin/shutdown.sh
- name: Delete old war
command: rm -rf /home/apache-tomcat-9.0.37/webapps/abc*
- name: Copy the war file
copy:
src: /var/lib/jenkins/workspace/abc/target/abc.war
dest: /home/apache-tomcat-9.0.37/webapps/
- name: Start Tomcat
command: /home/apache-tomcat-9.0.37/bin/startup.sh
我不明白为什么我会在一切正常的情况下收到上述错误。上传图片以供参考。
PS: war jenkins 拥有的文件,主机和远程用户=root,deployment.yaml root 拥有并拥有 777 权限。
是的,正如 Zeitounator 提出的权限问题。我的工作区只有只读权限,因为我收到了错误,现在我将权限更改为 r-x 并且它工作正常。谢谢 Zeitounator!!
我正在尝试使用 ansible playbook 部署 .war
文件(从 /var/lib/jenkins/workspace/abc/target/abc.war
到 /home/tomcat/webapps/
),该 playbook 安装在与 jenkins 运行 相同的服务器中。出现以下错误,
Could not find or access '/var/lib/jenkins/workspace/abc/target/abc.war' on the Ansible Controller.\nIf you are using a module and expect the file to exist on the remote, see the remote_src option
已使用
通过 ssh 身份验证验证远程服务器连接ansible all -m ping, output is 192.168.*.***
| SUCCESS
部署文件,
---
- name: Deploy war
hosts: Appservers
tasks:
- name: Stop Tomcat
command: /home/apache-tomcat-9.0.37/bin/shutdown.sh
- name: Delete old war
command: rm -rf /home/apache-tomcat-9.0.37/webapps/abc*
- name: Copy the war file
copy:
src: /var/lib/jenkins/workspace/abc/target/abc.war
dest: /home/apache-tomcat-9.0.37/webapps/
- name: Start Tomcat
command: /home/apache-tomcat-9.0.37/bin/startup.sh
我不明白为什么我会在一切正常的情况下收到上述错误。上传图片以供参考。
PS: war jenkins 拥有的文件,主机和远程用户=root,deployment.yaml root 拥有并拥有 777 权限。
是的,正如 Zeitounator 提出的权限问题。我的工作区只有只读权限,因为我收到了错误,现在我将权限更改为 r-x 并且它工作正常。谢谢 Zeitounator!!