1 changed files with 34 additions and 0 deletions
@ -0,0 +1,34 @@ |
|||
- name: Add host to VM inventory |
|||
hosts: localhost |
|||
gather_facts: false |
|||
vars: |
|||
inventory_name: "{{ inventory_name }}" |
|||
site_name: "{{ hypervisor | replace('-Baremetal', '') | replace('-', '_') | lower }}" |
|||
|
|||
tasks: |
|||
- name: Add inventory |
|||
ansible.controller.inventory: |
|||
validate_certs: false |
|||
name: "{{ inventory_name }}" |
|||
description: "VMs" |
|||
organization: "Default" |
|||
state: present |
|||
|
|||
- name: Add host to inventory |
|||
ansible.controller.host: |
|||
name: "{{ vm_name }}" |
|||
description: "" |
|||
inventory: "{{ inventory_name }}" |
|||
state: present |
|||
variables: |
|||
ansible_host: "{{ vm_ip }}" |
|||
|
|||
- name: Add group |
|||
ansible.controller.group: |
|||
name: "{{ site_name }}_virtualmachine" |
|||
description: "Local Host Group" |
|||
inventory: "{{ inventory_name }}" |
|||
hosts: |
|||
- "{{ vm_name }}" |
|||
preserve_existing_hosts: true |
|||
preserve_existing_children: true |
|||
Loading…
Reference in new issue