我正试图通过Jenkins运行Ansible剧本
- hosts: all
tasks:
- name: Print message
debug: msg="Hello number 2 from Ansible!!"
- name: ping all hosts
ping:
- debug: var=ansible_all_ipv4_addresses
- name: Update the repository cache and update package "nginx" to latest version using default release squeeze-backport
apt:
name: nginx
state: latest
update_cache: yes
- name: Copy config files for nginx
copy:
src: ./Config-Files-Prod/NGINX Redirect/
dest: /etc/nginx
force: yes
directory_mode: yes
直到它报告的复制部分无法找到文件" / Config-Files-Prod / NGINX Redirect /"
Playbook,Inventory和配置文件都保存在git存储库中,Jenkins作业通过Git插件处理。
但是如何在运行时使用git作为配置文件的源来获得ansible。 " /配置档案-PROD /"位于git存储库中的根文件夹下,该文件夹包含一个包含nginx文件的目录结构。在将它们传递给ansible之前,我是否必须将文件拉到Jenkins框中?或者我可以简单地指出ansible直接引用Git?
错误是
Could not find or access './Config-Files-Prod/NGINX Redirect/'\nSearched in:\n\t<http://server.com/job/Ansible-AS/ws/Play-Books-Prod/files/./Config-Files-Prod/NGINX
答案 0 :(得分:0)
Sorry I fixed it, I moved the back up directory and changed the line
./Config-Files-Prod/NGINX Redirect/
to
../Config-Files-Prod/NGINX Redirect/
Thank you.