diff --git a/AUTHORS.md b/AUTHORS.md index 7526d62..698b8b0 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -4,9 +4,9 @@ This list is sorted by the number of commits per contributor in _descending_ ord Avatar|Contributor|Contributions :-:|---|:-: -@noelmcloughlin|[@noelmcloughlin](https://github.com/noelmcloughlin)|2 +@noelmcloughlin|[@noelmcloughlin](https://github.com/noelmcloughlin)|4 @alxwr|[@alxwr](https://github.com/alxwr)|1 --- -Auto-generated by a [forked version](https://github.com/myii/maintainer) of [gaocegege/maintainer](https://github.com/gaocegege/maintainer) on 2019-06-05. +Auto-generated by a [forked version](https://github.com/myii/maintainer) of [gaocegege/maintainer](https://github.com/gaocegege/maintainer) on 2019-06-23. diff --git a/CHANGELOG.md b/CHANGELOG.md index c032167..753612e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,25 @@ # Changelog +# [2.0.0](https://github.com/saltstack-formulas/grafana-formula/compare/v1.1.1...v2.0.0) (2019-06-23) + + +### Features + +* **repository:** support rpm-based linux distros ([ded3157](https://github.com/saltstack-formulas/grafana-formula/commit/ded3157)) + + +### BREAKING CHANGES + +* **repository:** the parameter `pkg` is now a dictionary. References + to `grafana.pkg` should be changed to `grafana.pkg.name`. + +## [1.1.1](https://github.com/saltstack-formulas/grafana-formula/compare/v1.1.0...v1.1.1) (2019-06-23) + + +### Bug Fixes + +* **macos:** fix service name on macos ([f28d08b](https://github.com/saltstack-formulas/grafana-formula/commit/f28d08b)) + # [1.1.0](https://github.com/saltstack-formulas/grafana-formula/compare/v1.0.0...v1.1.0) (2019-06-05) diff --git a/FORMULA b/FORMULA index 300f6cd..dde8829 100644 --- a/FORMULA +++ b/FORMULA @@ -1,7 +1,7 @@ name: grafana os: FreeBSD os_family: FreeBSD -version: 1.1.0 +version: 2.0.0 release: 1 minimum_version: 2016.11 summary: Grafana formula diff --git a/docs/AUTHORS.rst b/docs/AUTHORS.rst index 6140510..cd36d7f 100644 --- a/docs/AUTHORS.rst +++ b/docs/AUTHORS.rst @@ -15,7 +15,7 @@ This list is sorted by the number of commits per contributor in *descending* ord - Contributions * - :raw-html-m2r:`@noelmcloughlin` - `@noelmcloughlin `_ - - 2 + - 4 * - :raw-html-m2r:`@alxwr` - `@alxwr `_ - 1 @@ -23,4 +23,4 @@ This list is sorted by the number of commits per contributor in *descending* ord ---- -Auto-generated by a `forked version `_ of `gaocegege/maintainer `_ on 2019-06-05. +Auto-generated by a `forked version `_ of `gaocegege/maintainer `_ on 2019-06-23. diff --git a/docs/CHANGELOG.rst b/docs/CHANGELOG.rst index 5ebe673..9cd7354 100644 --- a/docs/CHANGELOG.rst +++ b/docs/CHANGELOG.rst @@ -2,6 +2,31 @@ Changelog ========= +`2.0.0 `_ (2019-06-23) +--------------------------------------------------------------------------------------------------------- + +Features +^^^^^^^^ + + +* **repository:** support rpm-based linux distros (\ `ded3157 `_\ ) + +BREAKING CHANGES +^^^^^^^^^^^^^^^^ + + +* **repository:** the parameter ``pkg`` is now a dictionary. References + to ``grafana.pkg`` should be changed to ``grafana.pkg.name``. + +`1.1.1 `_ (2019-06-23) +--------------------------------------------------------------------------------------------------------- + +Bug Fixes +^^^^^^^^^ + + +* **macos:** fix service name on macos (\ `f28d08b `_\ ) + `1.1.0 `_ (2019-06-05) --------------------------------------------------------------------------------------------------------- diff --git a/grafana/defaults.yaml b/grafana/defaults.yaml index ff5a27c..871c789 100644 --- a/grafana/defaults.yaml +++ b/grafana/defaults.yaml @@ -4,10 +4,19 @@ grafana: dir: /opt/grafana version: '6.2.2' + pkg: name: grafana binary: grafana use_upstream_archive: False + use_upstream_repo: False + repo: + humanname: grafana + name: grafana + comments: + - installed by salt + enabled: 1 + gpgcheck: 1 archive: name: /opt uri: https://dl.grafana.com/oss/release @@ -18,7 +27,7 @@ grafana: archive_format: tar enforce_toplevel: False # needed for grafana options: '--strip-components=1' # needed for grafana - pkgrepo: {} + kernel: {{ grains.kernel | lower }} rootgroup: root group: grafana diff --git a/grafana/osfamilymap.yaml b/grafana/osfamilymap.yaml index d3d9fc7..3c40a18 100644 --- a/grafana/osfamilymap.yaml +++ b/grafana/osfamilymap.yaml @@ -11,19 +11,42 @@ # osfamilymap: {} --- {%- if grains.os == 'MacOS' %} + {% set macos_user = salt['cmd.run']("stat -f '%Su' /dev/console") %} {% set macos_group = salt['cmd.run']("stat -f '%Sg' /dev/console") %} {%- endif %} Debian: - pkgrepo: - humanname: grafana_official - name: deb https://packages.grafana.com/oss/deb stable main - file: /etc/apt/sources.list.d/grafana.list - key_url: https://packages.grafana.com/gpg.key + pkg: + use_upstream_repo: True + repo: + humanname: grafana_official + name: deb https://packages.grafana.com/oss/deb stable main + file: /etc/apt/sources.list.d/grafana.list + key_url: https://packages.grafana.com/gpg.key -RedHat: {} +RedHat: + pkg: + use_upstream_repo: True + repo: + baseurl: https://packages.grafana.com/oss/rpm-beta + repo_gpgcheck: 1 + gpgkey: https://packages.grafana.com/gpg.key + sslverify: 1 + sslcacert: /etc/pki/tls/certs/ca-bundle.crt + comments: + - instructions from https://grafana.com/docs/installation/rpm/ -Suse: {} +Suse: + pkg: + use_upstream_repo: True + repo: + baseurl: https://packages.grafana.com/oss/rpm-beta + repo_gpgcheck: 1 + gpgkey: https://packages.grafana.com/gpg.key + sslverify: 1 + sslcacert: /etc/pki/tls/certs/ca-bundle.crt + comments: + - instructions from https://grafana.com/docs/installation/rpm/ Gentoo: {} @@ -32,7 +55,8 @@ Arch: {} Alpine: {} FreeBSD: - pkg: grafana5 + pkg: + name: grafana5 config_file: /usr/local/etc/grafana.conf config: paths: @@ -58,8 +82,10 @@ Windows: archive_format: zip MacOS: + rootuser: {{ macos_user | d('') }} rootgroup: {{ macos_group | d('') }} group: {{ macos_group | d('') }} service: + name: grafana rootgroup: {{ macos_group | d('') }} group: {{ macos_group | d('') }} diff --git a/grafana/package/clean.sls b/grafana/package/clean.sls index 4aad7a1..8570ed6 100644 --- a/grafana/package/clean.sls +++ b/grafana/package/clean.sls @@ -9,10 +9,13 @@ include: - {{ sls_config_clean }} + {%- if grafana.pkg.use_upstream_repo %} +include: + - .repo.clean + {%- endif %} + grafana-package-clean-pkg-removed: pkg.removed: - name: {{ grafana.pkg.name }} - {%- if 'config' in grafana and grafana.config %} - - require: - - sls: {{ sls_config_clean }} - {%- endif %} + # require: + # sls: {{ sls_config_clean }} diff --git a/grafana/package/install.sls b/grafana/package/install.sls index 9a7f10e..a4a9d4b 100644 --- a/grafana/package/install.sls +++ b/grafana/package/install.sls @@ -4,17 +4,11 @@ {#- Get the `tplroot` from `tpldir` #} {%- set tplroot = tpldir.split('/')[0] %} {%- from tplroot ~ "/map.jinja" import grafana with context %} - -{% if grafana.pkgrepo %} -grafana-package-install-pkgrepo-managed: - pkgrepo.managed: - - humanname: {{ grafana.pkgrepo.humanname }} - - name: {{ grafana.pkgrepo.name }} - - file: {{ grafana.pkgrepo.file}} - - key_url: {{ grafana.pkgrepo.key_url}} - - require_in: - - pkg: grafana-package-install-pkg-installed -{% endif %} + + {%- if grafana.pkg.use_upstream_repo %} +include: + - .repo + {%- endif %} grafana-package-install-pkg-installed: pkg.installed: diff --git a/grafana/package/repo/clean.sls b/grafana/package/repo/clean.sls new file mode 100644 index 0000000..d84ac4e --- /dev/null +++ b/grafana/package/repo/clean.sls @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls + +{#- Get the `tplroot` from `tpldir` #} +{%- set tplroot = tpldir.split('/')[0] %} +{%- from tplroot ~ "/map.jinja" import grafana with context %} + +grafana-package-repo-clean-pkgrepo-absent: + pkgrepo.absent: + - name: {{ grafana.pkg.repo.name }} diff --git a/grafana/package/repo/init.sls b/grafana/package/repo/init.sls new file mode 100644 index 0000000..d3e5518 --- /dev/null +++ b/grafana/package/repo/init.sls @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls + +include: + - .install diff --git a/grafana/package/repo/install.sls b/grafana/package/repo/install.sls new file mode 100644 index 0000000..d53fdbb --- /dev/null +++ b/grafana/package/repo/install.sls @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls + +{#- Get the `tplroot` from `tpldir` #} +{%- set tplroot = tpldir.split('/')[0] %} +{%- from tplroot ~ "/map.jinja" import grafana with context %} + + {%- if grafana.pkg.use_upstream_repo %} + {%- from tplroot ~ "/jinja/macros.jinja" import format_kwargs with context %} + +grafana-package-repo-install-pkgrepo-managed: + pkgrepo.managed: + {{- format_kwargs(grafana.pkg.repo) }} + + {%- endif %} diff --git a/pillar.example b/pillar.example index c6f583b..8077e88 100644 --- a/pillar.example +++ b/pillar.example @@ -7,20 +7,25 @@ grafana: use_upstream_archive: False archive: uri: https://dl.grafana.com/oss/release + repo: + humanname: grafana_official + name: deb https://packages.grafana.com/oss/deb stable main + file: /etc/apt/sources.list.d/grafana.list + key_url: https://packages.grafana.com/gpg.key - pkgrepo: - humanname: grafana_official - name: deb https://packages.grafana.com/oss/deb stable main - file: /etc/apt/sources.list.d/grafana.list - key_url: https://packages.grafana.com/gpg.key config_file: /etc/grafana/grafana.ini - environ_file: /etc/default.grafana.sh service: name: grafana-server - linux: - #'Alternatives system' priority: zero disables (default) - altpriority: 1000 + # Pillar-based config + # See also https://grafana.com/docs/installation/configuration/ + config: + default: + instance_name: ${HOSTNAME} + security: + admin_user: admin + auth.google: + client_secret: 0ldS3cretKey tofs: # The files_switch key serves as a selector for alternative @@ -45,14 +50,6 @@ grafana: # - 'example_alt.tmpl' # - 'example_alt.tmpl.jinja' - # Pillar-based config - # See also https://grafana.com/docs/installation/configuration/ - environ: - - 'export PATH=${PATH}:/opt/grafana-6.2.2.darwin-amd64' - config: - default: - instance_name: ${HOSTNAME} - security: - admin_user: admin - auth.google: - client_secret: 0ldS3cretKey + linux: + #'Alternatives system' priority: zero disables (default) + altpriority: 1000