├── .ansible-lint ├── .circleci └── config.yml ├── .github ├── ISSUE_TEMPLATE │ ├── bug.md │ ├── feature.md │ └── support.md ├── labeler.yml ├── labels.yml ├── lock.yml ├── settings.yml ├── stale.yml └── workflows │ ├── labeler.yml │ └── labels.yml ├── .gitignore ├── .mergify.yml ├── .yamllint ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── TROUBLESHOOTING.md ├── defaults └── main.yml ├── handlers └── main.yml ├── meta └── main.yml ├── molecule ├── alternative │ ├── molecule.yml │ ├── playbook.yml │ ├── prepare.yml │ └── tests │ │ └── test_alternative.py └── default │ ├── molecule.yml │ ├── playbook.yml │ ├── prepare.yml │ └── tests │ └── test_default.py ├── tasks ├── configure.yml ├── install.yml ├── main.yml └── preflight.yml ├── templates └── pushgateway.service.j2 ├── test-requirements.txt └── vars ├── debian.yml ├── main.yml ├── redhat-7.yml └── redhat.yml /.ansible-lint: -------------------------------------------------------------------------------- 1 | --- 2 | skip_list: 3 | - '204' 4 | - '208' 5 | -------------------------------------------------------------------------------- /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | --- 2 | version: 2.1 3 | 4 | executors: 5 | python: 6 | docker: 7 | - image: cimg/python:3.9 8 | publisher: 9 | docker: 10 | - image: quay.io/cloudalchemy/publisher:latest 11 | 12 | jobs: 13 | lint: 14 | executor: python 15 | steps: 16 | - checkout 17 | - run: pip install ansible ansible-lint yamllint flake8 18 | - run: mkdir -p .cache/roles && ln -s ../.. .cache/roles/${CIRCLE_PROJECT_REPONAME} 19 | - run: ansible-lint 20 | - run: yamllint . 21 | - run: flake8 22 | 23 | test: 24 | executor: python 25 | parameters: 26 | ansible: 27 | type: string 28 | steps: 29 | - checkout 30 | - setup_remote_docker 31 | - run: ln -s ~/project ~/${CIRCLE_PROJECT_REPONAME} 32 | - run: pip install "ansible~=<>.0" 33 | - run: pip install -r test-requirements.txt 34 | - run: molecule test -s default --destroy always 35 | - run: | 36 | if [[ -d 'molecule/alternative' ]]; then 37 | molecule test -s alternative --destroy always 38 | else 39 | echo 'No alternative test' 40 | fi 41 | - run: | 42 | if [[ -z "${CIRCLE_PULL_REQUEST}" ]] && [[ -d 'molecule/latest' ]]; then 43 | molecule test -s latest --destroy always 44 | else 45 | echo 'Not running latest on PR' 46 | fi 47 | release: 48 | executor: publisher 49 | steps: 50 | - checkout 51 | - run: | 52 | PROJECT_USERNAME="${CIRCLE_PROJECT_USERNAME}" \ 53 | PROJECT_REPONAME="${CIRCLE_PROJECT_REPONAME}" \ 54 | create_release 55 | 56 | galaxy: 57 | executor: python 58 | steps: 59 | - checkout 60 | - run: pip install ansible 61 | - run: ansible-galaxy role import --token "${GALAXY_TOKEN}" "${CIRCLE_PROJECT_USERNAME}" "${CIRCLE_PROJECT_REPONAME}" 62 | 63 | workflows: 64 | version: 2 65 | molecule: 66 | jobs: 67 | - lint: 68 | filters: 69 | tags: 70 | only: /.*/ 71 | - test: 72 | matrix: 73 | parameters: 74 | ansible: 75 | - "2.9" 76 | - "2.10" 77 | filters: 78 | tags: 79 | only: /.*/ 80 | - release: 81 | context: release 82 | requires: 83 | - lint 84 | - test 85 | filters: 86 | branches: 87 | only: master 88 | tags: 89 | ignore: /.*/ 90 | - galaxy: 91 | context: galaxy 92 | requires: 93 | - lint 94 | - test 95 | - release 96 | filters: 97 | branches: 98 | only: master 99 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug 3 | about: Report a bug related to ansible role 4 | labels: bug 5 | --- 6 | 7 | **What happened?** 8 | 9 | **Did you expect to see some different?** 10 | 11 | **How to reproduce it (as minimally and precisely as possible)**: 12 | 13 | **Environment** 14 | 15 | * Role version: 16 | 17 | `Insert release version/galaxy tag or Git SHA here` 18 | 19 | * Ansible version information: 20 | 21 | `ansible --version` 22 | 23 | 24 | * Variables: 25 | 26 | ``` 27 | insert role variables relevant to the issue 28 | ``` 29 | 30 | * Ansible playbook execution Logs: 31 | 32 | ``` 33 | insert Ansible logs relevant to the issue here 34 | ``` 35 | 36 | **Anything else we need to know?**: 37 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature 3 | about: If you want to propose a new feature or enhancement 4 | labels: enhancement 5 | --- 6 | 7 | **What is missing?** 8 | 9 | **Why do we need it?** 10 | 11 | **Environment** 12 | 13 | * Role version: 14 | 15 | `Insert release version/galaxy tag or Git SHA here` 16 | 17 | * Ansible version information: 18 | 19 | `ansible --version` 20 | 21 | 22 | **Anything else we need to know?**: 23 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/support.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Support 3 | about: If you have questions about this ansible role 4 | labels: question 5 | --- 6 | 7 | **What did you do?** 8 | 9 | **Did you expect to see some different?** 10 | 11 | **Environment** 12 | 13 | * Role version: 14 | 15 | `Insert release version/galaxy tag or Git SHA here` 16 | 17 | * Ansible version information: 18 | 19 | `ansible --version` 20 | 21 | 22 | * Variables: 23 | 24 | ``` 25 | insert role variables relevant to the issue 26 | ``` 27 | 28 | * Ansible playbook execution Logs: 29 | 30 | ``` 31 | insert Ansible logs relevant to the issue here 32 | ``` 33 | 34 | **Anything else we need to know?**: 35 | -------------------------------------------------------------------------------- /.github/labeler.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # configuration spec at https://github.com/actions/labeler/blob/master/README.md 3 | area/docs: 4 | - meta/* 5 | - CHANGELOG.md 6 | - CONTRIBUTING.md 7 | - TROUBLESHOOTING.md 8 | - LICENSE 9 | - README.md 10 | area/tests: 11 | - molecule/* 12 | - molecule/**/* 13 | - .ansible-lint 14 | - .yamllint 15 | - test-requirements.txt 16 | area/automation: 17 | - .circleci/* 18 | - .github/* 19 | - .github/**/* 20 | - .mergify.yml 21 | area/vars: 22 | - defaults/* 23 | - vars/* 24 | - vars/**/* 25 | area/tasks: 26 | - handlers/* 27 | - tasks/* 28 | - tasks/**/* 29 | area/jinja: 30 | - templates/* 31 | - templates/**/* 32 | -------------------------------------------------------------------------------- /.github/labels.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Default GitHub labels 3 | - color: d73a4a 4 | name: bug 5 | description: Something isn't working 6 | - color: cfd3d7 7 | name: duplicate 8 | description: This issue or pull request already exists 9 | - color: a2eeef 10 | name: enhancement 11 | description: New feature or request 12 | - color: 7057ff 13 | name: good first issue 14 | description: Good for newcomers 15 | - color: 008672 16 | name: help wanted 17 | description: Extra attention is needed 18 | - color: e4e669 19 | name: invalid 20 | description: This doesn't seem right 21 | - color: d876e3 22 | name: question 23 | description: Further information is requested 24 | - color: ffffff 25 | name: wontfix 26 | description: This will not be worked on 27 | 28 | # Labels specific to cloudalchemy 29 | - color: 0366d6 30 | name: area/docs 31 | description: Improvements or additions to documentation 32 | - color: 0366d6 33 | name: area/tests 34 | description: Everything related to molecule tests and linters 35 | - color: 0366d6 36 | name: area/automation 37 | description: Bots, bots everywhere 38 | - color: 0366d6 39 | name: area/vars 40 | description: Ansible variables used in role 41 | - color: 0366d6 42 | name: area/tasks 43 | description: Logic behind ansible role 44 | - color: 0366d6 45 | name: area/jinja 46 | description: Templates 47 | -------------------------------------------------------------------------------- /.github/lock.yml: -------------------------------------------------------------------------------- 1 | --- 2 | _extends: auto-maintenance 3 | -------------------------------------------------------------------------------- /.github/settings.yml: -------------------------------------------------------------------------------- 1 | --- 2 | _extends: auto-maintenance 3 | -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | --- 2 | _extends: auto-maintenance 3 | -------------------------------------------------------------------------------- /.github/workflows/labeler.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Pull request labeler 3 | on: 4 | schedule: 5 | - cron: '*/15 * * * *' 6 | jobs: 7 | labeler: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: paulfantom/periodic-labeler@master 11 | env: 12 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 13 | GITHUB_REPOSITORY: ${{ github.repository }} 14 | -------------------------------------------------------------------------------- /.github/workflows/labels.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Sync labels in the declarative way 3 | on: 4 | push: 5 | branches: 6 | - master 7 | jobs: 8 | build: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@1.0.0 12 | - uses: micnncim/action-label-syncer@v0.3.1 13 | env: 14 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 15 | GITHUB_REPOSITORY: ${{ github.repository }} 16 | with: 17 | manifest: .github/labels.yml 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.retry 2 | *.log 3 | .molecule 4 | .cache 5 | __pycache__/ 6 | .pytest_cache 7 | .tox 8 | -------------------------------------------------------------------------------- /.mergify.yml: -------------------------------------------------------------------------------- 1 | --- 2 | pull_request_rules: 3 | - name: automatic merge and new release from cloudalchemybot 4 | conditions: 5 | - "status-success=Travis CI - Pull Request" 6 | - status-success=WIP 7 | - head~=autoupdate|skeleton 8 | - author=cloudalchemybot 9 | actions: 10 | merge: 11 | method: squash 12 | strict: true 13 | - name: delete head branch after merge 14 | conditions: [] 15 | actions: 16 | delete_head_branch: {} 17 | -------------------------------------------------------------------------------- /.yamllint: -------------------------------------------------------------------------------- 1 | --- 2 | extends: default 3 | ignore: | 4 | .github/ 5 | meta/ 6 | 7 | rules: 8 | braces: 9 | max-spaces-inside: 1 10 | level: error 11 | brackets: 12 | max-spaces-inside: 1 13 | level: error 14 | line-length: disable 15 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | ## [0.2.4](https://galaxy.ansible.com/cloudalchemy/pushgateway) (2020-10-07) 4 | **Merged pull requests:** 5 | 6 | - New prometheus/pushgateway upstream release! [\#42](https://github.com/cloudalchemy/ansible-pushgateway/pull/42) ([cloudalchemybot](https://github.com/cloudalchemybot)) 7 | - \[REPO SYNC\] add troubleshooting doc skeleton [\#41](https://github.com/cloudalchemy/ansible-pushgateway/pull/41) ([cloudalchemybot](https://github.com/cloudalchemybot)) 8 | 9 | ## [0.2.3](https://galaxy.ansible.com/cloudalchemy/pushgateway) (2020-07-27) 10 | **Fixed bugs:** 11 | 12 | - Invalid permissions of /var/lib/pushgateway/ [\#36](https://github.com/cloudalchemy/ansible-pushgateway/issues/36) 13 | 14 | **Merged pull requests:** 15 | 16 | - fix pushgateway\_persistence\_dir permissions [\#38](https://github.com/cloudalchemy/ansible-pushgateway/pull/38) ([ahmadalli](https://github.com/ahmadalli)) 17 | - \[REPO SYNC\] Add passlib as a test requirement [\#37](https://github.com/cloudalchemy/ansible-pushgateway/pull/37) ([cloudalchemybot](https://github.com/cloudalchemybot)) 18 | - \[REPO SYNC\] lock molecule to v2 [\#33](https://github.com/cloudalchemy/ansible-pushgateway/pull/33) ([cloudalchemybot](https://github.com/cloudalchemybot)) 19 | - New prometheus/pushgateway upstream release! [\#32](https://github.com/cloudalchemy/ansible-pushgateway/pull/32) ([cloudalchemybot](https://github.com/cloudalchemybot)) 20 | 21 | ## [0.2.2](https://galaxy.ansible.com/cloudalchemy/pushgateway) (2020-01-28) 22 | **Merged pull requests:** 23 | 24 | - New prometheus/pushgateway upstream release! [\#31](https://github.com/cloudalchemy/ansible-pushgateway/pull/31) ([cloudalchemybot](https://github.com/cloudalchemybot)) 25 | - \[REPO SYNC\] Merge pull request \#4 from cloudalchemy/travis\_fix [\#30](https://github.com/cloudalchemy/ansible-pushgateway/pull/30) ([cloudalchemybot](https://github.com/cloudalchemybot)) 26 | - \[REPO SYNC\] use latest available python [\#29](https://github.com/cloudalchemy/ansible-pushgateway/pull/29) ([cloudalchemybot](https://github.com/cloudalchemybot)) 27 | 28 | ## [0.2.1](https://galaxy.ansible.com/cloudalchemy/pushgateway) (2019-12-21) 29 | **Merged pull requests:** 30 | 31 | - New prometheus/pushgateway upstream release! [\#27](https://github.com/cloudalchemy/ansible-pushgateway/pull/27) ([cloudalchemybot](https://github.com/cloudalchemybot)) 32 | - \[REPO SYNC\] remove IRC link [\#26](https://github.com/cloudalchemy/ansible-pushgateway/pull/26) ([cloudalchemybot](https://github.com/cloudalchemybot)) 33 | - Replace node exporter by pushgateway in readme [\#25](https://github.com/cloudalchemy/ansible-pushgateway/pull/25) ([notFloran](https://github.com/notFloran)) 34 | - \[REPO SYNC\] add declarative label sync; add autolabelling PRs [\#23](https://github.com/cloudalchemy/ansible-pushgateway/pull/23) ([cloudalchemybot](https://github.com/cloudalchemybot)) 35 | - \[REPO SYNC\] molecule: use CI images from quay.io instead of dockerhub [\#21](https://github.com/cloudalchemy/ansible-pushgateway/pull/21) ([cloudalchemybot](https://github.com/cloudalchemybot)) 36 | - \[REPO SYNC\] Update releaser.sh [\#20](https://github.com/cloudalchemy/ansible-pushgateway/pull/20) ([cloudalchemybot](https://github.com/cloudalchemybot)) 37 | - \[REPO SYNC\] add support for CentOS8 [\#19](https://github.com/cloudalchemy/ansible-pushgateway/pull/19) ([cloudalchemybot](https://github.com/cloudalchemybot)) 38 | 39 | ## [0.2.0](https://galaxy.ansible.com/cloudalchemy/pushgateway) (2019-10-16) 40 | **Merged pull requests:** 41 | 42 | - New prometheus/pushgateway upstream release! [\#18](https://github.com/cloudalchemy/ansible-pushgateway/pull/18) ([cloudalchemybot](https://github.com/cloudalchemybot)) 43 | 44 | ## [0.1.0](https://galaxy.ansible.com/cloudalchemy/pushgateway) (2019-10-11) 45 | **Merged pull requests:** 46 | 47 | - New prometheus/pushgateway upstream release! [\#17](https://github.com/cloudalchemy/ansible-pushgateway/pull/17) ([cloudalchemybot](https://github.com/cloudalchemybot)) 48 | - Synchronize files from cloudalchemy/skeleton [\#16](https://github.com/cloudalchemy/ansible-pushgateway/pull/16) ([cloudalchemybot](https://github.com/cloudalchemybot)) 49 | - Moving to python 3 and dropping support for python 2.x \(on deployer host\) [\#14](https://github.com/cloudalchemy/ansible-pushgateway/pull/14) ([cloudalchemybot](https://github.com/cloudalchemybot)) 50 | - added restartsec and startlimitinterval configurations [\#12](https://github.com/cloudalchemy/ansible-pushgateway/pull/12) ([oguzhaninan](https://github.com/oguzhaninan)) 51 | - Synchronize files from cloudalchemy/skeleton [\#11](https://github.com/cloudalchemy/ansible-pushgateway/pull/11) ([cloudalchemybot](https://github.com/cloudalchemybot)) 52 | - add pushgateway\_web\_external\_url option [\#10](https://github.com/cloudalchemy/ansible-pushgateway/pull/10) ([Nayls](https://github.com/Nayls)) 53 | - New prometheus/pushgateway upstream release! [\#8](https://github.com/cloudalchemy/ansible-pushgateway/pull/8) ([cloudalchemybot](https://github.com/cloudalchemybot)) 54 | - New prometheus/pushgateway upstream release! [\#7](https://github.com/cloudalchemy/ansible-pushgateway/pull/7) ([cloudalchemybot](https://github.com/cloudalchemybot)) 55 | 56 | ## [0.0.5](https://galaxy.ansible.com/cloudalchemy/pushgateway) (2019-05-04) 57 | **Merged pull requests:** 58 | 59 | - Synchronize files from cloudalchemy/skeleton [\#6](https://github.com/cloudalchemy/ansible-pushgateway/pull/6) ([cloudalchemybot](https://github.com/cloudalchemybot)) 60 | - Wait for network to be online [\#5](https://github.com/cloudalchemy/ansible-pushgateway/pull/5) ([paulfantom](https://github.com/paulfantom)) 61 | - New prometheus/pushgateway upstream release! [\#4](https://github.com/cloudalchemy/ansible-pushgateway/pull/4) ([cloudalchemybot](https://github.com/cloudalchemybot)) 62 | 63 | ## [0.0.4](https://galaxy.ansible.com/cloudalchemy/pushgateway) (2019-01-03) 64 | **Merged pull requests:** 65 | 66 | - move to ansible 2.7 [\#1](https://github.com/cloudalchemy/ansible-pushgateway/pull/1) ([paulfantom](https://github.com/paulfantom)) 67 | 68 | ## [0.0.3](https://galaxy.ansible.com/cloudalchemy/pushgateway) (2018-12-12) 69 | **Merged pull requests:** 70 | 71 | - New pushgateway upstream release! [\#3](https://github.com/cloudalchemy/ansible-pushgateway/pull/3) ([cloudalchemybot](https://github.com/cloudalchemybot)) 72 | - New pushgateway upstream release! [\#2](https://github.com/cloudalchemy/ansible-pushgateway/pull/2) ([cloudalchemybot](https://github.com/cloudalchemybot)) 73 | 74 | ## [0.0.2](https://galaxy.ansible.com/cloudalchemy/pushgateway) (2018-09-06) 75 | ## [0.0.1](https://galaxy.ansible.com/cloudalchemy/pushgateway) (2018-08-12) 76 | 77 | 78 | \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributor Guideline 2 | 3 | This document provides an overview of how you can participate in improving this project or extending it. We are 4 | grateful for all your help: bug reports and fixes, code contributions, documentation or ideas. Feel free to join, we 5 | appreciate your support!! 6 | 7 | ## Communication 8 | 9 | ### GitHub repositories 10 | 11 | Much of the issues, goals and ideas are tracked in the respective projects in GitHub. Please use this channel to report 12 | bugs, ask questions, and request new features . 13 | 14 | ## git and GitHub 15 | 16 | In order to contribute code please: 17 | 18 | 1. Fork the project on GitHub 19 | 2. Clone the project 20 | 3. Add changes (and tests) 21 | 4. Commit and push 22 | 5. Create a merge-request 23 | 24 | To have your code merged, see the expectations listed below. 25 | 26 | You can find a well-written guide [here](https://help.github.com/articles/fork-a-repo). 27 | 28 | Please follow common commit best-practices. Be explicit, have a short summary, a well-written description and 29 | references. This is especially important for the merge-request. 30 | 31 | Some great guidelines can be found [here](https://wiki.openstack.org/wiki/GitCommitMessages) and 32 | [here](http://robots.thoughtbot.com/5-useful-tips-for-a-better-commit-message). 33 | 34 | ## Releases 35 | 36 | We try to stick to semantic versioning and our releases are automated. Release is created by assigning a keyword (in a 37 | way similar to circle ci keyword [`[ci skip]`](https://docs.travis-ci.com/user/customizing-the-build#Skipping-a-build)) 38 | to a commit with merge request. Available keywords are (square brackets are important!): 39 | 40 | * `[patch]`, `[fix]`, `[bugfix]` - for PATCH version release 41 | * `[minor]`, `[feature]`, `[feat]` - for MINOR version release 42 | * `[major]`, `[breaking change]` - for MAJOR version release 43 | 44 | ## Changelog 45 | 46 | Changelog is generated automatically during release process and all information is taken from github issues, PRs and 47 | labels. 48 | 49 | ## Expectations 50 | 51 | ### Keep it simple 52 | 53 | We try to provide production ready ansible roles which should be as much zero-conf as possible but this doesn't mean to 54 | overcomplicate things. Just follow [KISS](https://en.wikipedia.org/wiki/KISS_principle). 55 | 56 | ### Be explicit 57 | 58 | * Please avoid using nonsensical property and variable names. 59 | * Use self-describing attribute names for user configuration. 60 | * In case of failures, communicate what happened and why a failure occurs to the user. Make it easy to track the code 61 | or action that produced the error. Try to catch and handle errors if possible to provide improved failure messages. 62 | 63 | 64 | ### Add tests 65 | 66 | We are striving to use at least two test scenarios located in [/molecule](molecule) directory. First one 67 | ([default](molecule/default)) is testing default configuration without any additional variables, second one 68 | ([alternative](molecule/alternative)) is testing what happens when many variables from 69 | [/defaults/main.yml](defaults/main.yml) are changed. When adding new functionalities please add tests to proper 70 | scenarios. Tests are written in testinfra framework and are located in `/tests` subdirectory of scenario directory 71 | (for example default tests are in [/molecule/default/tests](molecule/default/tests)). 72 | More information about: 73 | - [testinfra](http://testinfra.readthedocs.io/en/latest/index.html) 74 | - [molecule](https://molecule.readthedocs.io/en/latest/index.html) 75 | 76 | ### Follow best practices 77 | 78 | Please follow [ansible best practices](http://docs.ansible.com/ansible/latest/playbooks_best_practices.html) and 79 | especially provide meaningful names to tasks and even comments where needed. 80 | 81 | Our test framework automatically lints code with [`yamllint`](https://github.com/adrienverge/yamllint), 82 | [`ansible-lint`](https://github.com/willthames/ansible-lint), and [`flake8`](https://gitlab.com/pycqa/flake8) programs 83 | so be sure to follow their rules. 84 | 85 | Remember: Code is generally read much more often than written. 86 | 87 | ### Use Markdown 88 | 89 | Wherever possible, please refrain from any other formats and stick to simple markdown. 90 | 91 | ## Requirements regarding roles design 92 | 93 | We are trying to create the best and most secure installation method for non-containerized prometheus stack components. 94 | To accomplish this all roles need to support: 95 | 96 | - current and at least one previous ansible version 97 | - systemd as the only available process manager 98 | - at least latest debian and CentOS distributions 99 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017-2018 Pawel Krupa 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Ansible Role: pushgateway 2 | 3 | [![Build Status](https://travis-ci.com/cloudalchemy/ansible-pushgateway.svg?branch=master)](https://travis-ci.com/cloudalchemy/ansible-pushgateway) 4 | [![License](https://img.shields.io/badge/license-MIT%20License-brightgreen.svg)](https://opensource.org/licenses/MIT) 5 | [![Ansible Role](https://img.shields.io/badge/ansible%20role-cloudalchemy.pushgateway-blue.svg)](https://galaxy.ansible.com/cloudalchemy/pushgateway/) 6 | [![GitHub tag](https://img.shields.io/github/tag/cloudalchemy/ansible-pushgateway.svg)](https://github.com/cloudalchemy/ansible-pushgateway/tags) 7 | 8 | ## Description 9 | 10 | Deploy prometheus [pushgateway](https://github.com/prometheus/pushgateway) using ansible. 11 | 12 | ## Requirements 13 | 14 | - Ansible >= 2.7 (It might work on previous versions, but we cannot guarantee it) 15 | 16 | ## Role Variables 17 | 18 | All variables which can be overridden are stored in [defaults/main.yml](defaults/main.yml) file as well as in table below. 19 | 20 | | Name | Default Value | Description | 21 | | -------------- | ------------- | -----------------------------------| 22 | | `pushgateway_version` | 1.3.1 | Pushgateway package version | 23 | | `pushgateway_web_listen_address` | "0.0.0.0:9091" | Address on which pushgateway will listen | 24 | | `pushgateway_web_external_url` | "" | External address on which pushgateway is available. Useful when behind reverse proxy. Ex. http://example.org/pushgateway | 25 | | `pushgateway_persistence` | true | Enable persistence file | 26 | | `pushgateway_config_flags_extra` | {} | Additional configuration flags passed at startup to pushgateway binary | 27 | 28 | ## Example 29 | 30 | ### Playbook 31 | 32 | Use it in a playbook as follows: 33 | ```yaml 34 | - hosts: all 35 | roles: 36 | - cloudalchemy.pushgateway 37 | ``` 38 | 39 | ### Demo site 40 | 41 | We provide demo site for full monitoring solution based on prometheus and grafana. Repository with code and links to running instances is [available on github](https://github.com/cloudalchemy/demo-site) and site is hosted on [DigitalOcean](https://digitalocean.com). 42 | 43 | ## Local Testing 44 | 45 | The preferred way of locally testing the role is to use Docker and [molecule](https://github.com/ansible-community/molecule) (v3.x). You will have to install Docker on your system. See "Get started" for a Docker package suitable to for your system. Running your tests is as simple as executing `molecule test`. 46 | 47 | ## Continuous Intergation 48 | 49 | Combining molecule and circle CI allows us to test how new PRs will behave when used with multiple ansible versions and multiple operating systems. This also allows use to create test scenarios for different role configurations. As a result we have a quite large test matrix which can take more time than local testing, so please be patient. 50 | 51 | ## Contributing 52 | 53 | See [contributor guideline](CONTRIBUTING.md). 54 | 55 | ## Troubleshooting 56 | 57 | See [troubleshooting](TROUBLESHOOTING.md). 58 | 59 | ## License 60 | 61 | This project is licensed under MIT License. See [LICENSE](/LICENSE) for more details. 62 | -------------------------------------------------------------------------------- /TROUBLESHOOTING.md: -------------------------------------------------------------------------------- 1 | # Troubleshooting 2 | 3 | 4 | -------------------------------------------------------------------------------- /defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | pushgateway_version: 1.3.1 3 | pushgateway_web_listen_address: "0.0.0.0:9091" 4 | pushgateway_web_external_url: "" 5 | 6 | pushgateway_persistence: true 7 | 8 | pushgateway_config_flags_extra: {} 9 | # pushgateway_config_flags_extra: 10 | # persistence.interval: '5m' 11 | -------------------------------------------------------------------------------- /handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: restart pushgateway 3 | become: true 4 | systemd: 5 | daemon_reload: true 6 | name: pushgateway 7 | state: restarted 8 | -------------------------------------------------------------------------------- /meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | galaxy_info: 3 | author: Pawel Krupa 4 | description: Prometheus Pushgateway 5 | role_name: pushgateway 6 | license: MIT 7 | company: none 8 | min_ansible_version: 2.7 9 | platforms: 10 | - name: Ubuntu 11 | versions: 12 | - bionic 13 | - xenial 14 | - name: Debian 15 | versions: 16 | - stretch 17 | - buster 18 | - name: EL 19 | versions: 20 | - 7 21 | - 8 22 | - name: Fedora 23 | versions: 24 | - 30 25 | - 31 26 | galaxy_tags: 27 | - monitoring 28 | - prometheus 29 | - pushgateway 30 | - metrics 31 | - system 32 | 33 | dependencies: [] 34 | -------------------------------------------------------------------------------- /molecule/alternative/molecule.yml: -------------------------------------------------------------------------------- 1 | --- 2 | dependency: 3 | name: galaxy 4 | driver: 5 | name: docker 6 | platforms: 7 | - name: bionic 8 | pre_build_image: true 9 | image: quay.io/paulfantom/molecule-systemd:ubuntu-18.04 10 | docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" 11 | privileged: true 12 | volumes: 13 | - /sys/fs/cgroup:/sys/fs/cgroup:ro 14 | - name: xenial 15 | pre_build_image: true 16 | image: quay.io/paulfantom/molecule-systemd:ubuntu-16.04 17 | docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" 18 | privileged: true 19 | volumes: 20 | - /sys/fs/cgroup:/sys/fs/cgroup:ro 21 | - name: stretch 22 | pre_build_image: true 23 | image: quay.io/paulfantom/molecule-systemd:debian-9 24 | docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" 25 | privileged: true 26 | volumes: 27 | - /sys/fs/cgroup:/sys/fs/cgroup:ro 28 | - name: buster 29 | pre_build_image: true 30 | image: quay.io/paulfantom/molecule-systemd:debian-10 31 | docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" 32 | privileged: true 33 | volumes: 34 | - /sys/fs/cgroup:/sys/fs/cgroup:ro 35 | - name: centos7 36 | pre_build_image: true 37 | image: quay.io/paulfantom/molecule-systemd:centos-7 38 | docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" 39 | privileged: true 40 | volumes: 41 | - /sys/fs/cgroup:/sys/fs/cgroup:ro 42 | - name: centos8 43 | pre_build_image: true 44 | image: quay.io/paulfantom/molecule-systemd:centos-8 45 | docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" 46 | privileged: true 47 | volumes: 48 | - /sys/fs/cgroup:/sys/fs/cgroup:ro 49 | groups: 50 | - python3 51 | - name: fedora 52 | pre_build_image: true 53 | image: quay.io/paulfantom/molecule-systemd:fedora-30 54 | docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" 55 | privileged: true 56 | volumes: 57 | - /sys/fs/cgroup:/sys/fs/cgroup:ro 58 | groups: 59 | - python3 60 | provisioner: 61 | name: ansible 62 | playbooks: 63 | prepare: prepare.yml 64 | converge: playbook.yml 65 | inventory: 66 | group_vars: 67 | python3: 68 | ansible_python_interpreter: /usr/bin/python3 69 | verifier: 70 | name: testinfra 71 | -------------------------------------------------------------------------------- /molecule/alternative/playbook.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Run role 3 | hosts: all 4 | any_errors_fatal: true 5 | roles: 6 | - ansible-pushgateway 7 | vars: 8 | pushgateway_version: latest 9 | pushgateway_web_listen_address: "127.0.0.1:9091" 10 | pushgateway_persistence: false 11 | -------------------------------------------------------------------------------- /molecule/alternative/prepare.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Prepare 3 | hosts: all 4 | gather_facts: false 5 | tasks: [] 6 | -------------------------------------------------------------------------------- /molecule/alternative/tests/test_alternative.py: -------------------------------------------------------------------------------- 1 | import os 2 | import testinfra.utils.ansible_runner 3 | 4 | testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( 5 | os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') 6 | 7 | 8 | def test_directories(host): 9 | dirs = [ 10 | "/var/lib/pushgateway" 11 | ] 12 | for dir in dirs: 13 | d = host.file(dir) 14 | assert not d.exists 15 | 16 | 17 | def test_files(host): 18 | files = [ 19 | "/var/lib/pushgateway/persistence" 20 | ] 21 | for file in files: 22 | f = host.file(file) 23 | assert not f.exists 24 | 25 | 26 | def test_socket(host): 27 | sockets = [ 28 | "tcp://127.0.0.1:9091" 29 | ] 30 | for socket in sockets: 31 | s = host.socket(socket) 32 | assert s.is_listening 33 | -------------------------------------------------------------------------------- /molecule/default/molecule.yml: -------------------------------------------------------------------------------- 1 | --- 2 | dependency: 3 | name: galaxy 4 | driver: 5 | name: docker 6 | platforms: 7 | - name: bionic 8 | pre_build_image: true 9 | image: quay.io/paulfantom/molecule-systemd:ubuntu-18.04 10 | docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" 11 | privileged: true 12 | volumes: 13 | - /sys/fs/cgroup:/sys/fs/cgroup:ro 14 | - name: xenial 15 | pre_build_image: true 16 | image: quay.io/paulfantom/molecule-systemd:ubuntu-16.04 17 | docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" 18 | privileged: true 19 | volumes: 20 | - /sys/fs/cgroup:/sys/fs/cgroup:ro 21 | - name: stretch 22 | pre_build_image: true 23 | image: quay.io/paulfantom/molecule-systemd:debian-9 24 | docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" 25 | privileged: true 26 | volumes: 27 | - /sys/fs/cgroup:/sys/fs/cgroup:ro 28 | - name: buster 29 | pre_build_image: true 30 | image: quay.io/paulfantom/molecule-systemd:debian-10 31 | docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" 32 | privileged: true 33 | volumes: 34 | - /sys/fs/cgroup:/sys/fs/cgroup:ro 35 | - name: centos7 36 | pre_build_image: true 37 | image: quay.io/paulfantom/molecule-systemd:centos-7 38 | docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" 39 | privileged: true 40 | volumes: 41 | - /sys/fs/cgroup:/sys/fs/cgroup:ro 42 | - name: centos8 43 | pre_build_image: true 44 | image: quay.io/paulfantom/molecule-systemd:centos-8 45 | docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" 46 | privileged: true 47 | volumes: 48 | - /sys/fs/cgroup:/sys/fs/cgroup:ro 49 | groups: 50 | - python3 51 | - name: fedora 52 | pre_build_image: true 53 | image: quay.io/paulfantom/molecule-systemd:fedora-30 54 | docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" 55 | privileged: true 56 | volumes: 57 | - /sys/fs/cgroup:/sys/fs/cgroup:ro 58 | groups: 59 | - python3 60 | provisioner: 61 | name: ansible 62 | playbooks: 63 | prepare: prepare.yml 64 | converge: playbook.yml 65 | inventory: 66 | group_vars: 67 | python3: 68 | ansible_python_interpreter: /usr/bin/python3 69 | verifier: 70 | name: testinfra 71 | -------------------------------------------------------------------------------- /molecule/default/playbook.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Run role 3 | hosts: all 4 | any_errors_fatal: true 5 | roles: 6 | - ansible-pushgateway 7 | -------------------------------------------------------------------------------- /molecule/default/prepare.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Prepare 3 | hosts: all 4 | gather_facts: false 5 | tasks: [] 6 | -------------------------------------------------------------------------------- /molecule/default/tests/test_default.py: -------------------------------------------------------------------------------- 1 | import os 2 | import testinfra.utils.ansible_runner 3 | 4 | testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( 5 | os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') 6 | 7 | 8 | def test_directories(host): 9 | dirs = [ 10 | "/var/lib/pushgateway" 11 | ] 12 | for dir in dirs: 13 | d = host.file(dir) 14 | assert d.is_directory 15 | assert d.exists 16 | 17 | 18 | def test_files(host): 19 | files = [ 20 | "/etc/systemd/system/pushgateway.service", 21 | "/var/lib/pushgateway/persistence", 22 | "/usr/local/bin/pushgateway" 23 | ] 24 | for file in files: 25 | f = host.file(file) 26 | assert f.exists 27 | assert f.is_file 28 | 29 | 30 | def test_service(host): 31 | s = host.service("pushgateway") 32 | # assert s.is_enabled 33 | assert s.is_running 34 | 35 | 36 | def test_socket(host): 37 | sockets = [ 38 | "tcp://0.0.0.0:9091" 39 | ] 40 | for socket in sockets: 41 | s = host.socket(socket) 42 | assert s.is_listening 43 | -------------------------------------------------------------------------------- /tasks/configure.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - block: 3 | - name: Create persistence file dir 4 | file: 5 | path: "{{ pushgateway_persistence_dir }}" 6 | state: directory 7 | owner: "{{ pushgateway_system_user }}" 8 | group: "{{ pushgateway_system_group }}" 9 | mode: 0755 10 | 11 | - name: Create persistence file 12 | file: 13 | path: "{{ pushgateway_persistence_dir }}/persistence" 14 | state: touch 15 | owner: "{{ pushgateway_system_user }}" 16 | group: "{{ pushgateway_system_group }}" 17 | mode: 0640 18 | register: touch_log 19 | changed_when: touch_log.diff.before.state != "file" # Needed for idempotance (https://github.com/ansible/ansible/issues/30226) 20 | when: pushgateway_persistence 21 | 22 | - name: Allow pushgateway port in SELinux on RedHat OS family 23 | seport: 24 | ports: "{{ pushgateway_web_listen_address.split(':')[1] }}" 25 | proto: tcp 26 | setype: http_port_t 27 | state: present 28 | when: 29 | - ansible_version.full is version_compare('2.4', '>=') 30 | - ansible_selinux.status == "enabled" 31 | -------------------------------------------------------------------------------- /tasks/install.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Install dependencies 3 | package: 4 | name: "{{ item }}" 5 | state: present 6 | with_items: "{{ pushgateway_dependencies }}" 7 | 8 | - name: Create the pushgateway group 9 | group: 10 | name: "{{ pushgateway_system_group }}" 11 | state: present 12 | system: true 13 | 14 | - name: Create the pushgateway user 15 | user: 16 | name: "{{ pushgateway_system_user }}" 17 | groups: "{{ pushgateway_system_group }}" 18 | append: true 19 | shell: /usr/sbin/nologin 20 | system: true 21 | createhome: false 22 | home: / 23 | 24 | - name: Download pushgateway binary to local folder 25 | become: false 26 | get_url: 27 | url: "https://github.com/prometheus/pushgateway/releases/download/v{{ pushgateway_version }}/pushgateway-{{ pushgateway_version }}.linux-{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}.tar.gz" 28 | dest: "/tmp/pushgateway-{{ pushgateway_version }}.linux-{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}.tar.gz" 29 | checksum: "sha256:{{ pushgateway_checksum }}" 30 | register: _download_binary 31 | until: _download_binary is succeeded 32 | retries: 5 33 | delay: 2 34 | delegate_to: localhost 35 | check_mode: false 36 | 37 | - name: Unpack pushgateway binary 38 | become: false 39 | unarchive: 40 | src: "/tmp/pushgateway-{{ pushgateway_version }}.linux-{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}.tar.gz" 41 | dest: "/tmp" 42 | creates: "/tmp/pushgateway-{{ pushgateway_version }}.linux-{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}/pushgateway" 43 | delegate_to: localhost 44 | check_mode: false 45 | 46 | - name: Propagate pushgateway binaries 47 | copy: 48 | src: "/tmp/pushgateway-{{ pushgateway_version }}.linux-{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}/pushgateway" 49 | dest: "/usr/local/bin/pushgateway" 50 | mode: 0750 51 | owner: "{{ pushgateway_system_user }}" 52 | group: "{{ pushgateway_system_group }}" 53 | notify: restart pushgateway 54 | when: not ansible_check_mode 55 | 56 | - name: Copy the pushgateway systemd service file 57 | template: 58 | src: pushgateway.service.j2 59 | dest: /etc/systemd/system/pushgateway.service 60 | owner: root 61 | group: root 62 | mode: 0644 63 | notify: restart pushgateway 64 | -------------------------------------------------------------------------------- /tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Gather variables for each operating system 3 | include_vars: "{{ item }}" 4 | with_first_found: 5 | - "{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yml" 6 | - "{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yml" 7 | - "{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yml" 8 | - "{{ ansible_distribution_file_variety | lower }}.yml" 9 | - "{{ ansible_distribution | lower }}.yml" 10 | - "{{ ansible_os_family | lower }}.yml" 11 | tags: 12 | - always 13 | 14 | - import_tasks: preflight.yml 15 | tags: 16 | - always 17 | 18 | - import_tasks: install.yml 19 | become: true 20 | tags: 21 | - install 22 | 23 | - import_tasks: configure.yml 24 | become: true 25 | tags: 26 | - configure 27 | 28 | - name: Ensure pushgateway is enabled on boot 29 | become: true 30 | systemd: 31 | daemon_reload: true 32 | name: pushgateway 33 | state: started 34 | enabled: true 35 | tags: 36 | - run 37 | -------------------------------------------------------------------------------- /tasks/preflight.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Naive assertion of proper listen address 3 | assert: 4 | that: 5 | - "':' in pushgateway_web_listen_address" 6 | 7 | - name: Fail on unsupported init systems 8 | fail: 9 | msg: "This module only works with systemd" 10 | when: ansible_service_mgr != 'systemd' 11 | 12 | - block: 13 | - name: Get latest release 14 | uri: 15 | url: "https://api.github.com/repos/prometheus/pushgateway/releases/latest" 16 | method: GET 17 | return_content: true 18 | status_code: 200 19 | body_format: json 20 | validate_certs: false 21 | user: "{{ lookup('env', 'GH_USER') | default(omit) }}" 22 | password: "{{ lookup('env', 'GH_TOKEN') | default(omit) }}" 23 | no_log: true 24 | register: _latest_release 25 | until: _latest_release.status == 200 26 | retries: 5 27 | 28 | - name: "Set pushgateway version to {{ _latest_release.json.tag_name[1:] }}" 29 | set_fact: 30 | pushgateway_version: "{{ _latest_release.json.tag_name[1:] }}" 31 | when: pushgateway_version == "latest" 32 | 33 | - name: "Get checksum for {{ go_arch_map[ansible_architecture] | default(ansible_architecture) }} architecture" 34 | set_fact: 35 | pushgateway_checksum: "{{ item.split(' ')[0] }}" 36 | with_items: 37 | - "{{ lookup('url', 'https://github.com/prometheus/pushgateway/releases/download/v' + pushgateway_version + '/sha256sums.txt', wantlist=True) | list }}" 38 | when: "('linux-' + (go_arch_map[ansible_architecture] | default(ansible_architecture)) + '.tar.gz') in item" 39 | 40 | - name: Get systemd version 41 | shell: systemctl --version | awk '$1 == "systemd" {print $2}' 42 | changed_when: false 43 | check_mode: false 44 | register: pushgateway_systemd_version 45 | tags: 46 | - skip_ansible_lint 47 | -------------------------------------------------------------------------------- /templates/pushgateway.service.j2: -------------------------------------------------------------------------------- 1 | {{ ansible_managed | comment}} 2 | 3 | [Unit] 4 | Description=Prometheus pushgateway 5 | After=network-online.target 6 | StartLimitInterval=0 7 | 8 | [Service] 9 | Type=simple 10 | User={{ pushgateway_system_user }} 11 | Group={{ pushgateway_system_group }} 12 | ExecStart=/usr/local/bin/pushgateway \ 13 | {% if pushgateway_persistence %} 14 | --persistence.file="{{ pushgateway_persistence_dir }}/persistence" \ 15 | {% endif %} 16 | {% if pushgateway_web_external_url %} 17 | --web.external-url="{{ pushgateway_web_external_url }}" \ 18 | {% endif %} 19 | --web.listen-address={{ pushgateway_web_listen_address }}{% for flag, flag_value in pushgateway_config_flags_extra.items() %}\ 20 | --{{ flag }}{% if flag_value %}={{ flag_value }}{% endif %} {% endfor %} 21 | 22 | PrivateTmp=true 23 | PrivateDevices=true 24 | ProtectHome=true 25 | NoNewPrivileges=true 26 | {% if pushgateway_persistence %} 27 | {% if pushgateway_systemd_version.stdout | int >= 231 %} 28 | ReadWritePaths={{ pushgateway_persistence_dir }} 29 | {% else %} 30 | ReadWriteDirectories={{ pushgateway_persistence_dir }} 31 | {% endif %} 32 | {% endif %} 33 | {% if pushgateway_systemd_version.stdout | int >= 232 %} 34 | ProtectSystem=strict 35 | ProtectControlGroups=true 36 | ProtectKernelModules=true 37 | ProtectKernelTunables=true 38 | {% else %} 39 | ProtectSystem=full 40 | {% endif %} 41 | 42 | {% if http_proxy is defined %} 43 | Environment="HTTP_PROXY={{ http_proxy }}"{% if https_proxy is defined %} "HTTPS_PROXY={{ https_proxy }}{% endif %}" 44 | {% endif %} 45 | 46 | SyslogIdentifier=pushgateway 47 | Restart=always 48 | RestartSec=0 49 | 50 | [Install] 51 | WantedBy=multi-user.target 52 | -------------------------------------------------------------------------------- /test-requirements.txt: -------------------------------------------------------------------------------- 1 | molecule>=3.0.0 2 | molecule-docker 3 | docker 4 | ansible-lint>=3.4.0 5 | testinfra>=1.7.0 6 | jmespath 7 | selinux 8 | passlib 9 | -------------------------------------------------------------------------------- /vars/debian.yml: -------------------------------------------------------------------------------- 1 | --- 2 | pushgateway_dependencies: [] 3 | -------------------------------------------------------------------------------- /vars/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | go_arch_map: 3 | i386: '386' 4 | x86_64: 'amd64' 5 | aarch64: 'arm64' 6 | armv7l: 'armv7' 7 | armv6l: 'armv6' 8 | 9 | pushgateway_persistence_dir: /var/lib/pushgateway 10 | pushgateway_system_group: "pushgateway" 11 | pushgateway_system_user: "{{ pushgateway_system_group }}" 12 | -------------------------------------------------------------------------------- /vars/redhat-7.yml: -------------------------------------------------------------------------------- 1 | --- 2 | pushgateway_dependencies: 3 | - libselinux-python 4 | - policycoreutils-python 5 | -------------------------------------------------------------------------------- /vars/redhat.yml: -------------------------------------------------------------------------------- 1 | --- 2 | pushgateway_dependencies: 3 | - python3-libselinux 4 | - python3-policycoreutils 5 | --------------------------------------------------------------------------------