How can I pass variable to ansible playbook in the command line?

后端 未结 10 1941
不知归路
不知归路 2021-01-29 21:57

I\'m new to ansible and wonder how to do so as the following didn\'t work

ansible-playbook -i \'10.0.0.1,\' yada-yada.yml --tags \'loaddata\' django_fixtures=\"t         


        
10条回答
  •  天涯浪人
    2021-01-29 22:10

    ansible-playbok -i -e "proc_name=sshd"

    You can use the above command in below playbooks.

    ---
    - name: Service Status
    gather_facts: False
    tasks:
    - name: Check Service Status (Linux)
    shell: pgrep "{{ proc_name }}"
    register: service_status
    ignore_errors: yes
    debug: var=service_status.rc`
    

提交回复
热议问题