我正在尝试通过 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 作为配置文件的来源。"/Config-Files-Prod/"位于 git 存储库中的根文件夹下,该文件夹包含包含 nginx 文件的目录结构。 我是否必须将文件拉到 Jenkins 框中,然后才能将它们粘贴到 ansible,或者我可以简单地指向 ansible 直接引用 Git?
错误是
Could not find or access './Config-Files-Prod/NGINX Redirect/'nSearched in:nt<http://server.com/job/Ansible-AS/ws/Play-Books-Prod/files/./Config-Files-Prod/NGINX
抱歉,我修复了它,我移动了备份目录并更改了行
./Config-Files-Prod/NGINX Redirect/
自
../Config-Files-Prod/NGINX Redirect/
谢谢。