2016-10-29 1 views
0

나는 가능성있는 플레이 북을 가지고있다. 재생 목록을 실행할 때 사용할 환경 파일을 지정합니다.플레이 북을 플레이 북에 포함시키고 환경 파일을 정의하는 것

ansible-playbook playbooks/release-deploy.yaml -i env/LAB3 

난이도가 높은 플레이 북 내에서 다른 플레이 북을 호출하고 있으며 동일한 환경 파일을 사용하고 싶습니다.

나의 현재 설정은 다음과 같습니다 나는 작전을 실행할 때

- include: tasks/replace_configs.yaml 

그래서, 나는 오류가 발생합니다 : 그것은 '아무튼처럼

TASK [include] ***************************************************************** 
fatal: [10.169.99.70]: FAILED! => {"failed": true, "reason": "no action detected in task. This often indicates a misspelled module name, or incorrect module path. 

The error appears to have been in '/home/ansible/playbooks/tasks/replace_configs.yaml': line 2, column 3, but may 
be elsewhere in the file depending on the exact syntax problem. 

The offending line appears to be: 

--- 
- hosts: cac 
^here 


The error appears to have been in '/home/ansible/playbooks/tasks/replace_configs.yaml': line 2, column 3, but may 
be elsewhere in the file depending on the exact syntax problem. 


The offending line appears to be: 

--- 
- hosts: cac 
^here 
"} 

tasks/replace_configs.yamlenv/LAB3

를 사용할 필요가

이 보이는 cac이 무엇인지 압니다. 다른 설정을해야합니까?

+0

포함 파일과 env 파일을 공유하십시오. – Shasha99

답변

2

My current config is:

- include: tasks/replace_configs.yaml 

이 어떤 "설정"아니다, 이것은 작업 포함 된 파일을 포함하는 라인입니다.

은의 다음 "작업"을 살펴 보자 :

The offending line appears to be: 

--- 
- hosts: cac 
^here 

그것은 작업처럼 보이지 않는, 그것은 플레이 것 같습니다. 모듈 지시문을 포함하지 않을 가능성이 큽니다. 따라서 Anawa는 예상 된 작업에 제공된 모듈 이름이 없음을 올바르게 알립니다 : no action detected in task.

당신이 Ansible에 include 지시어를 사용하는 경우가 include의 들여 쓰기 수준에 포함 된 내용을두고, 그래서 당신은 작업을 포함 할 때, 당신은 작업

을 포함해야

귀하의 포함 된 파일은 다음과 같은 모양입니다 :

--- 
- name: This is a task 
    debug: msg="One task" 

- name: This is another task 
    debug: msg="Another task" 

등의 다른 정의를 포함해서는 안되며, 특히 상위 레벨에 속하는 정의를 포함해서는 안됩니다.

+0

자세한 답변 해 주셔서 감사합니다. - hosts 줄을 제거하자마자 완벽하게 작동했습니다. –

관련 문제