thanks I got it working now w this
---
- hosts: all
gather_facts: false
connection: local
vars_files:
- answerfile.yml
tasks:
- name: "change root pass"
community.vmware.vmware_local_user_manager:
hostname: "{{ inventory_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: False
delegate_to: localhost
On Tuesday, October 27, 2020 at 4:37:42 AM UTC-7 Sebastian Meyer wrote:
> 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: [email protected]
>
> 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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/7f617d2d-78ce-4ce7-bb38-0fd1b8c133ddn%40googlegroups.com.