2017-10-12 86 views
0

我试图通过詹金斯集成Ansible /詹金斯和Git

- 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 

这工作,直到它报告它无法找到文件“/配置档案-PROD复制部分运行Ansible剧本/ NGINX重定向/“

Playbook,Inventory和配置文件都保存在git存储库中,Jenkins作业通过Git插件处理。

但是,如何在运行时使用git作为配置文件的源代码。 “/ Config-Files-Prod /”位于git存储库的根文件夹下,该文件夹包含一个包含nginx文件的目录结构。在我可以将它们传递给可信任者之前,我是否必须将这些文件提交给Jenkins框?或者我可以简单地直接引用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

Jenkins中的我的工作区显示/ Config-files-Prod/NGINX中的文件REdirect – DevilWAH

回答

0

对不起固定它,我需要搬回了一个目录,不得不改线

./Config-Files-Prod/NGINX重定向/

../Config-Files-Prod/NGINX重定向/

谢谢