Ansible: Can I execute role from command line?

前端 未结 7 856
陌清茗
陌清茗 2020-12-07 14:22

Suppose I have a role called \"apache\"

Now I want to execute that role on host 192.168.0.10 from the command line from Ansible host

ansible-playbook         


        
7条回答
  •  没有蜡笔的小新
    2020-12-07 15:07

    With ansible 2.7 you can do this:

    $ cd /path/to/ansible/
    $ ansible localhost -m include_role -a name=
    localhost | SUCCESS => {
        "changed": false,
        "include_variables": {
            "name": ""
        }
    }
    localhost | SUCCESS => {
        "msg": ""
    }
    

    This will run role from /path/to/ansible/roles or configured role path.

    Read more here: https://github.com/ansible/ansible/pull/43131

提交回复
热议问题