# vim: ft=sls
name: {{ ctx.name }}
config:
  environment.LXD: "1"
  environment.LXD_DOMAIN: ".yandex.net"
  security.idmap.size: "524288"
  user.network_mode: link-local
  user.vendor-data: |
    ## template: jinja
    #cloud-config
    unverified_modules:
      - resolv_conf
    cloud_init_modules:
      - bootcmd
      - migrator
      - ubuntu-init-switch
      - seed_random
      - resolv_conf
      - set_hostname
      - update_hostname
      - update_etc_hosts
      - ssh
    cloud_final_modules:
      - scripts-per-instance
      - package-update-upgrade-install
      - [scripts-vendor, always]
      - scripts-per-once
      - scripts-per-boot
      - scripts-user
    users: []
    system_info:
      apt_get_command:
        - 'apt-get'
        - '-y'
        - '--allow-unauthenticated'
        - '-o'
        - 'Acquire::AllowInsecureRepositories=true'
        - '--quiet'
      package_mirrors:
        - arches: [default]
          failsafe:
            primary: http://mirror.yandex.ru/ubuntu
            security: http://mirror.yandex.ru/ubuntu
    timezone: Europe/Moscow
    manage_resolv_conf: true
    resolv_conf:
      nameservers: ['2a02:6b8:0:3400::5005', '2a02:6b8:0:3400::1023']
      searchdomains:
        - yandex.net
        - yandex.ru
      options:
        timeout: 1
        attempts: 1
    apt_sources:
      - source: |
          deb http://dist.yandex.ru/storage-common stable/all/
          deb http://system.dist.yandex.ru/system configs/all/
          deb http://common.dist.yandex.ru/common stable/all/
          deb http://common.dist.yandex.ru/common stable/amd64/
          deb http://noc.dist.yandex.ru/noc stable/all/
          deb http://noc.dist.yandex.ru/noc stable/$(ARCH)/
          deb http://noc.dist.yandex.ru/noc {{'{{v1.distro_release}}'}}/$(ARCH)/
          deb http://yandex-{{'{{v1.distro_release}}'}}.dist.yandex.ru/yandex-{{'{{v1.distro_release}}'}}/ stable/all/
          deb http://yandex-{{'{{v1.distro_release}}'}}.dist.yandex.ru/yandex-{{'{{v1.distro_release}}'}}/ stable/amd64/
        filename: yandex.list
    packages:
      - config-apt-allowunauth
      - yandex-archive-keyring
      - repo-noc-stable
      - repo-noc-{{'{{v1.distro_release}}'}}
      - config-monitoring-pkgver
      - config-noc-common
      - ifupdown
      - config-noc-salt-minion
    bootcmd:
      - test -e /var/cache/bootstrap_done || while true; do ip -6 addr show dev eth0|grep inet6|grep -qE 'global|dynamic' && break; sleep 1; done
      - test -e /var/cache/bootstrap_done || sed 's/--net/.net.yandex.net/g' /etc/hostname -i && hostname -F /etc/hostname
      - test -e /var/cache/bootstrap_done || while true; do curl -s -o /dev/null dist.yandex.ru && break ; sleep 1; done
      - test -e /var/cache/bootstrap_done || systemctl stop systemd-networkd systemd-networkd.socket
description: base noc profile
devices:
  {% if ctx.get('devices') %}
  {{ ctx.devices | yaml(False) | indent(2) }}
  {% endif %}
