Ansible: Template uzerinden yeni bir vm oluşturma

Ansible ile vmware tempalterden hizlica vm olusturmak icin asagidaki yml dosyasini kullanabilirsiniz. Buradaki kodların tutunu ansible AWX projenize ekleyerek bir pipe line oluşturmanız mümkündür. Boylece API ile diğer uygulamalarınıza entegre edebilirsiniz.

 

- name: Deploy VM from template
  hosts: localhost
  gather_facts: no
  vars:
    vcenter_hostname: your-vcenter-server
    vcenter_username: your-username
    vcenter_password: your-password
    template_name: your-template-name
    vm_name: your-vm-name
    datastore_name: your-datastore-name
    network_name: your-network-name
  tasks:
    - name: Clone VM from template
      vmware_guest:
        hostname: "{{ vcenter_hostname }}"
        username: "{{ vcenter_username }}"
        password: "{{ vcenter_password }}"
        validate_certs: no
        datacenter: your-datacenter-name
        folder: your-folder-name
        name: "{{ vm_name }}"
        template: "{{ template_name }}"
        datastore: "{{ datastore_name }}"
        networks:
          - name: "{{ network_name }}"
      delegate_to: localhost

Join the ConversationLeave a reply

Your email address will not be published. Required fields are marked *

Comment*

Name*

Website