2017-08-17 48 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'吗? –