# -*- coding: utf-8 -*- # vim: ft=yaml --- ### Set parameters based on PostgreSQL version supplied with particular distro {% import_yaml "postgres/repo.yaml" as repo %} {# Generate lookup dictionary map for OS and derivative distributions name: distro codename version: PostgreSQL release version codename: optional grain value if `name` does not match the one returned by `oscodename` grain #} {% macro debian_codename(name, version, codename=none) %} {% if repo.use_upstream_repo == true %} {% set version = repo.version %} {% set fromrepo = repo.fromrepo|default(name ~ '-pgdg', true) %} {% else %} {% set fromrepo = name %} {% endif %} {% set cluster_name = repo.cluster_name %} {% set conf_dir = '/etc/postgresql/{0}/{1}'.format(version, cluster_name) %} {% set data_dir = '/var/lib/postgresql/{0}/{1}'.format(version, cluster_name) %} {{ codename|default(name, true) }}: # PostgreSQL packages are mostly downloaded from `main` repo component conf_dir: {{ conf_dir }} data_dir: {{ data_dir }} fromrepo: {{ fromrepo }} pkg_repo: name: 'deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.gpg] http://apt.postgresql.org/pub/repos/apt {{ name }}-pgdg main' pkg: postgresql-{{ version }} pkg_client: postgresql-client-{{ version }} prepare_cluster: pgcommand: pg_createcluster {{ version }} {{ cluster_name }} -d user: root bake_image_run_cmd: pg_ctlcluster {{ version }} {{ cluster_name }} start {% endmacro %} {% macro fedora_codename(name, version, codename=none) %} {# use upstream version if configured #} {% if repo.use_upstream_repo == true %} {% set version = repo.version %} {% endif %} {{ codename|default(name, true) }}: # PostgreSQL packages are mostly downloaded from `main` repo component pkg_repo: baseurl: 'https://download.postgresql.org/pub/repos/yum/{{ version }}/fedora/fedora-$releasever-$basearch' {% endmacro %} ## Debian GNU/Linux (the second parameter refers to the postgresql package version, not the distro) # http://apt.postgresql.org/pub/repos/apt/dists/ # https://packages.debian.org/search?keywords=postgresql&searchon=names {{ debian_codename('jessie', '9.4') }} {{ debian_codename('stretch', '9.6') }} {{ debian_codename('buster', '11') }} {{ debian_codename('bullseye', '13') }} {{ debian_codename('bookworm', '15') }} # `oscodename` grain has long distro name # if `lsb-release` package not installed {{ debian_codename('jessie', '9.4', 'Debian GNU/Linux 8 (jessie)') }} {{ debian_codename('stretch', '9.6', 'Debian GNU/Linux 9 (stretch)') }} {{ debian_codename('buster', '11', 'Debian GNU/Linux 10 (buster)') }} {{ debian_codename('bullseye', '13', 'Debian GNU/Linux 11 (bullseye)') }} {{ debian_codename('bookworm', '15', 'Debian GNU/Linux 12 (bookworm)') }} ## Ubuntu # http://apt.postgresql.org/pub/repos/apt/dists/ # https://packages.ubuntu.com/search?keywords=postgresql&searchon=names {{ debian_codename('xenial', '9.5') }} {{ debian_codename('bionic', '10') }} {{ debian_codename('eoan', '11') }} {{ debian_codename('focal', '12') }} {{ debian_codename('jammy', '14') }} ## Fedora # https://download.postgresql.org/pub/repos/yum/13/fedora/ # https://apps.fedoraproject.org/packages/postgresql {{ fedora_codename('Fedora-34', '13') }} {{ fedora_codename('Fedora-33', '13') }} ## Amazon Amazon Linux 2: pkgs_deps: - libicu - systemd-sysv pkg_repo: baseurl: 'https://download.postgresql.org/pub/repos/yum/{{ repo.version }}/redhat/rhel-7-$basearch' # vim: ft=sls