reworked vsphere-cloud-config template

This commit is contained in:
Julian Hübenthal 2018-01-31 16:51:23 +01:00
parent 9cdd2214f9
commit 7f79210ed1
2 changed files with 21 additions and 35 deletions

View file

@ -34,9 +34,9 @@ Then, in the same file, you need to declare your vCenter credential following th
| vsphere_datastore | TRUE | string | | | Datastore name to use | | vsphere_datastore | TRUE | string | | | Datastore name to use |
| vsphere_working_dir | TRUE | string | | | Working directory from the view "VMs and template" in the vCenter where VM are placed | | vsphere_working_dir | TRUE | string | | | Working directory from the view "VMs and template" in the vCenter where VM are placed |
| vsphere_scsi_controller_type | TRUE | string | buslogic, pvscsi, parallel | pvscsi | SCSI controller name. Commonly "pvscsi". | | vsphere_scsi_controller_type | TRUE | string | buslogic, pvscsi, parallel | pvscsi | SCSI controller name. Commonly "pvscsi". |
| vsphere_vm_uuid | FALSE | string | | | VM Instance UUID of virtual machine that host K8s master. Can be retrieved from instanceUuid property in VmConfigInfo, or as vc.uuid in VMX file or in `/sys/class/dmi/id/product_serial` (only optional for Kubernetes <= 1.9.2) | | vsphere_vm_uuid | FALSE | string | | | VM Instance UUID of virtual machine that host K8s master. Can be retrieved from instanceUuid property in VmConfigInfo, or as vc.uuid in VMX file or in `/sys/class/dmi/id/product_serial` (Optional, only used for Kubernetes <= 1.9.2) |
| vsphere_public_network | FALSE | string | | Blank | Name of the network the VMs are joined to | | vsphere_public_network | FALSE | string | | Blank | Name of the network the VMs are joined to |
| vsphere_resource_pool | FALSE | string | | Blank | Name of the Resource pool where the VMs are located (optional for Kubernetes >= 1.9.2) | | vsphere_resource_pool | FALSE | string | | Blank | Name of the Resource pool where the VMs are located (Optional, only used for Kubernetes >= 1.9.2) |
Example configuration Example configuration

View file

@ -1,23 +1,35 @@
{%- if kube_version | version_compare('v1.9.2', '>=') -%}
[Global] [Global]
datacenters = "{{ vsphere_datacenter }}" user = "{{ vsphere_user }}"
insecure-flag = {{ vsphere_insecure }}
password = "{{ vsphere_password }}" password = "{{ vsphere_password }}"
port = {{ vsphere_vcenter_port }} port = {{ vsphere_vcenter_port }}
user = "{{ vsphere_user }}" insecure-flag = {{ vsphere_insecure }}
{% if kube_version | version_compare('v1.9.2', '>=') %}
datacenters = "{{ vsphere_datacenter }}"
{% else %}
datastore = "{{ vsphere_datastore }}"
datacenter = "{{ vsphere_datacenter }}"
working-dir = "{{ vsphere_working_dir }}"
server = "{{ vsphere_vcenter_ip }}"
{% if vsphere_vm_uuid is defined and vsphere_vm_uuid != "" %}
vm-uuid = "{{ vsphere_vm_uuid }}"
{% endif %}
{% endif %}
{% if kube_version | version_compare('v1.9.2', '>=') %}
[VirtualCenter "{{ vsphere_vcenter_ip }}"] [VirtualCenter "{{ vsphere_vcenter_ip }}"]
[Workspace] [Workspace]
server = "{{ vsphere_vcenter_ip }}" server = "{{ vsphere_vcenter_ip }}"
datacenter = "{{ vsphere_datacenter }}" datacenter = "{{ vsphere_datacenter }}"
folder = "{{ vsphere_working_dir }}" folder = "{{ vsphere_working_dir }}"
default-datastore = "{{ vsphere_datastore }}" default-datastore = "{{ vsphere_datastore }}"
{% if vsphere_resource_pool is defined and vsphere_resource_pool != "" %} {% if vsphere_resource_pool is defined and vsphere_resource_pool != "" %}
resourcepool-path = "{{ vsphere_resource_pool }}" resourcepool-path = "{{ vsphere_resource_pool }}"
{% endif %} {% endif %}
{% endif %}
[Disk] [Disk]
@ -26,30 +38,4 @@ scsicontrollertype = {{ vsphere_scsi_controller_type }}
{% if vsphere_public_network is defined and vsphere_public_network != "" %} {% if vsphere_public_network is defined and vsphere_public_network != "" %}
[Network] [Network]
public-network = {{ vsphere_public_network }} public-network = {{ vsphere_public_network }}
{% endif %} {% endif %}
{%- else -%}
[Global]
datacenter = "{{ vsphere_datacenter }}"
datastore = "{{ vsphere_datastore }}"
insecure-flag = {{ vsphere_insecure }}
password = "{{ vsphere_password }}"
port = {{ vsphere_vcenter_port }}
server = "{{ vsphere_vcenter_ip }}"
user = "{{ vsphere_user }}"
working-dir = "{{ vsphere_working_dir }}"
{% if vsphere_vm_uuid is defined %}
vm-uuid = {{ vsphere_vm_uuid }}
{% endif %}
[Disk]
scsicontrollertype = {{ vsphere_scsi_controller_type }}
{% if vsphere_public_network is defined and vsphere_public_network != "" %}
[Network]
public-network = {{ vsphere_public_network }}
{% endif %}
{%- endif -%}