Override hosts variable of Ansible playbook from the command line

前端 未结 11 1782
隐瞒了意图╮
隐瞒了意图╮ 2020-12-12 12:29

This is a fragment of a playbook that I\'m using (server.yml):

- name: Determine Remote User
  hosts: web
  gather_facts: false
  roles:
    - {         


        
11条回答
  •  孤城傲影
    2020-12-12 13:11

    This is a bit late, but I think you could use the --limit or -l command to limit the pattern to more specific hosts. (version 2.3.2.0)

    You could have - hosts: all (or group) tasks: - some_task

    and then ansible-playbook playbook.yml -l some_more_strict_host_or_pattern and use the --list-hosts flag to see on which hosts this configuration would be applied.

提交回复
热议问题