Hi Tony, On Montag, 26. Oktober 2020 18:34:50 CET Tony Wong wrote: > answer file > > esxi_hostname: '{{ inventory_hostname }}'
^ you are setting esxi_hostname to inventory_hostname. > esxi_root_user: 'root' > esxi_root_pass: 'xxx' > new_esx_local_root_user: 'root' > new_esx_local_root_pass: 'yyy' > > ------------------------------------------------- > > playbook file > > --- > - name: "change the root password" > hosts: localhost ^ you connect to localhost, so inventory_hostname = localhost Ansible does not care which hosts are in your inventory, inventory_hostname is always the host the task is run on/for. > tasks: > - name: "change root pass" > community.vmware.vmware_local_user_manager: > hostname: " {{ esxi_hostname }}" > username: " {{ esxi_root_user }}" > password: " {{ esxi_root_pass }}" > local_user_name: "{{ new_esx_local_root_user }}" > local_user_password: "{{ new_esx_local_root_pass }}" > state: present > validate_certs: no > > - name: print results > debug: msg=" {{ result }}" > vars_files: > - answerfile.yml try something like: - hosts: esx tasks: - name: foo bar: baz: blah delegate_to: localhost Then the task should be run once for each host, but always on localhost. Sebastian -- Sebastian Meyer Linux Consultant & Trainer ´Mail: me...@b1-systems.de B1 Systems GmbH Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537 -- 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 ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/4038612.pfi5OA7P3o%40kamino.meyer.b1-systems.de.
signature.asc
Description: This is a digitally signed message part.