79618511

Date: 2025-05-12 19:14:21
Score: 0.5
Natty:
Report link

I think you are asking two different questions:

  1. How can I specify host(s) without an inventory? The answer to this is to use "-i tomcat-webApp, tomcat-all,". You must include the trailing comma after the last hostname.

       ansible-playbook DeployWar.yml \
       -i tomcat-webApp,tomcat-all,
    

    Reference: Run Ansible playbook without inventory

  2. How can I pass multiple extra-vars from command line?

    • Option 2a: specify multiple extra-vars
    ansible-playbook DeployWar.yml \
    --extra-vars="testvar1=testing1" --extra-vars="testvar2=testing2"
    
    • Option 2b: pass one var and split it inside your playbook:
    ansible-playbook DeployWar.yml \
    --extra-vars="servers=tomcast-webApp tomcast-all"
    

    Then inside your playbook: {{ servers | split }}

Reasons:
  • Blacklisted phrase (0.5): How can I
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Low reputation (0.5):
Posted by: Peter