I have defined my hosts in the variable file:

[servers]

server1 ansible_host=ip address of server 1

server2 ansible_host=ip address of server 2

etc

I have a playbook that looks like this:
- hosts: '{{ hostname }}'
  gather_facts: no
  tasks:
  - name: Include vars for vcenter
    include_vars:
        file: /etc/ansible/roles/createvm/vars/main.yml
        name: vcenter
    vars:
      ansible_become_password: "{{ domain_password }}"

  - name: Include vars of server.yaml file
    include_vars:
        file: /etc/ansible/servers/{{ hostname }}.yaml
        name: server

  - name: Wait For Connection to Continue
    wait_for_connection:
      connect_timeout: 30

  - name: Reboot to check for second round of updates
    ansible.windows.win_reboot: 
      msg: "Reboot to check for second round of updates"   

  - import_role:
      name: windowsupdates

This playbook works fine if I run the command to specify 1 hostname:


ansible-playbook playbooks/file.yml -e "hostname=server1" -vvvv.

How can I run my file.yml against server1,server2 etc at the same time?

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/adaee4d9-0c58-4d00-a355-eeb4fe8bdba2n%40googlegroups.com.

Reply via email to