From f3721fd104ed79de0b0a384d5dab0e0932cb68e5 Mon Sep 17 00:00:00 2001 From: Sean Molenaar Date: Fri, 7 Jul 2023 10:15:43 +0200 Subject: [PATCH] feat: add repo setup state --- docs/README.rst | 10 ++++++++++ influxdb/repo/absent.sls | 6 ++++++ influxdb/repo/debian/absent.sls | 5 +++++ influxdb/repo/debian/init.sls | 2 ++ influxdb/repo/debian/present.sls | 5 +++++ influxdb/repo/init.sls | 6 ++++++ influxdb/repo/redhat/absent.sls | 3 +++ influxdb/repo/redhat/init.sls | 2 ++ influxdb/repo/redhat/present.sls | 8 ++++++++ 9 files changed, 47 insertions(+) create mode 100644 influxdb/repo/absent.sls create mode 100644 influxdb/repo/debian/absent.sls create mode 100644 influxdb/repo/debian/init.sls create mode 100644 influxdb/repo/debian/present.sls create mode 100644 influxdb/repo/init.sls create mode 100644 influxdb/repo/redhat/absent.sls create mode 100644 influxdb/repo/redhat/init.sls create mode 100644 influxdb/repo/redhat/present.sls diff --git a/docs/README.rst b/docs/README.rst index 5a730d0..9127d6f 100644 --- a/docs/README.rst +++ b/docs/README.rst @@ -71,6 +71,16 @@ that minor version. You can set ``influxdb:no_conf_defaults`` in your pillar if you want to completely specify the configuration yourself, without falling back to defaults. +``influxdb.repo`` +^^^^^^^^^^^^^^^^^^^^ +Enable the official InfluxData package repository in order to always +benefit from the latest version. This state currently only works on Debian and RHEL. + +``influxdb.repo.absent`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Undo the effects of ``influxdb.repo``. + + Testing ------- diff --git a/influxdb/repo/absent.sls b/influxdb/repo/absent.sls new file mode 100644 index 0000000..f960e4a --- /dev/null +++ b/influxdb/repo/absent.sls @@ -0,0 +1,6 @@ +{% set name = { + 'RedHat': 'redhat', + 'Debian': 'debian', +}.get(grains.os_family) %} +include: + - .{{ name }}.absent \ No newline at end of file diff --git a/influxdb/repo/debian/absent.sls b/influxdb/repo/debian/absent.sls new file mode 100644 index 0000000..8bd948c --- /dev/null +++ b/influxdb/repo/debian/absent.sls @@ -0,0 +1,5 @@ +drop-influxdata-repo: + pkgrepo.absent: + - name: deb http://debian.saltstack.com/debian {{ grains['oscodename'] }} stable + - file: /etc/apt/sources.list.d/influxdata.list + - key_url: https://repos.influxdata.com/influxdb.key \ No newline at end of file diff --git a/influxdb/repo/debian/init.sls b/influxdb/repo/debian/init.sls new file mode 100644 index 0000000..008801d --- /dev/null +++ b/influxdb/repo/debian/init.sls @@ -0,0 +1,2 @@ +include: + - .present \ No newline at end of file diff --git a/influxdb/repo/debian/present.sls b/influxdb/repo/debian/present.sls new file mode 100644 index 0000000..21d11c7 --- /dev/null +++ b/influxdb/repo/debian/present.sls @@ -0,0 +1,5 @@ +influxdata-repo: + pkgrepo.managed: + - name: deb http://debian.saltstack.com/debian {{ grains['oscodename'] }} stable + - file: /etc/apt/sources.list.d/influxdata.list + - key_url: https://repos.influxdata.com/influxdb.key \ No newline at end of file diff --git a/influxdb/repo/init.sls b/influxdb/repo/init.sls new file mode 100644 index 0000000..1ec9bed --- /dev/null +++ b/influxdb/repo/init.sls @@ -0,0 +1,6 @@ +{% set name = { + 'RedHat': 'redhat', + 'Debian': 'debian', +}.get(grains.os_family) %} +include: + - .{{ name }} \ No newline at end of file diff --git a/influxdb/repo/redhat/absent.sls b/influxdb/repo/redhat/absent.sls new file mode 100644 index 0000000..48bc030 --- /dev/null +++ b/influxdb/repo/redhat/absent.sls @@ -0,0 +1,3 @@ +drop-influxdata-repo: + pkgrepo.absent: + - name: influxdata \ No newline at end of file diff --git a/influxdb/repo/redhat/init.sls b/influxdb/repo/redhat/init.sls new file mode 100644 index 0000000..008801d --- /dev/null +++ b/influxdb/repo/redhat/init.sls @@ -0,0 +1,2 @@ +include: + - .present \ No newline at end of file diff --git a/influxdb/repo/redhat/present.sls b/influxdb/repo/redhat/present.sls new file mode 100644 index 0000000..7e1b10d --- /dev/null +++ b/influxdb/repo/redhat/present.sls @@ -0,0 +1,8 @@ +influxdata-repo: + pkgrepo.managed: + - name: influxdata + - humanname: InfluxData Repository - Stable + - baseurl: https://repos.influxdata.com/stable/$basearch/main + - enabled: 1 + - gpgcheck: 1 + - gpgkey: https://repos.influxdata.com/influxdata-archive_compat.key \ No newline at end of file