Results 1 to 6 of 6

Thread: invalid yaml: inconsistent indentation

  1. #1
    Join Date
    Jan 2013
    Beans
    5

    Arrow invalid yaml: inconsistent indentation

    Hello,

    I am having some issues with networking in Ubuntu LTS Server v20.04
    I changed the Yaml into the following:

    addresses: [172.16.60.10/8]
    gateway4:172.16.11.1
    nameservers:
    addresses:[172.16.10.10,172.16.10.11]
    version 2

    but, when applying, sudo netplan apply, i get the following error:

    invalid yaml:inconsistent indentation: nameservers:

    anyone who knows what i am doing wrong?
    also. why doenst the gateway's ip need brackets?

    many thanks for any help.

  2. #2
    Join Date
    Jul 2008
    Location
    The Left Coast of the USA
    Beans
    Hidden!
    Distro
    Kubuntu

    Re: invalid yaml: inconsistent indentation

    Hello!

    If what you have posted is exactly as it appears in your file, then you do have inconsistent indentation. Indentations in YAML are very specific.

    Would you please copy your text without edits directly from your file and post it between code tags?
    Please read The Forum Rules and The Forum Posting Guidelines

    A thing discovered and kept to oneself must be discovered time and again by others. A thing discovered and shared with others need be discovered only the once.
    This universe is crazy. I'm going back to my own.

  3. #3
    Join Date
    Jan 2013
    Beans
    5

    Re: invalid yaml: inconsistent indentation

    Quote Originally Posted by QIII View Post
    Hello!

    If what you have posted is exactly as it appears in your file, then you do have inconsistent indentation. Indentations in YAML are very specific.

    Would you please copy your text without edits directly from your file and post it between code tags?
    many thanks for the fast reply. I am not sure how to copy/paste from VI, so i attached a printscreen.
    Attached Images Attached Images

  4. #4
    Join Date
    Nov 2007
    Location
    London, England
    Beans
    7,006
    Distro
    Xubuntu 20.04 Focal Fossa

    Re: invalid yaml: inconsistent indentation

    See https://netplan.io/examples.
    version needs indenting to the same level as ethernets because they are both properties of network.
    addresses and nameservers need indenting to the same level to the right of ens33 because they are both properties of ens33.
    Beware of mixing spaces and tabs. Use one or the other throughout. Below uses spaces.
    Code:
    network:
      ethernets:
        ens33:
          addresses: [172.16.60.10/8]
          gateway4: 172.16.11.1
          nameservers:
            addresses: [172.16.10.10, 172.16.10.11]
      version: 2

  5. #5
    Join Date
    Aug 2005
    Location
    South Carolina, USA
    Beans
    25,293
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: invalid yaml: inconsistent indentation

    Beware of mixing spaces and tabs.
    I believe that netplan wants spaces only and not tabs.
    "Oh, Ubuntu, you are my favorite Linux-based operating system" --Dr. Sheldon Cooper, Ph.D., Sc.D.

  6. #6
    Join Date
    Nov 2007
    Location
    London, England
    Beans
    7,006
    Distro
    Xubuntu 20.04 Focal Fossa

    Re: invalid yaml: inconsistent indentation

    Quote Originally Posted by chili555 View Post
    I believe that netplan wants spaces only and not tabs.
    Ooh yes. You're right. Good for yaml.
    I've been caught by python occasionally where files are mixed spaces and tab indentation.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •