XCP-ng
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Unable to configure Network IP inside the VM throgh API

    Scheduled Pinned Locked Moved Infrastructure as Code
    13 Posts 4 Posters 161 Views 5 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • olivierlambertO Offline
      olivierlambert Vates 🪐 Co-Founder CEO
      last edited by

      You are welcome. This is a community forum, so you have to wait for people getting there on their free time to assist. Hopefully, someone will come in the next days to assist 🙂

      A 1 Reply Last reply Reply Quote 0
      • AtaxyaNetworkA Offline
        AtaxyaNetwork Ambassador @amititre331
        last edited by

        @amititre331 Hi !

        Can you try the API request by hand (without ansible) to see if it works ?

        Also, do you have any errors when running ansible ?

        A 1 Reply Last reply Reply Quote 1
        • C Offline
          carloum70
          last edited by carloum70

          @amititre331
          If you want to configure ip settings using cloud-init you have to use the option network_config instead of cloud_config.

          Unbrand_CreateVmBody_{
          memory	[...]
          name_description	[...]
          name_label*	[...]
          clone	[...]
          gpuGroup	[...]
          vgpuType	[...]
          autoPoweron	[...]
          vifs	[...]
          copyHostBiosStrings	[...]
          template*	[...]
          affinity	[...]
          vdis	[...]
          install	{...}
          cloud_config	[...]
          network_config	string
          boot	[...]
          destroy_cloud_config_vdi	[...]
          }
          

          By the way, do not share your tokens on the internet 😉

          A 2 Replies Last reply Reply Quote 0
          • A Offline
            amititre331 @AtaxyaNetwork
            last edited by

            @AtaxyaNetwork I didnt get any error while creating the VM, VM Created succesfully but Network is not getting configured and by Hand when I run the API and the API run successfully. but still network not configured

            1 Reply Last reply Reply Quote 0
            • A Offline
              amititre331 @carloum70
              last edited by

              @carloum70 said in Unable to configure Network IP inside the VM throgh API:

              network_config

              Hi Thanks for your suggestion I will try with network_config Instead of cloud_config then will let you know what will be the response.

              1 Reply Last reply Reply Quote 0
              • A Offline
                amititre331 @olivierlambert
                last edited by

                @olivierlambert Hi Thanks for understanding and your response.

                1 Reply Last reply Reply Quote 0
                • A Offline
                  amititre331 @carloum70
                  last edited by

                  @carloum70 Hello Carloum Do you have tested sample for the same so I can get the reference.

                  1 Reply Last reply Reply Quote 0
                  • C Offline
                    carloum70
                    last edited by

                    I am using terraform to setup a VM but it's the same approach for cloud-init:
                    cloud_config

                    #cloud-config
                    preserve_hostname: false
                    hostname: ${hostname} 
                    create_hostname_file: true
                    users:
                      - name: ansible
                        groups:
                          - sudo
                        sudo:
                          - ALL=(ALL) NOPASSWD:ALL
                        shell: /bin/bash
                        ssh_authorized_keys:
                          - "ssh-ed25519 somekeyl"
                          - "ssh-ed25519 otherkey"
                    

                    network_config:

                    #cloud-config
                    network:
                      version: 1
                      config:
                        - type: physical
                          name: enX0
                          subnets:
                            - type: static
                              address: ${ip_address}
                              netmask: ${netmask}
                              gateway: ${gateway}
                              dns_nameservers:
                    %{ for dns_server in dns ~}
                                - ${dns_server}
                    %{ endfor ~}
                    

                    Maybe a silly question: Your template supports cloud-init ?

                    A 1 Reply Last reply Reply Quote 0
                    • A Offline
                      amititre331 @carloum70
                      last edited by

                      @carloum70 yes the OS Image i am using ubuntu and ubuntu by default support cloud init. and in playbook I write the code no where it fails when I run the playbook. that means the cloud init code is fine but there is some issue at os image side or template side

                      1 Reply Last reply Reply Quote 0
                      • C Offline
                        carloum70
                        last edited by

                        What is the output of the following command:

                        cloud-init schema --system
                        
                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post