2017-08-17 50 views
0

我有Ansible 2.4.0。我想基於Ansible Jenkins DevOps Roles documentation配置詹金斯代理:Ansible中缺少jenkins_configure_proxy角色

- hosts: master 
    roles: 
    - jenkins_configure_proxy: 
     jenkins_home: "{{ jenkins_home }}" 
     proxy_host: "{{ proxy_host }}" 
     proxy_port: "{{ proxy_port }}" 
     become: true 
     environment: "{{proxy_env}}" 

當試圖執行ansible_playbook我得到:

錯誤!角色定義必須包含一個角色名

The error appears to have been in '/Users/me/projects/jenkins/jenkins.yml': line 10, column 7, but may 
be elsewhere in the file depending on the exact syntax problem. 

The offending line appears to be: 

    roles: 
    - jenkins_configure_proxy: 
    ^here 

這很奇怪,因爲像jenkins_plugin做工精細的其他角色。

我在做什麼錯?

回答

1

您使用角色的語法不帶參數與參數適用角色,請參見例如:

- roles: 
    # without or with default parameters 
    - jenkins_configure_proxy 
    # with custom parameters 
    - role: jenkins_configure_proxy 
     jenkins_home: "{{ jenkins_home }}" 
     proxy_host: "{{ proxy_host }}" 
+0

謝謝,但它仍然引起同樣的錯誤 – dzieciou

+1

「ERROR角色‘jenkins_configure_proxy’中就沒有...!」你在'。/ roles /'目錄下有'jenkins_configure_proxy'嗎? –