Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
If statement Ansible Pull多重回购_If Statement_Ansible - Fatal编程技术网

If statement Ansible Pull多重回购

If statement Ansible Pull多重回购,if-statement,ansible,If Statement,Ansible,我想通过ansible playbook获取多个存储库,但如果条件匹配 tasks: - name: pull from git abc/123 git: repo: git@gitlab.com:xyz.git dest: var/www/abc/123 update: yes version: $sprint_name tasks: - name: pull from git abc/234

我想通过ansible playbook获取多个存储库,但如果条件匹配

tasks:
    - name: pull from git abc/123
      git:
        repo: git@gitlab.com:xyz.git
        dest: var/www/abc/123
        update: yes
        version: $sprint_name

tasks:
    - name: pull from git abc/234 
      git:
        repo: git@gitlab.com:xyz.git
        dest: /var/www/234
        update: yes
        version: $sprint_name

现在,我想把“123”或“234”作为变量传递,如果用户只想拉“123”或“234”,那么用户应该能够这样做

如果您希望用户在playbook运行时做出选择,通过键入一些会改变playbook执行的信息,您可以使用
vars_prompt
部分

您将获得他对变量的响应,并在任务中使用
when
部分控制要运行的任务


请正确设置问题的格式并使其可读。很高兴听到@rohitkulkarni!也许您可以标记已回答的问题,这样浏览未回答的问题的人就不会偶然发现这个问题。