├── .ansible-lint ├── .github ├── ISSUE_TEMPLATE │ ├── bug.md │ ├── feature.md │ └── support.md ├── labeler.yml ├── lock.yml ├── settings.yml └── stale.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 └── latest │ ├── molecule.yml │ ├── playbook.yml │ └── tests │ └── test_alternative.py ├── tasks ├── configure.yml ├── install.yml ├── main.yml ├── preflight.yml └── selinux.yml ├── templates ├── config.yaml.j2 └── node_exporter.service.j2 ├── test-requirements.txt └── vars └── main.yml /.ansible-lint: -------------------------------------------------------------------------------- 1 | --- 2 | skip_list: 3 | - '106' 4 | - '204' 5 | - '208' 6 | -------------------------------------------------------------------------------- /.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/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 | -------------------------------------------------------------------------------- /.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 | ## [**Next release**](https://galaxy.ansible.com/cloudalchemy/node_exporter) 4 | 5 | ## [2.0.0] - 2021-04-19 6 | **Merged pull requests:** 7 | 8 | - Merge pull request [#219](https://github.com/cloudalchemy/ansible-node-exporter/issues/219) from cloudalchemy/skeleton 9 | - :robot: sync with cloudalchemy/skeleton (SHA: 5ca88c27): Merge pull request [#9](https://github.com/cloudalchemy/ansible-node-exporter/issues/9) from cloudalchemy/superq/more_updates 10 | 11 | 12 | ## [1.0.0] - 2021-04-11 13 | **Merged pull requests:** 14 | 15 | - Merge pull request [#214](https://github.com/cloudalchemy/ansible-node-exporter/issues/214) from cloudalchemy/superq/envs 16 | - Merge pull request [#213](https://github.com/cloudalchemy/ansible-node-exporter/issues/213) from cloudalchemy/superq/chglog 17 | - Merge pull request [#212](https://github.com/cloudalchemy/ansible-node-exporter/issues/212) from cloudalchemy/superq/publisher_image 18 | - Merge pull request [#209](https://github.com/cloudalchemy/ansible-node-exporter/issues/209) from cloudalchemy/autoupdate 19 | - Merge pull request [#208](https://github.com/cloudalchemy/ansible-node-exporter/issues/208) from cloudalchemy/autoupdate 20 | - Merge pull request [#207](https://github.com/cloudalchemy/ansible-node-exporter/issues/207) from nop33/fix-typos 21 | - Merge pull request [#206](https://github.com/cloudalchemy/ansible-node-exporter/issues/206) from cloudalchemy/paulfantom-patch-1 22 | - Merge pull request [#204](https://github.com/cloudalchemy/ansible-node-exporter/issues/204) from cloudalchemy/bjk/update_requirements 23 | - Merge pull request [#202](https://github.com/cloudalchemy/ansible-node-exporter/issues/202) from cloudalchemy/autoupdate 24 | - Merge pull request [#197](https://github.com/cloudalchemy/ansible-node-exporter/issues/197) from cloudalchemy/paulfantom/fix-release 25 | - Merge pull request [#196](https://github.com/cloudalchemy/ansible-node-exporter/issues/196) from kmille/master 26 | - Merge pull request [#195](https://github.com/cloudalchemy/ansible-node-exporter/issues/195) from cloudalchemy/paulfantom/scenario-latest 27 | - Merge pull request [#182](https://github.com/cloudalchemy/ansible-node-exporter/issues/182) from parmsib/patch-1 28 | - Merge pull request [#187](https://github.com/cloudalchemy/ansible-node-exporter/issues/187) from cloudalchemy/superq/internal_defaults 29 | - Merge pull request [#193](https://github.com/cloudalchemy/ansible-node-exporter/issues/193) from cloudalchemy/paulfantom-patch-1 30 | - Merge pull request [#188](https://github.com/cloudalchemy/ansible-node-exporter/issues/188) from ctrlaltdel/master 31 | - Merge pull request [#191](https://github.com/cloudalchemy/ansible-node-exporter/issues/191) from cloudalchemy/superq/circle_release 32 | - Merge pull request [#190](https://github.com/cloudalchemy/ansible-node-exporter/issues/190) from cloudalchemy/superq/circleci 33 | - Merge pull request [#189](https://github.com/cloudalchemy/ansible-node-exporter/issues/189) from cloudalchemy/moleculev3 34 | - Merge pull request [#184](https://github.com/cloudalchemy/ansible-node-exporter/issues/184) from thdhondt/patch-1 35 | 36 | 37 | ## [0.22.0] - 2020-10-02 38 | ### Chore 39 | - troubleshooting document 40 | 41 | **Merged pull requests:** 42 | 43 | - Merge pull request [#179](https://github.com/cloudalchemy/ansible-node-exporter/issues/179) from kklimonda/master 44 | - Merge pull request [#178](https://github.com/cloudalchemy/ansible-node-exporter/issues/178) from FilippoProjetto/patch-1 45 | - Merge pull request [#172](https://github.com/cloudalchemy/ansible-node-exporter/issues/172) from pngmbh/troubleshooting 46 | 47 | 48 | ## [0.21.5] - 2020-07-21 49 | **Merged pull requests:** 50 | 51 | - Merge pull request [#170](https://github.com/cloudalchemy/ansible-node-exporter/issues/170) from bittopaz/patch-1 52 | 53 | 54 | ## [0.21.4] - 2020-07-20 55 | **Merged pull requests:** 56 | 57 | - Merge pull request [#169](https://github.com/cloudalchemy/ansible-node-exporter/issues/169) from cloudalchemy/superq/localhost_checksums 58 | 59 | 60 | ## [0.21.3] - 2020-06-18 61 | **Merged pull requests:** 62 | 63 | - Merge pull request [#163](https://github.com/cloudalchemy/ansible-node-exporter/issues/163) from sengel/missing_backslash 64 | 65 | 66 | ## [0.21.2] - 2020-06-18 67 | **Merged pull requests:** 68 | 69 | - always import install.yml when using local dir ([#162](https://github.com/cloudalchemy/ansible-node-exporter/issues/162)) 70 | 71 | 72 | ## [0.21.1] - 2020-06-17 73 | **Merged pull requests:** 74 | 75 | - New prometheus/node_exporter upstream release! ([#159](https://github.com/cloudalchemy/ansible-node-exporter/issues/159)) 76 | 77 | 78 | ## [0.21.0] - 2020-05-31 79 | **Merged pull requests:** 80 | 81 | - *: add support for node_exporter TLS settings ([#156](https://github.com/cloudalchemy/ansible-node-exporter/issues/156)) 82 | 83 | 84 | ## [0.20.0] - 2020-04-30 85 | **Merged pull requests:** 86 | 87 | - Use symbolic permissions for textfile collector dir ([#150](https://github.com/cloudalchemy/ansible-node-exporter/issues/150)) 88 | - :robot: sync with cloudalchemy/skeleton (SHA: 40e7ce18): lock molecule to v2 ([#149](https://github.com/cloudalchemy/ansible-node-exporter/issues/149)) 89 | - always validate GitHub certificate as there is no reason not to… ([#148](https://github.com/cloudalchemy/ansible-node-exporter/issues/148)) 90 | - Install 'policycoreutils-python' on redhat/centos < 8 and fedora… ([#145](https://github.com/cloudalchemy/ansible-node-exporter/issues/145)) 91 | - Add quotes to node_exporter parametrs in systemd service ([#144](https://github.com/cloudalchemy/ansible-node-exporter/issues/144)) 92 | 93 | 94 | ## [0.19.0] - 2020-01-31 95 | **Merged pull requests:** 96 | 97 | - remove system user management and convert variables to internal ones ([#142](https://github.com/cloudalchemy/ansible-node-exporter/issues/142)) 98 | - Do not manage system directories ([#140](https://github.com/cloudalchemy/ansible-node-exporter/issues/140)) 99 | - Add binary install directory ([#137](https://github.com/cloudalchemy/ansible-node-exporter/issues/137)) 100 | 101 | 102 | ## [0.18.0] - 2020-01-16 103 | **Merged pull requests:** 104 | 105 | - :robot: sync with cloudalchemy/skeleton (SHA: 69fc5be8): Merge pull request [#4](https://github.com/cloudalchemy/ansible-node-exporter/issues/4) from cloudalchemy/travis_fix ([#138](https://github.com/cloudalchemy/ansible-node-exporter/issues/138)) 106 | - :robot: sync with cloudalchemy/skeleton (SHA: f4521f6a): use latest available python ([#136](https://github.com/cloudalchemy/ansible-node-exporter/issues/136)) 107 | - Fix syntax on SELinux installation for clearlinux ([#134](https://github.com/cloudalchemy/ansible-node-exporter/issues/134)) 108 | - tasks,vars: move selinux package dependencies into separate tasks to allow potential ootb support for more OSes ([#132](https://github.com/cloudalchemy/ansible-node-exporter/issues/132)) 109 | - :robot: sync with cloudalchemy/skeleton (SHA: bb0f0949): remove IRC link ([#133](https://github.com/cloudalchemy/ansible-node-exporter/issues/133)) 110 | - Updated README.md ([#129](https://github.com/cloudalchemy/ansible-node-exporter/issues/129)) 111 | - add option to propagate binaries without access to internet ([#126](https://github.com/cloudalchemy/ansible-node-exporter/issues/126)) 112 | - [REPO SYNC] add declarative label sync; add autolabelling PRs ([#123](https://github.com/cloudalchemy/ansible-node-exporter/issues/123)) 113 | 114 | 115 | ## [0.17.0] - 2019-11-14 116 | **Merged pull requests:** 117 | 118 | - [REPO SYNC] molecule: use CI images from quay.io instead of dock… ([#121](https://github.com/cloudalchemy/ansible-node-exporter/issues/121)) 119 | - tasks: remove already covered entries when choosing an OS specific vars ([#118](https://github.com/cloudalchemy/ansible-node-exporter/issues/118)) 120 | - Run preflight tasks to register variables when check_mode is enabled ([#117](https://github.com/cloudalchemy/ansible-node-exporter/issues/117)) 121 | - tasks: do not touch any settings of system directory /usr/local/bin ([#116](https://github.com/cloudalchemy/ansible-node-exporter/issues/116)) 122 | - [REPO SYNC] Update releaser.sh ([#120](https://github.com/cloudalchemy/ansible-node-exporter/issues/120)) 123 | - [REPO SYNC] add support for CentOS8 ([#119](https://github.com/cloudalchemy/ansible-node-exporter/issues/119)) 124 | 125 | 126 | ## [0.16.0] - 2019-10-18 127 | **Merged pull requests:** 128 | 129 | - add official support for CentOS8 ([#114](https://github.com/cloudalchemy/ansible-node-exporter/issues/114)) 130 | - molecule/default/tests: test if permissions of other files are u… ([#112](https://github.com/cloudalchemy/ansible-node-exporter/issues/112)) 131 | - tasks: do not use alias for createhome as it seems to be broken ([#111](https://github.com/cloudalchemy/ansible-node-exporter/issues/111)) 132 | 133 | 134 | ## [0.15.0] - 2019-09-11 135 | **Merged pull requests:** 136 | 137 | - add RHEL8 and debian buster support; remove testing on debian jessie ([#101](https://github.com/cloudalchemy/ansible-node-exporter/issues/101)) 138 | - Synchronize files from cloudalchemy/skeleton ([#102](https://github.com/cloudalchemy/ansible-node-exporter/issues/102)) 139 | - :robot: synchronize with last commit in cloudalchemy/skeleton (SHA: 1f68dc21) ([#100](https://github.com/cloudalchemy/ansible-node-exporter/issues/100)) 140 | - Moving to python 3 and dropping support for python 2.x (on deploy… ([#99](https://github.com/cloudalchemy/ansible-node-exporter/issues/99)) 141 | - :robot: synchronize files from cloudalchemy/skeleton ([#97](https://github.com/cloudalchemy/ansible-node-exporter/issues/97)) 142 | - added restartsec and startlimitinterval configurations ([#96](https://github.com/cloudalchemy/ansible-node-exporter/issues/96)) 143 | - preflight: Fix detection of systemd version for systemd 240+ ([#93](https://github.com/cloudalchemy/ansible-node-exporter/issues/93)) 144 | - Updated README with correct default value ([#92](https://github.com/cloudalchemy/ansible-node-exporter/issues/92)) 145 | - node_exporter version check ([#91](https://github.com/cloudalchemy/ansible-node-exporter/issues/91)) 146 | 147 | 148 | ## [0.14.0] - 2019-06-05 149 | **Merged pull requests:** 150 | 151 | - Fix wrong size of /home shown by node-exporter ([#87](https://github.com/cloudalchemy/ansible-node-exporter/issues/87)) 152 | - :tada: automated upstream release update ([#90](https://github.com/cloudalchemy/ansible-node-exporter/issues/90)) 153 | - make node_exporter executable file root-owned ([#89](https://github.com/cloudalchemy/ansible-node-exporter/issues/89)) 154 | - Add retries to package installs ([#88](https://github.com/cloudalchemy/ansible-node-exporter/issues/88)) 155 | - Create suse.yml ([#86](https://github.com/cloudalchemy/ansible-node-exporter/issues/86)) 156 | - New prometheus/node_exporter upstream release! ([#85](https://github.com/cloudalchemy/ansible-node-exporter/issues/85)) 157 | - Synchronize files from cloudalchemy/skeleton ([#84](https://github.com/cloudalchemy/ansible-node-exporter/issues/84)) 158 | 159 | 160 | ## [0.13.1] - 2019-05-04 161 | **Merged pull requests:** 162 | 163 | - Fix systemd service startup ordering ([#83](https://github.com/cloudalchemy/ansible-node-exporter/issues/83)) 164 | 165 | 166 | ## [0.13.0] - 2019-04-01 167 | **Merged pull requests:** 168 | 169 | - fix preflight check responsible for collector enablement ([#81](https://github.com/cloudalchemy/ansible-node-exporter/issues/81)) 170 | - Refactor preflight checks ([#79](https://github.com/cloudalchemy/ansible-node-exporter/issues/79)) 171 | - make SELinux settings ipv6 compatible ([#78](https://github.com/cloudalchemy/ansible-node-exporter/issues/78)) 172 | - fix(tasks/configure.yml): typo in task name ([#77](https://github.com/cloudalchemy/ansible-node-exporter/issues/77)) 173 | - Add systemd state to started for first run of the role ([#72](https://github.com/cloudalchemy/ansible-node-exporter/issues/72)) 174 | - reintroduce user management into defaults and add testing user creation ([#74](https://github.com/cloudalchemy/ansible-node-exporter/issues/74)) 175 | 176 | 177 | ## [0.12.1] - 2019-02-19 178 | **Merged pull requests:** 179 | 180 | - Correctly enable extra collectors ([#70](https://github.com/cloudalchemy/ansible-node-exporter/issues/70)) 181 | - Lock down systemd service ([#68](https://github.com/cloudalchemy/ansible-node-exporter/issues/68)) 182 | 183 | 184 | ## [0.12.0] - 2018-12-17 185 | **Merged pull requests:** 186 | 187 | - Better tags and configuration handling ([#66](https://github.com/cloudalchemy/ansible-node-exporter/issues/66)) 188 | - simplify automated CPU arch choosing ([#64](https://github.com/cloudalchemy/ansible-node-exporter/issues/64)) 189 | - add alternative tests ([#65](https://github.com/cloudalchemy/ansible-node-exporter/issues/65)) 190 | 191 | 192 | ## [0.11.4] - 2018-12-05 193 | **Merged pull requests:** 194 | 195 | - Add support for multi-line ansible_managed strings ([#63](https://github.com/cloudalchemy/ansible-node-exporter/issues/63)) 196 | 197 | 198 | ## [0.11.3] - 2018-12-03 199 | **Merged pull requests:** 200 | 201 | - New node_exporter upstream release! ([#62](https://github.com/cloudalchemy/ansible-node-exporter/issues/62)) 202 | - Remove setting niceness in systemd service file ([#60](https://github.com/cloudalchemy/ansible-node-exporter/issues/60)) 203 | 204 | 205 | ## [0.11.2] - 2018-10-08 206 | **Merged pull requests:** 207 | 208 | - move to ansible 2.7 ([#58](https://github.com/cloudalchemy/ansible-node-exporter/issues/58)) 209 | 210 | 211 | ## [0.11.1] - 2018-10-04 212 | **Merged pull requests:** 213 | 214 | - do not set specific capabilities ([#57](https://github.com/cloudalchemy/ansible-node-exporter/issues/57)) 215 | 216 | 217 | ## [0.11.0] - 2018-09-19 218 | **Merged pull requests:** 219 | 220 | - Add support for Clear linux ([#55](https://github.com/cloudalchemy/ansible-node-exporter/issues/55)) 221 | - make textfile dir writable by node-exp group ([#56](https://github.com/cloudalchemy/ansible-node-exporter/issues/56)) 222 | 223 | 224 | ## [0.10.2] - 2018-09-06 225 | **Merged pull requests:** 226 | 227 | - reload-daemon on systemd enable ([#53](https://github.com/cloudalchemy/ansible-node-exporter/issues/53)) 228 | 229 | 230 | ## [0.10.1] - 2018-08-15 231 | **Merged pull requests:** 232 | 233 | - download checksum file only once ([#51](https://github.com/cloudalchemy/ansible-node-exporter/issues/51)) 234 | 235 | 236 | ## [0.10.0] - 2018-07-15 237 | **Merged pull requests:** 238 | 239 | - import_tasks instead of include; bringing role up to ansible-prometheus standards; minor changes ([#48](https://github.com/cloudalchemy/ansible-node-exporter/issues/48)) 240 | 241 | 242 | ## [0.9.0] - 2018-07-01 243 | **Merged pull requests:** 244 | 245 | - ansible 2.6 + allow remote docker host ([#46](https://github.com/cloudalchemy/ansible-node-exporter/issues/46)) 246 | - use tox for running test matrix ([#45](https://github.com/cloudalchemy/ansible-node-exporter/issues/45)) 247 | 248 | 249 | ## [0.8.0] - 2018-06-10 250 | **Merged pull requests:** 251 | 252 | - Add support for textfile collector ([#42](https://github.com/cloudalchemy/ansible-node-exporter/issues/42)) 253 | 254 | 255 | ## [0.7.0] - 2018-06-10 256 | **Merged pull requests:** 257 | 258 | - Install newer node_exporter by default ([#36](https://github.com/cloudalchemy/ansible-node-exporter/issues/36)) 259 | - specify file name for dest in get_url call ([#40](https://github.com/cloudalchemy/ansible-node-exporter/issues/40)) 260 | 261 | 262 | ## [0.6.20] - 2018-05-27 263 | **Merged pull requests:** 264 | 265 | - Fix architecture var parsing ([#39](https://github.com/cloudalchemy/ansible-node-exporter/issues/39)) 266 | - Offer a better IRC Web clients to users ([#38](https://github.com/cloudalchemy/ansible-node-exporter/issues/38)) 267 | 268 | 269 | ## [0.6.19] - 2018-05-23 270 | **Merged pull requests:** 271 | 272 | - Fix failing role on non-SELinux RedHat ([#37](https://github.com/cloudalchemy/ansible-node-exporter/issues/37)) 273 | - split download and unarchive and add checksum validation ([#35](https://github.com/cloudalchemy/ansible-node-exporter/issues/35)) 274 | - move to molecule 2.x ([#34](https://github.com/cloudalchemy/ansible-node-exporter/issues/34)) 275 | 276 | 277 | ## [0.6.18] - 2018-04-13 278 | **Merged pull requests:** 279 | 280 | - Merge pull request [#33](https://github.com/cloudalchemy/ansible-node-exporter/issues/33) from nikosgraser/master 281 | 282 | 283 | ## [0.6.17] - 2018-04-12 284 | **Merged pull requests:** 285 | 286 | - Merge pull request [#32](https://github.com/cloudalchemy/ansible-node-exporter/issues/32) from Porkepix/skip_capabilities_check_mode 287 | 288 | 289 | ## [0.6.16] - 2018-04-06 290 | **Merged pull requests:** 291 | 292 | - Merge pull request [#31](https://github.com/cloudalchemy/ansible-node-exporter/issues/31) from Porkepix/fix_tests_as_filter 293 | - Merge pull request [#30](https://github.com/cloudalchemy/ansible-node-exporter/issues/30) from Porkepix/fix_gitignore 294 | 295 | 296 | ## [0.6.15] - 2018-04-05 297 | 298 | ## [0.6.14] - 2018-04-02 299 | **Merged pull requests:** 300 | 301 | - retry downloads ([#29](https://github.com/cloudalchemy/ansible-node-exporter/issues/29)) 302 | 303 | 304 | ## [0.6.13] - 2018-03-30 305 | **Merged pull requests:** 306 | 307 | - Merge pull request [#28](https://github.com/cloudalchemy/ansible-node-exporter/issues/28) from Porkepix/fix-check_mode 308 | 309 | 310 | ## [0.6.12] - 2018-03-26 311 | **Merged pull requests:** 312 | 313 | - Merge pull request [#26](https://github.com/cloudalchemy/ansible-node-exporter/issues/26) from cloudalchemy/bionic 314 | 315 | 316 | ## [0.6.11] - 2018-03-24 317 | **Merged pull requests:** 318 | 319 | - Merge pull request [#27](https://github.com/cloudalchemy/ansible-node-exporter/issues/27) from cloudalchemy/new_ansible 320 | 321 | 322 | ## [0.6.10] - 2018-03-05 323 | **Merged pull requests:** 324 | 325 | - Merge pull request [#25](https://github.com/cloudalchemy/ansible-node-exporter/issues/25) from swesterveld/fix-warning-jinja-templating-delimiters 326 | 327 | 328 | ## [0.6.9] - 2018-02-18 329 | **Merged pull requests:** 330 | 331 | - Merge pull request [#24](https://github.com/cloudalchemy/ansible-node-exporter/issues/24) from cloudalchemy/fedora_support 332 | - resolve [#18](https://github.com/cloudalchemy/ansible-node-exporter/issues/18) 333 | 334 | 335 | ## [0.6.8] - 2018-02-14 336 | **Merged pull requests:** 337 | 338 | - Merge pull request [#23](https://github.com/cloudalchemy/ansible-node-exporter/issues/23) from swesterveld/fix_daemon_reload_for_role_include 339 | 340 | 341 | ## [0.6.7] - 2018-01-14 342 | **Merged pull requests:** 343 | 344 | - custom dockerfiles; support more OSes ([#21](https://github.com/cloudalchemy/ansible-node-exporter/issues/21)) 345 | 346 | 347 | ## [0.6.6] - 2018-01-13 348 | **Merged pull requests:** 349 | 350 | - Add preflight checks ([#22](https://github.com/cloudalchemy/ansible-node-exporter/issues/22)) 351 | 352 | 353 | ## [0.6.5] - 2018-01-13 354 | **Merged pull requests:** 355 | 356 | - Merge pull request [#20](https://github.com/cloudalchemy/ansible-node-exporter/issues/20) from cloudalchemy/paulfantom-patch-1 357 | 358 | 359 | ## [0.6.4] - 2018-01-09 360 | **Merged pull requests:** 361 | 362 | - Merge pull request [#19](https://github.com/cloudalchemy/ansible-node-exporter/issues/19) from cloudalchemy/issue17 363 | 364 | 365 | ## [0.6.3] - 2018-01-08 366 | 367 | ## [0.6.2] - 2018-01-06 368 | **Merged pull requests:** 369 | 370 | - Merge pull request [#15](https://github.com/cloudalchemy/ansible-node-exporter/issues/15) from cloudalchemy/minor_fix 371 | 372 | 373 | ## [0.6.1] - 2018-01-04 374 | **Merged pull requests:** 375 | 376 | - Merge pull request [#14](https://github.com/cloudalchemy/ansible-node-exporter/issues/14) from cloudalchemy/paulfantom-patch-1 377 | - Merge pull request [#13](https://github.com/cloudalchemy/ansible-node-exporter/issues/13) from cloudalchemy/docs 378 | 379 | 380 | ## [0.6.0] - 2018-01-02 381 | **Merged pull requests:** 382 | 383 | - Merge pull request [#12](https://github.com/cloudalchemy/ansible-node-exporter/issues/12) from cloudalchemy/paulfantom-patch-1 384 | 385 | 386 | ## [0.5.11] - 2018-01-02 387 | **Merged pull requests:** 388 | 389 | - Merge pull request [#11](https://github.com/cloudalchemy/ansible-node-exporter/issues/11) from cloudalchemy/raspberrypi 390 | 391 | 392 | ## [0.5.10] - 2018-01-01 393 | **Merged pull requests:** 394 | 395 | - Merge pull request [#10](https://github.com/cloudalchemy/ansible-node-exporter/issues/10) from cloudalchemy/disabled_collectors 396 | 397 | 398 | ## [0.5.9] - 2017-12-27 399 | **Merged pull requests:** 400 | 401 | - Merge pull request [#9](https://github.com/cloudalchemy/ansible-node-exporter/issues/9) from anisse/patch-1 402 | 403 | 404 | ## [0.5.8] - 2017-12-27 405 | **Merged pull requests:** 406 | 407 | - Merge pull request [#8](https://github.com/cloudalchemy/ansible-node-exporter/issues/8) from anisse/patch-3 408 | 409 | 410 | ## [0.5.7] - 2017-12-15 411 | **Merged pull requests:** 412 | 413 | - Merge pull request [#6](https://github.com/cloudalchemy/ansible-node-exporter/issues/6) from cloudalchemy/go_arch 414 | - Merge pull request [#7](https://github.com/cloudalchemy/ansible-node-exporter/issues/7) from cloudalchemy/version 415 | 416 | 417 | ## [0.5.6] - 2017-12-06 418 | **Merged pull requests:** 419 | 420 | - Merge pull request [#4](https://github.com/cloudalchemy/ansible-node-exporter/issues/4) from cloudalchemy/paulfantom-patch-1 421 | 422 | 423 | ## [0.5.5] - 2017-11-30 424 | 425 | ## [0.5.4] - 2017-11-30 426 | 427 | ## [0.5.3] - 2017-11-29 428 | **Merged pull requests:** 429 | 430 | - Merge pull request [#1](https://github.com/cloudalchemy/ansible-node-exporter/issues/1) from cloudalchemy/ci 431 | 432 | 433 | ## [0.5.1] - 2017-11-09 434 | **Merged pull requests:** 435 | 436 | - Merge pull request [#10](https://github.com/cloudalchemy/ansible-node-exporter/issues/10) from SoInteractive/version_upgrade 437 | 438 | 439 | ## [0.5.0] - 2017-10-16 440 | **Merged pull requests:** 441 | 442 | - Merge pull request [#9](https://github.com/cloudalchemy/ansible-node-exporter/issues/9) from SoInteractive/feature_travis 443 | 444 | 445 | ## [0.4.3] - 2017-10-12 446 | **Merged pull requests:** 447 | 448 | - Merge pull request [#8](https://github.com/cloudalchemy/ansible-node-exporter/issues/8) from SoInteractive/Add_selinux 449 | 450 | 451 | ## [0.4.2] - 2017-10-05 452 | **Merged pull requests:** 453 | 454 | - Merge pull request [#7](https://github.com/cloudalchemy/ansible-node-exporter/issues/7) from SoInteractive/systemd 455 | 456 | 457 | ## [0.4.1] - 2017-09-26 458 | **Merged pull requests:** 459 | 460 | - Merge pull request [#6](https://github.com/cloudalchemy/ansible-node-exporter/issues/6) from SoInteractive/fix_typo 461 | 462 | 463 | ## [0.4.0] - 2017-09-20 464 | **Merged pull requests:** 465 | 466 | - Merge pull request [#5](https://github.com/cloudalchemy/ansible-node-exporter/issues/5) from paulfantom/feature_installation 467 | 468 | 469 | ## [0.3.3] - 2017-08-09 470 | 471 | ## [0.3.4] - 2017-08-09 472 | **Merged pull requests:** 473 | 474 | - Merge pull request [#4](https://github.com/cloudalchemy/ansible-node-exporter/issues/4) from SoInteractive/testing_branch 475 | 476 | 477 | ## [0.3.2] - 2017-07-26 478 | 479 | ## [0.3.1] - 2017-07-26 480 | **Merged pull requests:** 481 | 482 | - Merge pull request [#3](https://github.com/cloudalchemy/ansible-node-exporter/issues/3) from SoInteractive/fix_user_uid 483 | 484 | 485 | ## [0.3.0] - 2017-07-21 486 | 487 | ## [0.2.0] - 2017-07-21 488 | **Merged pull requests:** 489 | 490 | - Merge pull request [#2](https://github.com/cloudalchemy/ansible-node-exporter/issues/2) from SoInteractive/feature_autoupdate_minor 491 | 492 | 493 | ## [0.1.2] - 2017-06-14 494 | 495 | ## [0.1.1] - 2017-06-14 496 | 497 | ## [0.1.0] - 2017-06-06 498 | 499 | ## [0.0.2] - 2017-05-18 500 | 501 | ## 0.0.1 - 2017-05-04 502 | 503 | [Unreleased]: https://github.com/cloudalchemy/ansible-node-exporter/compare/2.0.0...HEAD 504 | [2.0.0]: https://github.com/cloudalchemy/ansible-node-exporter/compare/1.0.0...2.0.0 505 | [1.0.0]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.22.0...1.0.0 506 | [0.22.0]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.21.5...0.22.0 507 | [0.21.5]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.21.4...0.21.5 508 | [0.21.4]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.21.3...0.21.4 509 | [0.21.3]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.21.2...0.21.3 510 | [0.21.2]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.21.1...0.21.2 511 | [0.21.1]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.21.0...0.21.1 512 | [0.21.0]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.20.0...0.21.0 513 | [0.20.0]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.19.0...0.20.0 514 | [0.19.0]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.18.0...0.19.0 515 | [0.18.0]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.17.0...0.18.0 516 | [0.17.0]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.16.0...0.17.0 517 | [0.16.0]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.15.0...0.16.0 518 | [0.15.0]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.14.0...0.15.0 519 | [0.14.0]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.13.1...0.14.0 520 | [0.13.1]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.13.0...0.13.1 521 | [0.13.0]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.12.1...0.13.0 522 | [0.12.1]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.12.0...0.12.1 523 | [0.12.0]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.11.4...0.12.0 524 | [0.11.4]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.11.3...0.11.4 525 | [0.11.3]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.11.2...0.11.3 526 | [0.11.2]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.11.1...0.11.2 527 | [0.11.1]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.11.0...0.11.1 528 | [0.11.0]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.10.2...0.11.0 529 | [0.10.2]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.10.1...0.10.2 530 | [0.10.1]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.10.0...0.10.1 531 | [0.10.0]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.9.0...0.10.0 532 | [0.9.0]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.8.0...0.9.0 533 | [0.8.0]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.7.0...0.8.0 534 | [0.7.0]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.6.20...0.7.0 535 | [0.6.20]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.6.19...0.6.20 536 | [0.6.19]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.6.18...0.6.19 537 | [0.6.18]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.6.17...0.6.18 538 | [0.6.17]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.6.16...0.6.17 539 | [0.6.16]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.6.15...0.6.16 540 | [0.6.15]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.6.14...0.6.15 541 | [0.6.14]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.6.13...0.6.14 542 | [0.6.13]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.6.12...0.6.13 543 | [0.6.12]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.6.11...0.6.12 544 | [0.6.11]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.6.10...0.6.11 545 | [0.6.10]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.6.9...0.6.10 546 | [0.6.9]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.6.8...0.6.9 547 | [0.6.8]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.6.7...0.6.8 548 | [0.6.7]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.6.6...0.6.7 549 | [0.6.6]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.6.5...0.6.6 550 | [0.6.5]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.6.4...0.6.5 551 | [0.6.4]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.6.3...0.6.4 552 | [0.6.3]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.6.2...0.6.3 553 | [0.6.2]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.6.1...0.6.2 554 | [0.6.1]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.6.0...0.6.1 555 | [0.6.0]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.5.11...0.6.0 556 | [0.5.11]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.5.10...0.5.11 557 | [0.5.10]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.5.9...0.5.10 558 | [0.5.9]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.5.8...0.5.9 559 | [0.5.8]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.5.7...0.5.8 560 | [0.5.7]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.5.6...0.5.7 561 | [0.5.6]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.5.5...0.5.6 562 | [0.5.5]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.5.4...0.5.5 563 | [0.5.4]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.5.3...0.5.4 564 | [0.5.3]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.5.1...0.5.3 565 | [0.5.1]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.5.0...0.5.1 566 | [0.5.0]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.4.3...0.5.0 567 | [0.4.3]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.4.2...0.4.3 568 | [0.4.2]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.4.1...0.4.2 569 | [0.4.1]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.4.0...0.4.1 570 | [0.4.0]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.3.3...0.4.0 571 | [0.3.3]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.3.4...0.3.3 572 | [0.3.4]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.3.2...0.3.4 573 | [0.3.2]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.3.1...0.3.2 574 | [0.3.1]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.3.0...0.3.1 575 | [0.3.0]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.2.0...0.3.0 576 | [0.2.0]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.1.2...0.2.0 577 | [0.1.2]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.1.1...0.1.2 578 | [0.1.1]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.1.0...0.1.1 579 | [0.1.0]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.0.2...0.1.0 580 | [0.0.2]: https://github.com/cloudalchemy/ansible-node-exporter/compare/0.0.1...0.0.2 581 | -------------------------------------------------------------------------------- /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 and Roman Demachkovych 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 | # DEPRECATED 2 | 3 | **This role has been deprecated in favor of a the [prometheus-community/ansible](https://github.com/prometheus-community/ansible) collection.** 4 | 5 | # Ansible Role: node exporter 6 | 7 | [![License](https://img.shields.io/badge/license-MIT%20License-brightgreen.svg)](https://opensource.org/licenses/MIT) 8 | [![Ansible Role](https://img.shields.io/badge/ansible%20role-cloudalchemy.node_exporter-blue.svg)](https://galaxy.ansible.com/cloudalchemy/node_exporter/) 9 | [![GitHub tag](https://img.shields.io/github/tag/cloudalchemy/ansible-node-exporter.svg)](https://github.com/cloudalchemy/ansible-node-exporter/tags) 10 | 11 | ## Warning 12 | 13 | Due to limitations of galaxy.ansible.com we had to move the role to https://galaxy.ansible.com/cloudalchemy/node_exporter and use `_` instead of `-` in role name. This is a breaking change and unfortunately, it affects all versions of node_exporter role as ansible galaxy doesn't offer any form of redirection. We are sorry for the inconvenience. 14 | 15 | ## Description 16 | 17 | Deploy prometheus [node exporter](https://github.com/prometheus/node_exporter) using ansible. 18 | 19 | ## Requirements 20 | 21 | - Ansible >= 2.7 (It might work on previous versions, but we cannot guarantee it) 22 | - gnu-tar on Mac deployer host (`brew install gnu-tar`) 23 | - Passlib is required when using the basic authentication feature (`pip install passlib[bcrypt]`) 24 | 25 | ## Role Variables 26 | 27 | All variables which can be overridden are stored in [defaults/main.yml](defaults/main.yml) and are listed in the table below. 28 | 29 | | Name | Default Value | Description | 30 | | -------------- | ------------- | -----------------------------------| 31 | | `node_exporter_version` | 1.1.2 | Node exporter package version. Also accepts latest as parameter. | 32 | | `node_exporter_binary_local_dir` | "" | Enables the use of local packages instead of those distributed on github. The parameter may be set to a directory where the `node_exporter` binary is stored on the host where ansible is run. This overrides the `node_exporter_version` parameter | 33 | | `node_exporter_web_listen_address` | "0.0.0.0:9100" | Address on which node exporter will listen | 34 | | `node_exporter_web_telemetry_path` | "/metrics" | Path under which to expose metrics | 35 | | `node_exporter_enabled_collectors` | ```["systemd",{textfile: {directory: "{{node_exporter_textfile_dir}}"}}]``` | List of dicts defining additionally enabled collectors and their configuration. It adds collectors to [those enabled by default](https://github.com/prometheus/node_exporter#enabled-by-default). | 36 | | `node_exporter_disabled_collectors` | [] | List of disabled collectors. By default node_exporter disables collectors listed [here](https://github.com/prometheus/node_exporter#disabled-by-default). | 37 | | `node_exporter_textfile_dir` | "/var/lib/node_exporter" | Directory used by the [Textfile Collector](https://github.com/prometheus/node_exporter#textfile-collector). To get permissions to write metrics in this directory, users must be in `node-exp` system group. __Note__: More information in TROUBLESHOOTING.md guide. 38 | | `node_exporter_tls_server_config` | {} | Configuration for TLS authentication. Keys and values are the same as in [node_exporter docs](https://github.com/prometheus/node_exporter/blob/master/https/README.md#sample-config). | 39 | | `node_exporter_http_server_config` | {} | Config for HTTP/2 support. Keys and values are the same as in [node_exporter docs](https://github.com/prometheus/node_exporter/blob/master/https/README.md#sample-config). | 40 | | `node_exporter_basic_auth_users` | {} | Dictionary of users and password for basic authentication. Passwords are automatically hashed with bcrypt. | 41 | 42 | ## Example 43 | 44 | ### Playbook 45 | 46 | Use it in a playbook as follows: 47 | ```yaml 48 | - hosts: all 49 | roles: 50 | - cloudalchemy.node_exporter 51 | ``` 52 | 53 | ### TLS config 54 | 55 | Before running node_exporter role, the user needs to provision their own certificate and key. 56 | ```yaml 57 | - hosts: all 58 | pre_tasks: 59 | - name: Create node_exporter cert dir 60 | file: 61 | path: "/etc/node_exporter" 62 | state: directory 63 | owner: root 64 | group: root 65 | 66 | - name: Create cert and key 67 | openssl_certificate: 68 | path: /etc/node_exporter/tls.cert 69 | csr_path: /etc/node_exporter/tls.csr 70 | privatekey_path: /etc/node_exporter/tls.key 71 | provider: selfsigned 72 | roles: 73 | - cloudalchemy.node_exporter 74 | vars: 75 | node_exporter_tls_server_config: 76 | cert_file: /etc/node_exporter/tls.cert 77 | key_file: /etc/node_exporter/tls.key 78 | node_exporter_basic_auth_users: 79 | randomuser: examplepassword 80 | ``` 81 | 82 | 83 | ### Demo site 84 | 85 | We provide an example site that demonstrates a full monitoring solution based on prometheus and grafana. The repository with code and links to running instances is [available on github](https://github.com/cloudalchemy/demo-site) and the site is hosted on [DigitalOcean](https://digitalocean.com). 86 | 87 | ## Local Testing 88 | 89 | 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 for your system. Running your tests is as simple as executing `molecule test`. 90 | 91 | ## Continuous Integration 92 | 93 | 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 quite a large test matrix which can take more time than local testing, so please be patient. 94 | 95 | ## Contributing 96 | 97 | See [contributor guideline](CONTRIBUTING.md). 98 | 99 | ## Troubleshooting 100 | 101 | See [troubleshooting](TROUBLESHOOTING.md). 102 | 103 | ## License 104 | 105 | This project is licensed under MIT License. See [LICENSE](/LICENSE) for more details. 106 | -------------------------------------------------------------------------------- /TROUBLESHOOTING.md: -------------------------------------------------------------------------------- 1 | # Troubleshooting 2 | 3 | ## Bad requests (HTTP 400) 4 | 5 | This role downloads checksums from the Github project to verify the integrity of artifacts installed on your servers. When downloading the checksums, a "bad request" error might occur. 6 | 7 | This happens in environments which (knowningly or unknowling) use the [netrc mechanism](https://www.gnu.org/software/inetutils/manual/html_node/The-_002enetrc-file.html) to auto-login into servers. 8 | 9 | Unless netrc is needed by your playbook and ansible roles, please unset the var like so: 10 | 11 | ``` 12 | $ NETRC= ansible-playbook ... 13 | ``` 14 | 15 | Or: 16 | 17 | ``` 18 | $ export NETRC= 19 | $ ansible-playbook ... 20 | ``` 21 | 22 | ## node_exporter doesn't report data from textfile collector 23 | 24 | There are 3 potential issues why node_exporter doesn't pick up data: 25 | 26 | 1. Duplicated metrics across multiple files. 27 | 2. File is not readable by node_exporter process. 28 | 3. Textfile collector is not enabled. 29 | 30 | Solving first possibility is out of scope of the role as data is created somewhere else. When creating that data ensure 31 | files are readable by `node-exp` user. To get access to the directory with files your process needs to be in `node-exp` 32 | group. 33 | 34 | Lastly ansible role misconfiguration can also lead to data not being picked up. Check if `node_exporter` textfile 35 | collector is enabled in `node_exporter_enabled_collectors` as follows: 36 | 37 | ```yaml 38 | node_exporter_enabled_collectors: 39 | - textfile: 40 | directory: "{{ node_exporter_textfile_dir }}" 41 | ``` 42 | 43 | __note___: `node_exporter_textfile_dir` variable is only responsible for creating a directory not enabling a collector. 44 | -------------------------------------------------------------------------------- /defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | node_exporter_version: 1.1.2 3 | node_exporter_binary_local_dir: "" 4 | node_exporter_web_listen_address: "0.0.0.0:9100" 5 | node_exporter_web_telemetry_path: "/metrics" 6 | 7 | node_exporter_textfile_dir: "/var/lib/node_exporter" 8 | 9 | node_exporter_tls_server_config: {} 10 | 11 | node_exporter_http_server_config: {} 12 | 13 | node_exporter_basic_auth_users: {} 14 | 15 | node_exporter_enabled_collectors: 16 | - systemd 17 | - textfile: 18 | directory: "{{ node_exporter_textfile_dir }}" 19 | # - filesystem: 20 | # ignored-mount-points: "^/(sys|proc|dev)($|/)" 21 | # ignored-fs-types: "^(sys|proc|auto)fs$" 22 | 23 | node_exporter_disabled_collectors: [] 24 | 25 | # Internal variables. 26 | _node_exporter_binary_install_dir: "/usr/local/bin" 27 | _node_exporter_system_group: "node-exp" 28 | _node_exporter_system_user: "{{ _node_exporter_system_group }}" 29 | -------------------------------------------------------------------------------- /handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: restart node_exporter 3 | become: true 4 | systemd: 5 | daemon_reload: true 6 | name: node_exporter 7 | state: restarted 8 | when: 9 | - not ansible_check_mode 10 | -------------------------------------------------------------------------------- /meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | galaxy_info: 3 | author: cloudalchemy 4 | role_name: node_exporter 5 | description: Prometheus Node Exporter 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 | - exporter 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 | - cloudalchemy.node_exporter 7 | pre_tasks: 8 | - name: Create node_exporter cert dir 9 | file: 10 | path: "{{ node_exporter_tls_server_config.cert_file | dirname }}" 11 | state: directory 12 | owner: root 13 | group: root 14 | - name: Copy cert and key 15 | copy: 16 | src: "{{ item.src }}" 17 | dest: "{{ item.dest }}" 18 | with_items: 19 | - src: "/tmp/tls.cert" 20 | dest: "{{ node_exporter_tls_server_config.cert_file }}" 21 | - src: "/tmp/tls.key" 22 | dest: "{{ node_exporter_tls_server_config.key_file }}" 23 | vars: 24 | node_exporter_binary_local_dir: "/tmp/node_exporter-linux-amd64" 25 | node_exporter_web_listen_address: "127.0.0.1:8080" 26 | node_exporter_textfile_dir: "" 27 | node_exporter_enabled_collectors: 28 | - entropy 29 | node_exporter_disabled_collectors: 30 | - diskstats 31 | 32 | node_exporter_tls_server_config: 33 | cert_file: /etc/node_exporter/tls.cert 34 | key_file: /etc/node_exporter/tls.key 35 | node_exporter_http_server_config: 36 | http2: true 37 | node_exporter_basic_auth_users: 38 | randomuser: examplepassword 39 | -------------------------------------------------------------------------------- /molecule/alternative/prepare.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Prepare 3 | hosts: localhost 4 | gather_facts: false 5 | vars: 6 | go_arch: amd64 7 | node_exporter_version: 1.0.0 8 | tasks: 9 | - name: Download node_exporter binary to local folder 10 | become: false 11 | get_url: 12 | url: "https://github.com/prometheus/node_exporter/releases/download/v{{ node_exporter_version }}/node_exporter-{{ node_exporter_version }}.linux-{{ go_arch }}.tar.gz" 13 | dest: "/tmp/node_exporter-{{ node_exporter_version }}.linux-{{ go_arch }}.tar.gz" 14 | register: _download_binary 15 | until: _download_binary is succeeded 16 | retries: 5 17 | delay: 2 18 | run_once: true 19 | check_mode: false 20 | 21 | - name: Unpack node_exporter binary 22 | become: false 23 | unarchive: 24 | src: "/tmp/node_exporter-{{ node_exporter_version }}.linux-{{ go_arch }}.tar.gz" 25 | dest: "/tmp" 26 | creates: "/tmp/node_exporter-{{ node_exporter_version }}.linux-{{ go_arch }}/node_exporter" 27 | run_once: true 28 | check_mode: false 29 | 30 | - name: link to node_exporter binaries directory 31 | become: false 32 | file: 33 | src: "/tmp/node_exporter-{{ node_exporter_version }}.linux-amd64" 34 | dest: "/tmp/node_exporter-linux-amd64" 35 | state: link 36 | run_once: true 37 | check_mode: false 38 | 39 | - name: install pyOpenSSL for certificate generation 40 | pip: 41 | name: "pyOpenSSL" 42 | 43 | - name: Create private key 44 | openssl_privatekey: 45 | path: "/tmp/tls.key" 46 | 47 | - name: Create CSR 48 | openssl_csr: 49 | path: "/tmp/tls.csr" 50 | privatekey_path: "/tmp/tls.key" 51 | 52 | - name: Create certificate 53 | openssl_certificate: 54 | path: "/tmp/tls.cert" 55 | csr_path: "/tmp/tls.csr" 56 | privatekey_path: "/tmp/tls.key" 57 | provider: selfsigned 58 | -------------------------------------------------------------------------------- /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/node_exporter" 11 | ] 12 | for dir in dirs: 13 | d = host.file(dir) 14 | assert not d.exists 15 | 16 | 17 | def test_service(host): 18 | s = host.service("node_exporter") 19 | # assert s.is_enabled 20 | assert s.is_running 21 | 22 | 23 | def test_socket(host): 24 | sockets = [ 25 | "tcp://127.0.0.1:8080" 26 | ] 27 | for socket in sockets: 28 | s = host.socket(socket) 29 | assert s.is_listening 30 | -------------------------------------------------------------------------------- /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 | - hosts: all 3 | any_errors_fatal: true 4 | roles: 5 | - cloudalchemy.node_exporter 6 | vars: 7 | node_exporter_web_listen_address: "127.0.0.1:9100" 8 | -------------------------------------------------------------------------------- /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/node_exporter" 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/node_exporter.service", 21 | "/usr/local/bin/node_exporter" 22 | ] 23 | for file in files: 24 | f = host.file(file) 25 | assert f.exists 26 | assert f.is_file 27 | 28 | 29 | def test_permissions_didnt_change(host): 30 | dirs = [ 31 | "/etc", 32 | "/root", 33 | "/usr", 34 | "/var" 35 | ] 36 | for file in dirs: 37 | f = host.file(file) 38 | assert f.exists 39 | assert f.is_directory 40 | assert f.user == "root" 41 | assert f.group == "root" 42 | 43 | 44 | def test_user(host): 45 | assert host.group("node-exp").exists 46 | assert "node-exp" in host.user("node-exp").groups 47 | assert host.user("node-exp").shell == "/usr/sbin/nologin" 48 | assert host.user("node-exp").home == "/" 49 | 50 | 51 | def test_service(host): 52 | s = host.service("node_exporter") 53 | # assert s.is_enabled 54 | assert s.is_running 55 | 56 | 57 | def test_socket(host): 58 | sockets = [ 59 | "tcp://127.0.0.1:9100" 60 | ] 61 | for socket in sockets: 62 | s = host.socket(socket) 63 | assert s.is_listening 64 | -------------------------------------------------------------------------------- /molecule/latest/molecule.yml: -------------------------------------------------------------------------------- 1 | --- 2 | dependency: 3 | name: galaxy 4 | driver: 5 | name: docker 6 | platforms: 7 | - name: buster 8 | pre_build_image: true 9 | image: quay.io/paulfantom/molecule-systemd:debian-10 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: fedora 15 | pre_build_image: true 16 | image: quay.io/paulfantom/molecule-systemd:fedora-30 17 | docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" 18 | privileged: true 19 | volumes: 20 | - /sys/fs/cgroup:/sys/fs/cgroup:ro 21 | groups: 22 | - python3 23 | provisioner: 24 | name: ansible 25 | playbooks: 26 | create: ../default/create.yml 27 | prepare: ../default/prepare.yml 28 | converge: playbook.yml 29 | destroy: ../default/destroy.yml 30 | inventory: 31 | group_vars: 32 | python3: 33 | ansible_python_interpreter: /usr/bin/python3 34 | verifier: 35 | name: testinfra 36 | -------------------------------------------------------------------------------- /molecule/latest/playbook.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Run role 3 | hosts: all 4 | any_errors_fatal: true 5 | roles: 6 | - cloudalchemy.node_exporter 7 | vars: 8 | node_exporter_version: latest 9 | -------------------------------------------------------------------------------- /molecule/latest/tests/test_alternative.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | import os 3 | import testinfra.utils.ansible_runner 4 | 5 | testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( 6 | os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') 7 | 8 | 9 | @pytest.mark.parametrize("files", [ 10 | "/etc/systemd/system/node_exporter.service", 11 | "/usr/local/bin/node_exporter" 12 | ]) 13 | def test_files(host, files): 14 | f = host.file(files) 15 | assert f.exists 16 | assert f.is_file 17 | 18 | 19 | def test_service(host): 20 | s = host.service("node_exporter") 21 | # assert s.is_enabled 22 | assert s.is_running 23 | 24 | 25 | def test_socket(host): 26 | s = host.socket("tcp://0.0.0.0:9100") 27 | assert s.is_listening 28 | -------------------------------------------------------------------------------- /tasks/configure.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Copy the node_exporter systemd service file 3 | template: 4 | src: node_exporter.service.j2 5 | dest: /etc/systemd/system/node_exporter.service 6 | owner: root 7 | group: root 8 | mode: 0644 9 | notify: restart node_exporter 10 | 11 | - block: 12 | - name: Create node_exporter config directory 13 | file: 14 | path: "/etc/node_exporter" 15 | state: directory 16 | owner: root 17 | group: root 18 | mode: u+rwX,g+rwX,o=rX 19 | 20 | - name: Copy the node_exporter config file 21 | template: 22 | src: config.yaml.j2 23 | dest: /etc/node_exporter/config.yaml 24 | owner: root 25 | group: root 26 | mode: 0644 27 | notify: restart node_exporter 28 | when: 29 | ( node_exporter_tls_server_config | length > 0 ) or 30 | ( node_exporter_http_server_config | length > 0 ) or 31 | ( node_exporter_basic_auth_users | length > 0 ) 32 | 33 | - name: Create textfile collector dir 34 | file: 35 | path: "{{ node_exporter_textfile_dir }}" 36 | state: directory 37 | owner: "{{ _node_exporter_system_user }}" 38 | group: "{{ _node_exporter_system_group }}" 39 | recurse: true 40 | mode: u+rwX,g+rwX,o=rX 41 | when: node_exporter_textfile_dir | length > 0 42 | 43 | - name: Allow node_exporter port in SELinux on RedHat OS family 44 | seport: 45 | ports: "{{ node_exporter_web_listen_address.split(':')[-1] }}" 46 | proto: tcp 47 | setype: http_port_t 48 | state: present 49 | when: 50 | - ansible_version.full is version_compare('2.4', '>=') 51 | - ansible_selinux.status == "enabled" 52 | -------------------------------------------------------------------------------- /tasks/install.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Create the node_exporter group 3 | group: 4 | name: "{{ _node_exporter_system_group }}" 5 | state: present 6 | system: true 7 | when: _node_exporter_system_group != "root" 8 | 9 | - name: Create the node_exporter user 10 | user: 11 | name: "{{ _node_exporter_system_user }}" 12 | groups: "{{ _node_exporter_system_group }}" 13 | append: true 14 | shell: /usr/sbin/nologin 15 | system: true 16 | create_home: false 17 | home: / 18 | when: _node_exporter_system_user != "root" 19 | 20 | - block: 21 | - name: Download node_exporter binary to local folder 22 | become: false 23 | get_url: 24 | url: "https://github.com/prometheus/node_exporter/releases/download/v{{ node_exporter_version }}/node_exporter-{{ node_exporter_version }}.linux-{{ go_arch }}.tar.gz" 25 | dest: "/tmp/node_exporter-{{ node_exporter_version }}.linux-{{ go_arch }}.tar.gz" 26 | checksum: "sha256:{{ node_exporter_checksum }}" 27 | mode: '0644' 28 | register: _download_binary 29 | until: _download_binary is succeeded 30 | retries: 5 31 | delay: 2 32 | delegate_to: localhost 33 | check_mode: false 34 | 35 | - name: Unpack node_exporter binary 36 | become: false 37 | unarchive: 38 | src: "/tmp/node_exporter-{{ node_exporter_version }}.linux-{{ go_arch }}.tar.gz" 39 | dest: "/tmp" 40 | creates: "/tmp/node_exporter-{{ node_exporter_version }}.linux-{{ go_arch }}/node_exporter" 41 | delegate_to: localhost 42 | check_mode: false 43 | 44 | - name: Propagate node_exporter binaries 45 | copy: 46 | src: "/tmp/node_exporter-{{ node_exporter_version }}.linux-{{ go_arch }}/node_exporter" 47 | dest: "{{ _node_exporter_binary_install_dir }}/node_exporter" 48 | mode: 0755 49 | owner: root 50 | group: root 51 | notify: restart node_exporter 52 | when: not ansible_check_mode 53 | when: node_exporter_binary_local_dir | length == 0 54 | 55 | - name: propagate locally distributed node_exporter binary 56 | copy: 57 | src: "{{ node_exporter_binary_local_dir }}/node_exporter" 58 | dest: "{{ _node_exporter_binary_install_dir }}/node_exporter" 59 | mode: 0755 60 | owner: root 61 | group: root 62 | when: node_exporter_binary_local_dir | length > 0 63 | notify: restart node_exporter 64 | -------------------------------------------------------------------------------- /tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - import_tasks: preflight.yml 3 | tags: 4 | - node_exporter_install 5 | - node_exporter_configure 6 | - node_exporter_run 7 | 8 | - import_tasks: install.yml 9 | become: true 10 | when: 11 | ( not __node_exporter_is_installed.stat.exists ) or 12 | ( (__node_exporter_current_version_output.stderr_lines | length > 0) and (__node_exporter_current_version_output.stderr_lines[0].split(" ")[2] != node_exporter_version) ) or 13 | ( (__node_exporter_current_version_output.stdout_lines | length > 0) and (__node_exporter_current_version_output.stdout_lines[0].split(" ")[2] != node_exporter_version) ) or 14 | ( node_exporter_binary_local_dir | length > 0 ) 15 | tags: 16 | - node_exporter_install 17 | 18 | - import_tasks: selinux.yml 19 | become: true 20 | when: ansible_selinux.status == "enabled" 21 | tags: 22 | - node_exporter_configure 23 | 24 | - import_tasks: configure.yml 25 | become: true 26 | tags: 27 | - node_exporter_configure 28 | 29 | - name: Ensure Node Exporter is enabled on boot 30 | become: true 31 | systemd: 32 | daemon_reload: true 33 | name: node_exporter 34 | enabled: true 35 | state: started 36 | when: 37 | - not ansible_check_mode 38 | tags: 39 | - node_exporter_run 40 | -------------------------------------------------------------------------------- /tasks/preflight.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Assert usage of systemd as an init system 3 | assert: 4 | that: ansible_service_mgr == 'systemd' 5 | msg: "This role only works with systemd" 6 | 7 | - name: Get systemd version 8 | command: systemctl --version 9 | changed_when: false 10 | check_mode: false 11 | register: __systemd_version 12 | tags: 13 | - skip_ansible_lint 14 | 15 | - name: Set systemd version fact 16 | set_fact: 17 | node_exporter_systemd_version: "{{ __systemd_version.stdout_lines[0] | regex_replace('^systemd\\s(\\d+).*$', '\\1') }}" 18 | 19 | - name: Naive assertion of proper listen address 20 | assert: 21 | that: 22 | - "':' in node_exporter_web_listen_address" 23 | 24 | - name: Assert collectors are not both disabled and enabled at the same time 25 | assert: 26 | that: 27 | - "item not in node_exporter_enabled_collectors" 28 | with_items: "{{ node_exporter_disabled_collectors }}" 29 | 30 | - block: 31 | - name: Assert that TLS key and cert path are set 32 | assert: 33 | that: 34 | - "node_exporter_tls_server_config.cert_file is defined" 35 | - "node_exporter_tls_server_config.key_file is defined" 36 | 37 | - name: Check existence of TLS cert file 38 | stat: 39 | path: "{{ node_exporter_tls_server_config.cert_file }}" 40 | register: __node_exporter_cert_file 41 | 42 | - name: Check existence of TLS key file 43 | stat: 44 | path: "{{ node_exporter_tls_server_config.key_file }}" 45 | register: __node_exporter_key_file 46 | 47 | - name: Assert that TLS key and cert are present 48 | assert: 49 | that: 50 | - "{{ __node_exporter_cert_file.stat.exists }}" 51 | - "{{ __node_exporter_key_file.stat.exists }}" 52 | when: node_exporter_tls_server_config | length > 0 53 | 54 | - name: Check if node_exporter is installed 55 | stat: 56 | path: "{{ _node_exporter_binary_install_dir }}/node_exporter" 57 | register: __node_exporter_is_installed 58 | check_mode: false 59 | tags: 60 | - node_exporter_install 61 | 62 | - name: Gather currently installed node_exporter version (if any) 63 | command: "{{ _node_exporter_binary_install_dir }}/node_exporter --version" 64 | args: 65 | warn: false 66 | changed_when: false 67 | register: __node_exporter_current_version_output 68 | check_mode: false 69 | when: __node_exporter_is_installed.stat.exists 70 | tags: 71 | - node_exporter_install 72 | - skip_ansible_lint 73 | 74 | - block: 75 | - name: Get latest release 76 | uri: 77 | url: "https://api.github.com/repos/prometheus/node_exporter/releases/latest" 78 | method: GET 79 | return_content: true 80 | status_code: 200 81 | body_format: json 82 | user: "{{ lookup('env', 'GH_USER') | default(omit) }}" 83 | password: "{{ lookup('env', 'GH_TOKEN') | default(omit) }}" 84 | no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" 85 | register: _latest_release 86 | until: _latest_release.status == 200 87 | retries: 5 88 | 89 | - name: "Set node_exporter version to {{ _latest_release.json.tag_name[1:] }}" 90 | set_fact: 91 | node_exporter_version: "{{ _latest_release.json.tag_name[1:] }}" 92 | when: 93 | - node_exporter_version == "latest" 94 | - node_exporter_binary_local_dir | length == 0 95 | delegate_to: localhost 96 | run_once: true 97 | 98 | - block: 99 | - name: Get checksum list from github 100 | set_fact: 101 | _checksums: "{{ lookup('url', 'https://github.com/prometheus/node_exporter/releases/download/v' + node_exporter_version + '/sha256sums.txt', wantlist=True) | list }}" 102 | run_once: true 103 | 104 | - name: "Get checksum for {{ go_arch }} architecture" 105 | set_fact: 106 | node_exporter_checksum: "{{ item.split(' ')[0] }}" 107 | with_items: "{{ _checksums }}" 108 | when: 109 | - "('linux-' + go_arch + '.tar.gz') in item" 110 | delegate_to: localhost 111 | when: node_exporter_binary_local_dir | length == 0 112 | -------------------------------------------------------------------------------- /tasks/selinux.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Install selinux python packages [RHEL] 3 | package: 4 | name: 5 | - "{{ ( (ansible_facts.distribution_major_version | int) < 8) | ternary('libselinux-python','python3-libselinux') }}" 6 | - "{{ ( (ansible_facts.distribution_major_version | int) < 8) | ternary('policycoreutils-python','python3-policycoreutils') }}" 7 | state: present 8 | register: _install_selinux_packages 9 | until: _install_selinux_packages is success 10 | retries: 5 11 | delay: 2 12 | when: 13 | - (ansible_distribution | lower == "redhat") or 14 | (ansible_distribution | lower == "centos") 15 | 16 | - name: Install selinux python packages [Fedora] 17 | package: 18 | name: 19 | - "{{ ( (ansible_facts.distribution_major_version | int) < 29) | ternary('libselinux-python','python3-libselinux') }}" 20 | - "{{ ( (ansible_facts.distribution_major_version | int) < 29) | ternary('policycoreutils-python','python3-policycoreutils') }}" 21 | state: present 22 | register: _install_selinux_packages 23 | until: _install_selinux_packages is success 24 | retries: 5 25 | delay: 2 26 | 27 | when: 28 | - ansible_distribution | lower == "fedora" 29 | 30 | - name: Install selinux python packages [clearlinux] 31 | package: 32 | name: sysadmin-basic 33 | state: present 34 | register: _install_selinux_packages 35 | until: _install_selinux_packages is success 36 | retries: 5 37 | delay: 2 38 | when: 39 | - ansible_distribution | lower == "clearlinux" 40 | -------------------------------------------------------------------------------- /templates/config.yaml.j2: -------------------------------------------------------------------------------- 1 | --- 2 | {{ ansible_managed | comment }} 3 | {% if node_exporter_tls_server_config | length > 0 %} 4 | tls_server_config: 5 | {{ node_exporter_tls_server_config | to_nice_yaml | indent(2, true) }} 6 | {% endif %} 7 | 8 | {% if node_exporter_http_server_config | length > 0 %} 9 | http_server_config: 10 | {{ node_exporter_http_server_config | to_nice_yaml | indent(2, true) }} 11 | {% endif %} 12 | 13 | {% if node_exporter_basic_auth_users | length > 0 %} 14 | basic_auth_users: 15 | {% for k, v in node_exporter_basic_auth_users.items() %} 16 | {{ k }}: {{ v | password_hash('bcrypt', ('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890' | shuffle(seed=inventory_hostname) | join)[:22], rounds=9) }} 17 | {% endfor %} 18 | {% endif %} 19 | -------------------------------------------------------------------------------- /templates/node_exporter.service.j2: -------------------------------------------------------------------------------- 1 | {{ ansible_managed | comment }} 2 | 3 | [Unit] 4 | Description=Prometheus Node Exporter 5 | After=network-online.target 6 | 7 | [Service] 8 | Type=simple 9 | User={{ _node_exporter_system_user }} 10 | Group={{ _node_exporter_system_group }} 11 | ExecStart={{ _node_exporter_binary_install_dir }}/node_exporter \ 12 | {% for collector in node_exporter_enabled_collectors -%} 13 | {% if not collector is mapping %} 14 | --collector.{{ collector }} \ 15 | {% else -%} 16 | {% set name, options = (collector.items()|list)[0] -%} 17 | --collector.{{ name }} \ 18 | {% for k,v in options|dictsort %} 19 | --collector.{{ name }}.{{ k }}={{ v | quote }} \ 20 | {% endfor -%} 21 | {% endif -%} 22 | {% endfor -%} 23 | {% for collector in node_exporter_disabled_collectors %} 24 | --no-collector.{{ collector }} \ 25 | {% endfor %} 26 | {% if node_exporter_tls_server_config | length > 0 or node_exporter_http_server_config | length > 0 or node_exporter_basic_auth_users | length > 0 %} 27 | --web.config=/etc/node_exporter/config.yaml \ 28 | {% endif %} 29 | --web.listen-address={{ node_exporter_web_listen_address }} \ 30 | --web.telemetry-path={{ node_exporter_web_telemetry_path }} 31 | 32 | SyslogIdentifier=node_exporter 33 | Restart=always 34 | RestartSec=1 35 | StartLimitInterval=0 36 | 37 | {% for m in ansible_mounts if m.mount == '/home' %} 38 | ProtectHome=read-only 39 | {% else %} 40 | ProtectHome=yes 41 | {% endfor %} 42 | NoNewPrivileges=yes 43 | 44 | {% if node_exporter_systemd_version | int >= 232 %} 45 | ProtectSystem=strict 46 | ProtectControlGroups=true 47 | ProtectKernelModules=true 48 | ProtectKernelTunables=yes 49 | {% else %} 50 | ProtectSystem=full 51 | {% endif %} 52 | 53 | [Install] 54 | WantedBy=multi-user.target 55 | -------------------------------------------------------------------------------- /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/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 | go_arch: "{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}" 10 | --------------------------------------------------------------------------------