#cloud-config

stages:
  initramfs.before:
    # For debian based distributions, /etc/hosts is present but empty. This is because the file
    # is populated when running the configuration. For those cases we insert a record so it can be
    # manipulated later on by yip's hostname plugin
    # Read more: https://wiki.debian.org/ConfigPackages
    - name: "Make sure hosts file is present and includes a record for 127.0.0.1"
      if: |
        ! [[ -f /etc/hosts ]] || ! [[ $(grep '127.0.0.1' /etc/hosts) ]]
      commands:
        - echo '127.0.0.1\tlocalhost' >> /etc/hosts
