creating jenkins jobs with ansible

前端 未结 3 1648
后悔当初
后悔当初 2021-01-13 10:17

I\'m working on a project to deploy a jenkins CI server on centos7 using ansible And I\'m having problems creating jenkins jobs from an xml template using ansible.

E

3条回答
  •  不知归路
    2021-01-13 11:13

    The command module doesn't support input and output redirection since it doesn't pass the command string to a shell. This is what its documentation says:

    It will not be processed through the shell, so variables like $HOME and operations like "<", ">", "|", and "&" will not work (use the shell module if you need these features).

    So:

    - name: create jenkins jobs with xml files
      sudo: yes
      shell: "java -jar {{ jenkins.cli_dest }} -s http://localhost:8080 create-job {{ item.name }} < {{ jenkins_dest }}/{{ item.xml_name }}"
      with_items: jenkins_jobs
    

提交回复
热议问题