Run command on the Ansible host

后端 未结 8 1287
小鲜肉
小鲜肉 2020-12-22 14:45

Is it possible to run commands on the Ansible host?

My scenario is that I want to take a checkout from a git server that is hosted internally (and isn\'t accessible

8条回答
  •  -上瘾入骨i
    2020-12-22 15:32

    Expanding on the answer by @gordon, here's an example of readable syntax and argument passing with shell/command module (these differ from the git module in that there are required but free-form arguments, as noted by @ander)

    - name: "release tarball is generated"
      local_action:
        module: shell
        _raw_params: git archive --format zip --output release.zip HEAD
        chdir: "files/clones/webhooks"
    

提交回复
热议问题