---
# vars file for bootstrap

# A string containing all packages required to be installed using the `raw`
# module, separated by a space.
bootstrap_apk_packages: python sudo
bootstrap_apt_packages: python sudo
bootstrap_dnf_packages: python sudo
bootstrap_emerge_packages: python sudo gentoolkit
bootstrap_pacman_packages: python sudo
bootstrap_pkg_add_packages: python-3* sudo--
bootstrap_pkg_packages: python sudo
bootstrap_yum_packages: python2 sudo
bootstrap_zypper_packages: python python-xml sudo

bootstrap_alpine_community_repo: "http://dl-cdn.alpinelinux.org/alpine/v{{ ansible_distribution_version.split('.')[0] }}.{{ ansible_distribution_version.split('.')[1] }}/community"

# Some distributions do not have the fact `ansible_distribution_major_version`,
# as a workaround it's determined here, saved to another variable and used
# later.

bootstrap_ansible_distribution_major_version: ansible_distibution_major_version | default('none')

# A dictionary based on Ansible facts `ansible_distribution` and
# `ansible_distribution_major_version` containing a list of packages.
# This list is very similar to the `boostrap_{{ ansible_pkg_mgr }}_package`
# list. This dictionary is used to be able to update these packages.
_bootstrap_packages:
  default:
    - python
    - sudo
  Alpine:
    - python
    - sudo
    - shadow
  Archlinux:
    - iproute2
    - python
    - sudo
  CentOS:
    - iproute
    - python2
    - sudo
  Fedora-30:
    - iproute
    - python3
    - python3-dnf
    - sudo
  Fedora:
    - iproute
    - python2
    - python2-dnf
    - sudo
  FreeBSD:
    - python
    - sudo
  Gentoo:
    - python
    - sudo
    - gentoolkit
  OpenBSD:
    - python%3
    - sudo--
  openSUSE Leap:
    - iproute2
    - python
    - python-xml
    - sudo
  openSUSE Tumbleweed:
    - iproute2
    - python
    - python-xml
    - sudo
  Ubuntu:
    - iproute2
    - python
    - sudo

bootstrap_packages: "{{ _bootstrap_packages[ansible_distribution ~ '-' ~ bootstrap_ansible_distribution_major_version] | default(_bootstrap_packages[ansible_distribution] | default(_bootstrap_packages['default'])) }}"

# A dictionary based on Ansible facts `ansible_distribution` and
# `ansible_distribution_major_version` containing a list of packages. The
# packages in these lists support modules marked as `stable`.
_bootstrap_stable_packages:
  default:
    - python
  Alpine:
    - acl
    - ca-certificates
    - py-simplejson
  CentOS-6:
    - acl
    - python-simplejson
    - yum-plugin-ovl
  CentOS-7:
    - acl
    - yum-plugin-ovl
  Debian:
    - acl
    - ca-certificates
    - python-apt
    - python-simplejson
  Fedora:
    - acl
    - polkit
    - python-devel
    - python-simplejson
  OpenBSD:
    - py-simplejson--
  openSUSE Leap:
    - acl
    - ca-certificates
  openSUSE Tumbleweed:
    - acl
    - ca-certificates
  Ubuntu:
    - acl
    - ca-certificates
    - python-apt
    - python-simplejson

bootstrap_stable_packages: "{{ _bootstrap_stable_packages[ansible_distribution ~ '-' ~ bootstrap_ansible_distribution_major_version] | default(_bootstrap_stable_packages[ansible_distribution] | default(_bootstrap_stable_packages['default'])) }}"

# A dictionary based on Ansible facts `ansible_distribution` and
# `ansible_distribution_major_version` containing a list of packages. The
# packages in these lists support modules marked as `preview`.
_bootstrap_preview_packages:
  default:
    - lvm2
    - tar
    - unzip
    - gzip
  CentOS:
    - lvm2
    - tar
    - unzip
    - gzip
    - policycoreutils-python
  Debian:
    - apt-transport-https
    - gzip
    - lvm2
    - tar
    - unzip
  Fedora:
    - lvm2
    - tar
    - unzip
    - gzip
    - policycoreutils-python
  FreeBSD:
    - unzip
    - gzip
  Gentoo:
    - gzip
    - tar
    - unzip
  OpenBSD:
    - unzip--
  Ubuntu:
    - apt-transport-https
    - gzip
    - lvm2
    - tar
    - unzip

bootstrap_preview_packages: "{{ _bootstrap_preview_packages[ansible_distribution] | default(_bootstrap_preview_packages['default']) }}"

bootstrap_emerge_command: equery l {{ bootstrap_emerge_packages }} || (emaint -a sync ; emerge -qkv {{ bootstrap_emerge_packages }} ; echo "changed")
