Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---
- - hosts: localhost
- gather_facts: false
- connection: local
- vars_prompt:
- - name: "vcenter_hostname"
- prompt: "Enter vcenter hostname"
- private: no
- default: "slc-vcenter01.internal.nwresearch.com"
- - name: "vcenter_user"
- prompt: "Enter vcenter username"
- private: no
- - name: "vcenter_pass"
- prompt: "Enter vcenter password"
- private: yes
- vars:
- guest_password:
- tasks:
- - name: including hostnames
- include_vars: /opt/git/devops/hostnames_for_vmware.yml
- - name: Gather VM facts
- vmware_guest:
- validate_certs: false
- vcenter_hostname: "{{ vcenter_hostname }}"
- username: "{{ vcenter_user }}"
- password: "{{ vcenter_pass }}"
- guest: "{{ hostnames }}"
- vmware_guest_facts: yes
- register: vars
- - add_host: name="{{ hostnames }}" ansible_ssh_host="{{var.ansible_facts.hw_eth0.ipaddresses[0]}}" ansible_ssh_pass="{{guest_password}}" groups=dynamic_hosts
- - hosts: dynamic_hosts
- tasks:
- - name: move over public key
- command: authorized_key user=root key="{{ lookup('file', '~/.ssh/id_rsa') }}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement