Run command on the Ansible host

后端 未结 8 1311
小鲜肉
小鲜肉 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条回答
  •  南笙
    南笙 (楼主)
    2020-12-22 15:35

    I'd like to share that Ansible can be run on localhost via shell:

    ansible all -i "localhost," -c local -m shell -a 'echo hello world'

    This could be helpful for simple tasks or for some hands-on learning of Ansible.

    The example of code is taken from this good article:

    Running ansible playbook in localhost

提交回复
热议问题