Secure configuration and vars

This commit is contained in:
blasebast 2026-01-18 21:50:14 +01:00
parent 2d26064da1
commit c6a6051e27
138 changed files with 1381 additions and 2820 deletions

View File

@ -1,29 +1,57 @@
# Ansible
# Ansible Configuration Management
This is personalised setup which's goals are:
- setup hotspot on n RPIs with the same SSID and password in the house, so all devices can connect to it
- start node exporter on subset of hosts
- ...
This repository contains Ansible playbooks and roles for managing my personal infrastructure.
## Main Playbooks
## How to use it
This code has encrypted inventory/host_vars, example of one is here:
```
ansible_ssh_port: [port_number]
ansible_ssh_user: [username]
hostapd_ssid: [SSID]
hostapd_channel: [channel_number]
hostapd_passphrase: [wifi_password]
### Common Configuration
Runs the main configuration playbook to manage services, packages, and system settings:
```bash
ansible-playbook -i inventory/hosts.yml playbooks/common.yml --vault-password-file=vault.pass
```
Above var files are encrypted with `vault.pass` which is added to `.gitignore` so the push doesn't leak sensitive data.
Before push you should run `bash decrypt_vars.sh`
### Node Exporter for MyCloud
Starts the Node Exporter service on the MyCloud server:
```bash
ansible-playbook -i inventory/hosts.yml -l mycloud playbooks/mycloud.node.exporter.yml --vault-password-file=vault.pass
```
### Update Hosts File
Updates the hosts file on all machines:
```bash
ansible-playbook -i inventory/hosts.yml playbooks/common.yml --tags "update_hosts"
```
## Credits:
- cloudalchemy.node-exporter https://galaxy.ansible.com/cloudalchemy/node-exporter
- interoberlin.hotspot
https://galaxy.ansible.com/interoberlin/hotspot
### Manage Cron Jobs (Debian only)
Manages cron jobs on Debian-based systems:
```bash
ansible-playbook -i inventory/hosts.yml playbooks/crons-only.yml --vault-password-file=vault.pass
```
## Encrypted Variables
Variable files in `inventory/host_vars/` are encrypted using Ansible Vault for security. The vault password is stored in `vault.pass` which is included in `.gitignore` to prevent sensitive data leaks.
### Managing Encrypted Files
- To edit encrypted files:
```bash
ansible-vault edit inventory/host_vars/example.yml --vault-password-file=vault.pass
```
- To decrypt all variables (before git operations):
```bash
bash decrypt_vars.sh
```
- To re-encrypt after making changes:
```bash
bash encrypt_vars.sh
```
## Example Host Variables
```yaml
ansible_ssh_port: 22
ansible_ssh_user: username
# Other host-specific variables
```
## Dependencies
- [cloudalchemy.node-exporter](https://galaxy.ansible.com/cloudalchemy/node-exporter)

View File

@ -12,6 +12,8 @@
# some basic default values...
#inventory = /etc/ansible/hosts
inventory = ./inventory/hosts.yml
vault_password_file = ./vault.pass
#library = /usr/share/my_modules/
#module_utils = /usr/share/my_module_utils/
#remote_tmp = ~/.ansible/tmp
@ -66,6 +68,7 @@ forks = 10
# additional paths to search for roles in, colon separated
#roles_path = /etc/ansible/roles
roles_path = ./roles
# uncomment this to disable SSH key host checking
host_key_checking = False

View File

@ -1,6 +1,15 @@
#!/bin/bash
source include.sh
for file in $(ls inventory/host_vars/*.yml); do
common::log "encrypting: ${file}"
ansible-vault encrypt ${file} --vault-password-file=vault.pass
done
# Ustawienie globa, zeby obsluzyl sytuacje gdy nie ma plikow
shopt -s nullglob
for file in inventory/host_vars/*.yml; do
# Sprawdzamy czy plik ma naglowek Vaulta. Jesli nie, szyfrujemy.
if ! grep -q "\$ANSIBLE_VAULT" "$file"; then
common::log "encrypting: ${file}"
ansible-vault encrypt "$file" --vault-password-file=vault.pass --encrypt-vault-id default
else
common::log "skipping (already encrypted): ${file}"
fi
done

View File

@ -0,0 +1,20 @@
$ANSIBLE_VAULT;1.1;AES256
34623537383639636336656131393931636633656661333132376634666533306234613631383133
6332333832373933333337613237306266373061663562650a303735663332333031373861356433
62666362376538346139393339616636373835353461643937626566313831643565366536303565
3133366538306631650a343039326434353135323136326239366661333335626264353337663931
36383035363464386336663531363638326135306339393838396530636638396665323163396437
66323533643032623062343132636633636539623737333430363063363134373230613631623330
65656466363666633639373934613965643264643362663633636465626461323433373139633732
64383131636335363838646632316262396362363139643032376235616135363165316364333865
34663864653637346166376561636663643266623134353438666665366638616130666539363333
31393034336562393736393936663334383964626339613837306437633438356237393231313038
34363163616631616461353439313637306266323635313438623064393633346265623939393734
65323830383961343937313435343865323530613332323431303365656465326366393732316231
31663066653562346333313134353961633530393034636431383265306564306239336161356661
61643130363537353236636434643361373864366135383838346539613637656566316166613164
36313138313066333430653864623265383433363833376239623631343030613236356439396131
35613536353066663161393466313131336535376565396434313334646163663862306563313333
33363932343235393832616664313030323939616163326233623364396466343638346330376538
31383030303730306438316333613138383939386136383630303238656664346662353830303937
373535313434396536336637613763356464

View File

@ -1,12 +0,0 @@
ansible_ssh_port: 22
ansible_ssh_user: root
common_hostname: asus-laptop
common_alternate_hostname: ""
common_username: seba
common_systemd_disabled_services:
- "avahi-daemon.service"
- "wpa_supplicant.service"
project_src: /home/seba/mydocker

View File

@ -1,9 +1,15 @@
---
ansible_user: "admin"
ansible_ssh_pass: "5TWRlyF7oWqEL6yOWdDW"
ansible_ssh_port: 8883
common_username: "root"
common_hostname: asustor
common_alternate_hostname: ""
common_systemd_disabled_services:
$ANSIBLE_VAULT;1.1;AES256
64383932343730333464383636653162393736623636663834306433386463366231376666373239
6336333733306636396131663564643036613338323632370a356462643535376563623138646530
63616562313232333962616566663666363539663135613866316265333438633763653031353062
3337636139303265370a646436353561313033386637306233623963326137633132353532313937
30393963376631653563313365316231343834366636316531336239386335633834663761636263
63653935326163366631653135356135643433366561356434623238663964663639653962396235
30323034326362386361646465393938633430363733656539373538316630613533616162343838
34353431313835363735303265313261643764626236663634383263646532353232636136326666
33353963663234323862616631323939323232663034616538643432326239383733363966636361
63616664376133363333393031383237346565373764343964376461633066383830636639366665
39643630393336626231356134396463383439303433643636663666613939373536636366643562
61336364636330623261653833656638666465323962393566313036363837623037636136623237
39366462626337626433393537666566616535626166396261333336366634303835656330643863
3366316539623335393135663937626166326337663930333135

View File

@ -1,13 +0,0 @@
ansible_ssh_port: 22
ansible_ssh_user: root
ftp_password: guilermo3
common_hostname: dell
common_alternate_hostname: latitude
common_username: seba
common_systemd_disabled_services:
- "avahi-daemon.service"
- "wpa_supplicant.service"
project_src: /home/seba/mydocker

View File

@ -1,13 +0,0 @@
ansible_ssh_port: 8883
ansible_ssh_user: root
ftp_password: guilermo3
common_hostname: elementary-coffee
common_alternate_hostname: elementary
common_username: seba
common_systemd_disabled_services:
- "avahi-daemon.service"
- "wpa_supplicant.service"
project_src: /home/seba/mydocker

View File

@ -1,10 +1,15 @@
---
ansible_user: "sshd"
ansible_ssh_pass: "g_a9mFKgtGsQFwB4"
ansible_ssh_port: 22
common_hostname: mycloud
common_username: sshd
common_alternate_hostname: ""
common_systemd_disabled_services:
$ANSIBLE_VAULT;1.1;AES256
39636635343730343834376132396565386330656236636462393064353434343637663631396335
3836666637343736636562306361633763343930373031650a633536376134653562353338313763
36303936303232333865623333393531663866633038306637383262613564666430326335373534
3866373566326633650a353130666138396230646164366561323863636665383238626632303732
64663839656338323531346238623937626462313736653062303961616661346232373064363838
62383938373663393438663666613239653233333630316532363137636663313738663134666465
36306337636439306263663363343338393361353430653936386366653663376333653833343033
63383962633335383930626261366462656133343432353736633638633732636231653630333836
32663766343165666266313063353730623565613462373432643162636264646661356233613938
65623835656165386532656461326235303330633364346663666638653761323630316335343032
33666566633463653231313332393037373064303266656161623161636630663861646164313239
31353733646339393433396137643865303063336336613863376231353364353761323138316366
34636238623965623236633964336535653962303365326164663764303933366264383731383738
6366666566313635643566623266316262303531616432376662

View File

@ -1,13 +0,0 @@
ansible_ssh_port: 22
ansible_ssh_user: root
ftp_password: guilermo3
common_hostname: pav-hp
common_alternate_hostname: pav
common_username: seba
common_systemd_disabled_services:
- "avahi-daemon.service"
- "wpa_supplicant.service"
project_src: /home/seba/mydocker

View File

@ -1,30 +1,25 @@
ansible_ssh_port: 8883
ansible_ssh_user: root
hostapd_ssid: rpi-attic
ap_ip: 192.168.2.1
ap_netmask: 255.255.255.0
ap_network: 192.168.2.0
ap_broadcast: 192.168.2.255
eth_ip: 10.1.2.1
eth_netmask: 255.255.255.0
bridge_ip: 192.168.1.32
bridge_gateway: 192.168.1.1
bridge_dns: 192.168.1.1
dhcp_range: 10.1.2.2,10.1.2.20
wlan_interface: wlan0
eth_interface: eth0
bridge_interface: br0
hostapd_channel: '9'
hostapd_passphrase: Gula.Likes.McDrive
common_hostname: rpi0
common_alternate_hostname: ""
common_username: seba
common_systemd_disabled_services:
- "avahi-daemon.service"
- "bluetooth.service"
- "hciuart.service"
- "triggerhappy.service"
- "wpa_supplicant.service"
$ANSIBLE_VAULT;1.1;AES256
35306635643265666433363863306436666336646539313862343739326661353035653561613731
3531366332613365323538326638316630386561633237630a333662396463653864366532353064
37633637393231633964636432653261346234313565393931393030383766303232343630376534
3438373362666162640a396166646133346466646439343065323161363331343163626165306466
35663032363139616137333665663633306335626231646435323633646234323034303530623566
37393237396664333831663930306131356238653566313031356533383230363337653732663365
32663332393161306666656163326137316138643863323933616662633335366134363163623133
63643566336265353133303737383039626430323661303261616333646365323730633030363862
66666637636331373634323034383038376561383839353466383065363231613961643262633665
39626631663537363637353739303639343264363566613563646165623866373736313863643266
65313237306564333439343861663636656365326338313235626561303430363735656331616530
30363164313439366536646639393665663434346562303632653463333739393265373636366636
62613736326661623862633437356466323730363131393839613266383538666165376537323262
65373366343935336332626634306336666536666164346463373861656161373537323438383132
66316134376236303938313733343862646438326365386661306334313830653464333862343738
64616261326334616331663434353262636666353438366237643963643561646337626536643163
32663465613431666538346136646333353437333965383434366432363364643263383062323538
37373162313039343463396639383762363132653866343533306465333434303462323065346136
65366638666333373766653338663639383332376137373033346230333533653561306436663861
64373562396130323634666434376336626434383233313562303939336136353266343464313964
32323764626332376264326366313334366132386130353632613461663131356465346533353433
62363262633236643634306266376161663162643633393365626530646636333936666636326161
31613735356135666434643933633164373164653363623838663966363135363536316233356131
37646465343936373437

View File

@ -1,27 +1,23 @@
ansible_ssh_port: 22
ansible_ssh_user: root
hostapd_ssid: rpi-lr-ojoj
eth_netmask: 255.255.255.0
bridge_ip: 192.168.1.220
bridge_gateway: 192.168.1.1
bridge_dns: 192.168.1.1
dhcp_range: 10.1.1.2,10.1.1.20
ip_prefix: 10.1.1.
wlan_interface: wlan0
eth_interface: eth0
bridge_interface: br0
hostapd_channel: '10'
hostapd_passphrase: Gula.Likes.McDrive
common_hostname: rpi4
common_alternate_hostname: ""
common_username: seba
common_systemd_disabled_services:
- "avahi-daemon.service"
- "bluetooth.service"
- "hciuart.service"
- "triggerhappy.service"
- "wpa_supplicant.service"
$ANSIBLE_VAULT;1.1;AES256
33326265623030613836346435656632366230323135393765623964663261353865633338626333
6534613138646532383530646662663436373865343761660a323836333363323236383437326535
39346637363334376139373533333262313237396565336262613865306263303166303636343434
6339326466616638360a366461616634353537613466393139396266363037656564373330326339
34626233626461303730323238656538383364396633343235303536663936373538636237346665
30373363343837666337396662623638626431323731316237396537666662613662326238656562
38336332623564323031353565363166326364306536363765616463646431663562346161623865
37636137636261356361356531643263613765633432613266653738623232656631613165656562
33313134306661363132373831666461363165396434636232346635653664633031646536666666
36626664363034616430376637623563323634646662666164373934346437653834663831643434
33623338613236623934336536373033383464626266346164393531653766303864346261653336
30383336373365636437356464333338616161363139376163393638383963656436643736323333
39306533363132353065646530656331356165343263313263383362313037363964666432393231
62373666303235656461643437653934616634313366386134373065346431336434656465343665
66633831323364363662343738623239656231653366386362306432393535646134623664396563
32633663303864323334663135663336316532653739343366396633373732613462353635313938
36326664336139363736306337316139653834646239666435346232343565646133643237386561
35393732363736333232366339633666343533643563653336663463366338396463626137306461
34643336346562353230656236616566636233376131666139316230323237396130346639653336
32313565323438623163383734393437343961363865636663636634636232346136363466393362
39653538633836626138363563386362663530373135643865333763303764613866643261333961
3239623235356262363130336663623337643430363430356435

View File

@ -1,26 +1,18 @@
ansible_ssh_port: 22
ansible_ssh_user: root
hostapd_ssid: tinker-ap
ap_ip: 192.168.4.1
ap_netmask: 255.255.255.0
ap_network: 192.168.4.0
ap_broadcast: 192.168.4.255
eth_ip: 10.1.3.1
eth_netmask: 255.255.255.0
bridge_ip: 192.168.1.25
bridge_gateway: 192.168.1.1
bridge_dns: 192.168.1.1
dhcp_range: 10.1.3.2,10.1.3.20
wlan_interface: wlan0
eth_interface: eth0
bridge_interface: br0
hostapd_channel: '11'
hostapd_passphrase: Gula.Likes.McDrive
common_hostname: tinker
common_alternate_hostname: ""
common_username: linaro
common_systemd_disabled_services:
- ""
$ANSIBLE_VAULT;1.1;AES256
37666361313232336162653766646639656335656662633833366131356164643862313266323138
6466323030623735666562373733383165353661323265640a333763646365653030313833643361
61313735383435653632396464323138383161653162376663663233306336366530663532326534
3533653431643131630a633934333661303564656130323666646636393132376262623264626630
35313730356634356535323338653034643939633862313765363333333561663261326466663762
31333962653835303139336432666237626437393732363137623065326261383334663534303965
61346438636530623932373761636338366630323235353662653138393737353766613837643965
33653838316139623437663236363662306263623435306566653035346339373166326333646533
38346634333961653265383337626133623231616437303238663130323335373363653733353531
38323839336433356538373762616430363163626462663562346134623961616635313564383930
30396238626365646339346263666335366131393638653765636338653939643838373463373366
30393262366433393332303765613764616266633866393236643935326637656538343638316365
31393934376363373233623162373434356535303430663161653236393839326133643439336330
32333339356262396565393631376135326663353338373430353931343930396537633566323436
65333861326466343966383937646437313033666663646230386539626366313837646361373630
34376231626461303433346536623736383430373239336338376433316338393437323231643163
65363436393131306438396139323864373963316231343762623662633439646431

View File

@ -1,17 +1,23 @@
---
all:
children:
boards:
hosts:
# rpi0:
# rpi4:
# tinker:
servers:
hosts:
mycloud:
asustor-lan1:
# coffee-pc:
# rpi4:
#tinker:
#asus-laptop-eth:
dell:
children:
servers:
hosts:
asustor-lan1:
ansible_host: 192.168.1.10
ansible_port: 8883
ansible_user: admin
ansible_ssh_private_key_file: ~/.ssh/id_rsa_ansible
ansible_become: yes
ansible_become_method: sudo
rpi4:
ansible_host: 192.168.1.151
acemagic:
ansible_host: 192.168.1.132
mikrotik:
ansible_host: 192.168.1.1
ftp_servers:
hosts:
acemagic:
vars:
ansible_python_interpreter: auto_legacy_silent

View File

@ -0,0 +1,6 @@
---
- name: Konfiguracja cyklicznych zrzutów bazy danych Postgres i innych (seagata16t)
hosts: acemagic
become: yes
roles:
- ../roles/backups.acemagic

25
playbooks/asustor.yml Normal file
View File

@ -0,0 +1,25 @@
---
- name: Configure Asustor NAS
hosts: asustor-lan1
gather_facts: no
pre_tasks:
- name: Test connection
ping:
roles:
- asustor.ssh_keys
- asustor.node_exporter
post_tasks:
- name: Verify node_exporter
uri:
url: "http://{{ inventory_hostname }}:{{ node_exporter_port }}/metrics"
return_content: no
delegate_to: localhost
register: result
failed_when: false
- name: Report status
debug:
msg: "node_exporter is {{ 'running' if result.status == 200 else 'NOT running' }}"

View File

@ -1,6 +1,5 @@
---
- hosts: rpi4
- hosts: acemagic
become: yes
roles:
- ../roles/ansible-role-autofs
- autofs_nas

View File

@ -1,4 +0,0 @@
---
- hosts: boards,!tinker
roles:
- ../roles/board.hotspots

View File

@ -1,13 +1,10 @@
---
- hosts: all,!mycloud
- hosts: all
roles:
- ../roles/common
- hosts: dell
- hosts: acemagic
roles:
- ../roles/crons.dell
- ../roles/crons.acemagic
#- hosts: coffee-pc
# roles:
# - ../roles/containers.running#

View File

@ -1,5 +1,5 @@
---
- hosts: dell
- hosts: acemagic
roles:
- ../roles/crons.dell
- ../roles/crons.acemagic

View File

@ -1,5 +0,0 @@
---
- hosts: elementary
roles:
- ../roles/ftp.setup

View File

@ -0,0 +1,10 @@
---
- hosts: mikrotik
gather_facts: no
vars:
ansible_user: admin
ansible_connection: network_cli
ansible_network_os: community.network.routeros
# Usuwamy ansible_ssh_common_args, bo klucze już działają
roles:
- mikrotik.backup

View File

@ -0,0 +1,6 @@
---
- hosts: ftp_servers
become: true
roles:
- ../roles/pureftpd_doorbell

View File

@ -0,0 +1,7 @@
---
- name: Setup PostgreSQL Logical Replication (Multi-DB)
hosts:
- acemagic
- asustor-lan1
roles:
- postgres.replication

@ -1 +0,0 @@
Subproject commit 46c979d83c6a9cf69394157312b916c0445eedcf

View File

@ -0,0 +1,5 @@
---
node_exporter_version: "1.7.0"
node_exporter_port: 9100
node_exporter_install_dir: /usr/local/bin
node_exporter_arch: "amd64"

View File

@ -0,0 +1,45 @@
---
- name: Check if node_exporter exists
stat:
path: "{{ node_exporter_install_dir }}/node_exporter"
register: node_exporter_bin
- name: Download node_exporter
get_url:
url: "https://github.com/prometheus/node_exporter/releases/download/v{{ node_exporter_version }}/node_exporter-{{ node_exporter_version }}.linux-{{ node_exporter_arch }}.tar.gz"
dest: /tmp/node_exporter.tar.gz
when: not node_exporter_bin.stat.exists
- name: Extract node_exporter
unarchive:
src: /tmp/node_exporter.tar.gz
dest: /tmp/
remote_src: yes
when: not node_exporter_bin.stat.exists
- name: Copy node_exporter binary
copy:
src: "/tmp/node_exporter-{{ node_exporter_version }}.linux-{{ node_exporter_arch }}/node_exporter"
dest: "{{ node_exporter_install_dir }}/node_exporter"
mode: '0755'
remote_src: yes
when: not node_exporter_bin.stat.exists
- name: Check if node_exporter is running
shell: pgrep -f node_exporter
args:
executable: /bin/sh
register: node_exporter_running
failed_when: false
changed_when: false
- name: Start node_exporter
shell: nohup {{ node_exporter_install_dir }}/node_exporter --web.listen-address=":{{ node_exporter_port }}" > /tmp/node_exporter.log 2>&1 &
args:
executable: /bin/sh
when: node_exporter_running.rc != 0
- name: Wait for node_exporter
wait_for:
port: "{{ node_exporter_port }}"
timeout: 30

View File

@ -0,0 +1,21 @@
#!/bin/sh
# Node Exporter startup script for Asustor NAS
case "$1" in
start)
echo "Starting node_exporter..."
nohup {{ node_exporter_install_dir }}/node_exporter --web.listen-address=":{{ node_exporter_port }}" > /var/log/node_exporter.log 2>&1 &
;;
stop)
echo "Stopping node_exporter..."
pkill node_exporter
;;
restart)
$0 stop
sleep 2
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac

View File

@ -0,0 +1,2 @@
---
ssh_key_file: ~/.ssh/id_rsa_ansible.pub

View File

@ -0,0 +1,12 @@
---
- name: Ensure .ssh directory exists
file:
path: "~/.ssh"
state: directory
mode: '0700'
- name: Copy SSH public key
authorized_key:
user: "{{ ansible_user }}"
key: "{{ lookup('file', ssh_key_file) }}"
state: present

View File

@ -0,0 +1,5 @@
---
- name: restart autofs
service:
name: autofs
state: restarted

View File

@ -0,0 +1,50 @@
---
- name: Install autofs and nfs-common
apt:
name:
- autofs
- nfs-common
state: present
update_cache: yes
- name: Ensure /media/asustor exists
file:
path: /media/asustor
state: directory
mode: '0755'
- name: Ensure /media/mycloud exists
file:
path: /media/mycloud
state: directory
mode: '0755'
- name: Configure /etc/auto.master.d/asustor.autofs
template:
src: asustor.autofs.j2
dest: /etc/auto.master.d/asustor.autofs
notify: restart autofs
- name: Configure /etc/auto.asustor
template:
src: auto.asustor.j2
dest: /etc/auto.asustor
notify: restart autofs
- name: Configure /etc/auto.master.d/mycloud.autofs
template:
src: mycloud.autofs.j2
dest: /etc/auto.master.d/mycloud.autofs
notify: restart autofs
- name: Configure /etc/auto.mycloud
template:
src: auto.mycloud.j2
dest: /etc/auto.mycloud
notify: restart autofs
- name: Ensure autofs is started and enabled
service:
name: autofs
state: started
enabled: yes

View File

@ -0,0 +1 @@
/media/asustor /etc/auto.asustor --timeout=60 --ghost

View File

@ -0,0 +1,2 @@
asustor_volume1 -uid=1000,gid=1000,fstype=nfs,rw,soft,tcp,nolock asustor-lan1:/volume1/asustor_volume1
asustor_Public -uid=1000,gid=1000,fstype=nfs,rw,soft,tcp,nolock asustor-lan1:/volume1/Public

View File

@ -0,0 +1,3 @@
mycloud_public -fstype=nfs,rw,soft,tcp,nolock mycloud:/nfs/Public
mycloud_timelapses -fstype=nfs,rw,soft,tcp,nolock mycloud:/nfs/timelapses
mycloud_surveillance -fstype=nfs,rw,soft,tcp,nolock mycloud:/nfs/surveillance

View File

@ -0,0 +1 @@
/media/mycloud /etc/auto.mycloud --timeout=60 --ghost

View File

@ -0,0 +1,57 @@
---
- name: Instalacja rclone i postgres-client
apt:
name: [rclone, postgresql-client]
state: present
- name: Katalog na zrzuty SQL (16TB) albo pozniej mlodszy WD 1TB
file:
path: "{{ backup_path }}"
state: directory
owner: seba
group: seba
mode: '0755'
- name: Wdrozenie skryptu backupu
template:
src: backup.sh.j2
dest: "{{ docker_data_path }}/backup_db.sh"
owner: seba
group: seba
mode: '0755'
- name: Zadanie cron (uzytkownik seba)
cron:
name: "Database SQL Dump"
user: "seba"
hour: "3"
minute: "0"
job: "{{ docker_data_path }}/backup_db.sh > /dev/null 2>&1"
#SEAGATA16T backup
- name: Deploy rsync backup script for Seagate 16T
template:
src: backup_seagata16t.sh.j2
dest: "{{ backup_seagata16t_script_path }}"
mode: '0755'
owner: root
group: root
- name: Ensure log file exists
file:
path: /var/log/rsync_backup_16t.log
state: touch
owner: root
group: root
mode: '0644'
- name: Setup daily cron job for 16T backup
cron:
name: "Daily rsync backup Seagate 16T to Asustor"
minute: "0"
hour: "3"
job: "{{ backup_seagata16t_script_path }}"
user: root
state: present
#SEAGATA16T END

View File

@ -0,0 +1,33 @@
#!/bin/bash
# Logowanie wszystkiego do pliku backup.log
LOG_FILE="/home/seba/mydocker/backup.log"
exec > >(tee -a "$LOG_FILE") 2>&1
DATE=$(date +%Y%m%d_%H%M)
BACKUP_DIR="{{ backup_path }}"
# Ustawiamy ścieżkę zgodną z tym, co widzi rclone (sprawdź rclone lsd gdrive:)
REMOTE_PATH="gdrive:backups_n_configs/acemagic/db_dumps"
RCLONE_CONF="/home/seba/.config/rclone/rclone.conf"
echo "--- Backup start: $DATE ---"
# 1. Zrzut bazy z kompresją
echo "Dumping database..."
docker exec {{ db_container_name }} pg_dumpall -U {{ db_user }} | gzip > $BACKUP_DIR/db_dump_$DATE.sql.gz
# 2. Wysyłka do Google Drive
echo "Uploading to Google Drive..."
rclone --config $RCLONE_CONF copy $BACKUP_DIR/db_dump_$DATE.sql.gz $REMOTE_PATH
# 3. Usuwanie starych kopii na GDrive (zostawia 3 najnowsze)
echo "Cleaning old backups on GDrive..."
rclone --config $RCLONE_CONF lsf $REMOTE_PATH --format "tp" --separator ";" --files-only | sort | head -n -3 | while read -r line; do
FILENAME=$(echo $line | cut -d';' -f2)
echo "Deleting old remote file: $FILENAME"
rclone --config $RCLONE_CONF delete "$REMOTE_PATH/$FILENAME"
done
# 4. Usuwanie lokalne
find $BACKUP_DIR -type f -name "*.sql.gz" -mtime +1 -delete
echo "--- Backup finished: $(date) ---"

View File

@ -0,0 +1,30 @@
#!/bin/bash
# Backup script for Seagate 16T - Managed by Ansible
LOGFILE="/var/log/rsync_backup_16t.log"
LOCKFILE="/var/run/rsync_backup_16t.lock"
# 1. Sprawdzenie, czy skrypt już nie działa (flock)
# Próbuje uzyskać blokadę na deskryptorze pliku 9
exec 9>"$LOCKFILE"
if ! flock -n 9; then
echo "$(date): SKIPPED - Backup already in progress (process locked)." >> $LOGFILE
exit 0
fi
# 2. Sprawdzenie punktów montowania
if mountpoint -q {{ backup_seagata16t_source }} && mountpoint -q /media/asustor; then
echo "$(date): Starting backup from {{ backup_seagata16t_source }}" >> $LOGFILE
# Rsync -av (archive, verbose)
rsync -av {{ backup_seagata16t_source }} {{ backup_seagata16t_destination }} >> $LOGFILE 2>&1
if [ $? -eq 0 ]; then
echo "$(date): Backup of 16T SUCCESS" >> $LOGFILE
else
echo "$(date): Backup of 16T ERROR during rsync" >> $LOGFILE
fi
else
echo "$(date): CRITICAL - Source or Destination not mounted. Skipping 16T backup." >> $LOGFILE
exit 1
fi

View File

@ -0,0 +1,9 @@
---
backup_path: "/media/seagata16t/backups/db_dumps"
docker_data_path: "/home/seba/mydocker"
db_container_name: "postgres18"
db_user: "homeassistant"
backup_seagata16t_source: "/media/seagata16t/"
backup_seagata16t_destination: "/media/asustor/asustor_volume1/seagata16t-backup/"
backup_seagata16t_script_path: "/usr/local/bin/rsync_backup_seagata.sh"

View File

@ -1,87 +0,0 @@
# Ansible Role: Hotspot
Sets up a hotspot on a Raspberry Pi.
## Requirements
None.
## Role Variables
interfaces_config_file: '/etc/network/interfaces'
Interfaces configuration file.
hostapd_default_file: '/etc/default/hostapd'
hostapd default file.
hostapd_config_file: '/etc/hostapd/hostapd.conf'
hostapd configuration file.
dnsmasq_conf_file: '/etc/dnsmasq.conf'
dnsmasq configuration file.
sysctl_conf_file: '/etc/sysctl.conf'
sysctl configuration file.
accesspoint_file: '/etc/network/if-up.d/accesspoint'
Accesspoint file.
hostapd_interface: 'wlan0'
Interface name:
hostapd_driver: 'nl80211'
Used wifi driver.
hostapd_ctrl_interface: '/var/run/hostapd'
hostapd_ctrl_interface_group: '0'
hostapd_ssid: 'RaspberryPi'
SSID of the created wifi network.
hostapd_passphrase: ''
Password of the created wifi network.
hostapd_channel: '1'
hostapd_hw_mode: 'g'
hostapd_ieee80211n: '1'
hostapd_wpa: '2'
hostapd_wpa_key_mgmt: 'WPA-PSK'
hostapd_wpa_pairwise: 'CCMP'
hostapd_rsn_pairwise: 'CCMP'
hostapd_country_code: 'DE'
## Dependencies
None.
## Example Playbook
- hosts: all
roles:
- { role: interoberlin.hotspot, hostapd_passphrase: mypassword }
## License
GPLv3
## Author Information
This role was created in 2016 by [Florian Schwanz](https://interoberlin.de/).

View File

@ -1,31 +0,0 @@
---
interfaces_config_file: '/etc/network/interfaces'
hostapd_default_file: '/etc/default/hostapd'
hostapd_config_file: '/etc/hostapd/hostapd.conf'
dnsmasq_conf_file: '/etc/dnsmasq.conf'
set_firewall_file: '/etc/set_firewall.sh'
dhcpcd_conf_file: '/etc/dhcpcd.conf'
sysctl_conf_file: '/etc/sysctl.conf'
accesspoint_file: '/etc/network/if-up.d/accesspoint'
interfaces_file: '/etc/network/interfaces'
bridge_br0_netdev: /etc/systemd/network/bridge-br0.netdev
bridge_br0_slave_network: /etc/systemd/network/bridge-br0-slave.network
bridge_br0_network: /etc/systemd/network/bridge-br0.network
hostapd_interface: 'wlan0'
hostapd_driver: 'nl80211'
hostapd_ctrl_interface: '/var/run/hostapd'
hostapd_ctrl_interface_group: '0'
#hostapd_ssid: 'RaspberryPi'
#hostapd_channel: '10'
hostapd_hw_mode: 'g'
hostapd_ieee80211n: '1'
hostapd_wpa: '2'
hostapd_wpa_key_mgmt: 'WPA-PSK'
hostapd_wpa_pairwise: 'CCMP'
hostapd_rsn_pairwise: 'CCMP'
hostapd_country_code: 'CZ'

View File

@ -1 +0,0 @@
---

View File

@ -1 +0,0 @@
---

View File

@ -1,3 +0,0 @@
---
hotspot_required_packages:
- "bridge-utils"

View File

@ -1,17 +0,0 @@
---
- name: ifconfig up
shell: /sbin/ifconfig {{ wlan_interface }} {{ ap_ip }} netmask {{ ap_netmask }} up
- name: hostapd down
shell: sudo systemctl stop hostapd
- name: hostapd up
shell: sudo systemctl start hostapd
- name: restart network
shell: systemctl restart systemd-networkd
- name: reboot
reboot:
reboot_timeout: 3600

View File

@ -1,48 +0,0 @@
---
- shell: "rm -fv {{ accesspoint_file }}"
- package: name=hostapd state=present
- package: name=dnsmasq state=present
- package: name=bridge-utils state=present
- lineinfile: dest={{ dhcpcd_conf_file }} regexp="^interface {{ wlan_interface }}\nstatic" line="interface {{ wlan_interface }}"
- lineinfile: dest={{ dhcpcd_conf_file }} regexp="^interface {{ wlan_interface }}" line="interface {{ wlan_interface }}"
- lineinfile: dest={{ dhcpcd_conf_file }} regexp="^denyinterfaces {{ wlan_interface }}" line="denyinterfaces {{ wlan_interface }}"
- lineinfile: dest={{ dhcpcd_conf_file }} regexp="^denyinterfaces {{ eth_interface }}" state=absent
interface wlan0
static ip_address=192.168.0.10/24
- debug: msg="hostapd down"
notify: hostapd down
changed_when: true
- shell: "sudo brctl addbr {{ bridge_interface }} || :"
- shell: "sudo brctl addif {{ bridge_interface }} {{ eth_interface }} || :"
- debug: msg="restart network"
notify: restart network
changed_when: true
- template: src=templates/interfaces.j2 dest={{ interfaces_config_file }} owner=root group=root mode=0644
- template: src=templates/hostapd.conf.j2 dest={{ hostapd_config_file }} owner=root group=root mode=0644
- template: src=templates/dnsmasq.conf.j2 dest={{ dnsmasq_conf_file }} owner=root group=root mode=0644
- template: src=templates/set-firewall.j2 dest={{ set_firewall_file }} owner=root group=root mode=0755
- shell: "echo 'bash {{ set_firewall_file }} >> /etc/rc.local' || :"
- sysctl: name="net.ipv4.ip_forward" value=1 sysctl_set=yes state=present reload=yes
- lineinfile: dest={{ hostapd_default_file }} regexp="^DAEMON_CONF=" line="DAEMON_CONF="/etc/hostapd/hostapd.conf""
- service: name=hostapd state=restarted masked=no daemon_reload=yes
- service: name=dnsmasq state=restarted masked=no daemon_reload=yes
- debug: msg="reboot"
notify: reboot
changed_when: true
- shell: "{{ set_firewall_file }}"

View File

@ -1,11 +0,0 @@
---
# Variable setup.
- name: Include OS-specific variables.
include_vars: "defaults/{{ ansible_os_family }}.yml"
- name: Include architecture-specific variables.
include_vars: "defaults/{{ ansible_architecture }}.yml"
# Setup/install tasks.
- include: board.hotspots.yml
when: ansible_os_family == 'Debian' and (ansible_architecture == 'armv7l' or ansible_architecture == 'armv6l')

View File

@ -1,2 +0,0 @@
interface={{ wlan_interface }}
dhcp-range={{ dhcp_range }},255.255.255.0,24h

View File

@ -1,19 +0,0 @@
interface={{ hostapd_interface }}
#bridge={{ bridge_interface }}
#driver={{ hostapd_driver }}
#ctrl_interface={{ hostapd_ctrl_interface }}
#ctrl_interface_group={{ hostapd_ctrl_interface_group }}
ssid={{ hostapd_ssid }}
channel={{ hostapd_channel }}
hw_mode={{ hostapd_hw_mode }}
ieee80211n={{ hostapd_ieee80211n }}
wpa={{ hostapd_wpa }}
wpa_passphrase={{ hostapd_passphrase }}
wpa_key_mgmt={{ hostapd_wpa_key_mgmt }}
wpa_pairwise={{ hostapd_wpa_pairwise }}
rsn_pairwise={{ hostapd_rsn_pairwise }}
country_code={{ hostapd_country_code }}

View File

@ -1,14 +0,0 @@
auto lo
iface lo inet loopback
iface {{ eth_interface }} inet dhcp
iface {{ wlan_interface }} inet static
address {{ ip_prefix }}99
netmask 255.255.255.0
gateway {{ bridge_gateway }}
# Bridge setup
iface {{ bridge_interface }} inet manual
bridge_ports {{ eth_interface }} {{ wlan_interface }}

View File

@ -1,3 +0,0 @@
iptables -t nat -A POSTROUTING -o {{ eth_interface }} -j MASQUERADE
iptables -A FORWARD -i {{ eth_interface }} -o {{ wlan_interface }} -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i {{ wlan_interface }} -o {{ eth_interface }} -j ACCEPT

View File

@ -1,3 +0,0 @@
---
skip_list:
- '204'

View File

@ -1,36 +0,0 @@
---
name: Bug
about: Report a bug related to ansible role
labels: bug
---
**What happened?**
**Did you expect to see some different?**
**How to reproduce it (as minimally and precisely as possible)**:
**Environment**
* Role version:
`Insert release version/galaxy tag or Git SHA here`
* Ansible version information:
`ansible --version`
<!-- Replace the command with its output above -->
* Variables:
```
insert role variables relevant to the issue
```
* Ansible playbook execution Logs:
```
insert Ansible logs relevant to the issue here
```
**Anything else we need to know?**:

View File

@ -1,22 +0,0 @@
---
name: Feature
about: If you want to propose a new feature or enhancement
labels: enhancement
---
**What is missing?**
**Why do we need it?**
**Environment**
* Role version:
`Insert release version/galaxy tag or Git SHA here`
* Ansible version information:
`ansible --version`
<!-- Replace the command with its output above -->
**Anything else we need to know?**:

View File

@ -1,34 +0,0 @@
---
name: Support
about: If you have questions about this ansible role
labels: question
---
**What did you do?**
**Did you expect to see some different?**
**Environment**
* Role version:
`Insert release version/galaxy tag or Git SHA here`
* Ansible version information:
`ansible --version`
<!-- Replace the command with its output above -->
* Variables:
```
insert role variables relevant to the issue
```
* Ansible playbook execution Logs:
```
insert Ansible logs relevant to the issue here
```
**Anything else we need to know?**:

View File

@ -1,31 +0,0 @@
---
# configuration spec at https://github.com/actions/labeler/blob/master/README.md
area/docs:
- meta/*
- CHANGELOG.md
- CONTRIBUTING.md
- LICENSE
- README.md
area/tests:
- molecule/*
- molecule/**/*
- .ansible-lint
- test-requirements.txt
- tox.ini
area/automation:
- .travis/*
- .github/*
- .github/**/*
- .travis.yml
- .mergify.yml
area/vars:
- defaults/*
- vars/*
- vars/**/*
area/tasks:
- handlers/*
- tasks/*
- tasks/**/*
area/jinja:
- templates/*
- templates/**/*

View File

@ -1,46 +0,0 @@
---
# Default GitHub labels
- color: d73a4a
name: bug
description: Something isn't working
- color: cfd3d7
name: duplicate
description: This issue or pull request already exists
- color: a2eeef
name: enhancement
description: New feature or request
- color: 7057ff
name: good first issue
description: Good for newcomers
- color: 008672
name: help wanted
description: Extra attention is needed
- color: e4e669
name: invalid
description: This doesn't seem right
- color: d876e3
name: question
description: Further information is requested
- color: ffffff
name: wontfix
description: This will not be worked on
# Labels specific to cloudalchemy
- color: 0366d6
name: area/docs
description: Improvements or additions to documentation
- color: 0366d6
name: area/tests
description: Everything related to molecule tests and linters
- color: 0366d6
name: area/automation
description: Bots, bots everywhere
- color: 0366d6
name: area/vars
description: Ansible variables used in role
- color: 0366d6
name: area/tasks
description: Logic behind ansible role
- color: 0366d6
name: area/jinja
description: Templates

View File

@ -1,2 +0,0 @@
---
_extends: auto-maintenance

View File

@ -1,2 +0,0 @@
---
_extends: auto-maintenance

View File

@ -1,13 +0,0 @@
---
name: Pull request labeler
on:
schedule:
- cron: '*/15 * * * *'
jobs:
labeler:
runs-on: ubuntu-latest
steps:
- uses: paulfantom/periodic-labeler@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}

View File

@ -1,17 +0,0 @@
---
name: Sync labels in the declarative way
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@1.0.0
- uses: micnncim/action-label-syncer@v0.3.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
with:
manifest: .github/labels.yml

View File

@ -1,7 +0,0 @@
*.retry
*.log
.molecule
.cache
__pycache__/
.pytest_cache
.tox

View File

@ -1,16 +0,0 @@
---
pull_request_rules:
- name: automatic merge and new release from cloudalchemybot
conditions:
- "status-success=Travis CI - Pull Request"
- status-success=WIP
- head~=autoupdate|skeleton
- author=cloudalchemybot
actions:
merge:
method: squash
strict: true
- name: delete head branch after merge
conditions: []
actions:
delete_head_branch: {}

View File

@ -1,28 +0,0 @@
---
os: linux
dist: xenial
language: python
python:
- 3.7
cache: pip
services:
- docker
env:
- ANSIBLE=2.7
- ANSIBLE=2.8
- ANSIBLE=2.9
install:
- pip3 install tox-travis git-semver
script:
- ./.travis/test.sh
deploy:
provider: script
cleanup: true
script: .travis/releaser.sh
on:
branch: master
branches:
only:
- master
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/

View File

@ -1,71 +0,0 @@
#!/bin/bash
#
# Copyright (C) 2018 Pawel Krupa (@paulfantom) - All Rights Reserved
# Permission to copy and modify is granted under the MIT license
#
# Script to automatically do a couple of things:
# - generate a new tag according to semver (https://semver.org/)
# - generate CHANGELOG.md by using https://github.com/skywinder/github-changelog-generator
# - sync CHANGELOG with GitHub releases by using https://github.com/mattbrictson/chandler
#
# Tags are generated by searching for a keyword in last commit message. Keywords are:
# - [patch] or [fix] to bump patch number
# - [minor], [feature] or [feat] to bump minor number
# - [major] or [breaking change] to bump major number
# All keywords MUST be surrounded with square braces.
#
# Script uses git mechanisms for locking, so it can be used in parallel builds
#
# Requirements:
# - GH_TOKEN variable set with GitHub token. Access level: repo.public_repo
# - docker
# - git-semver python package (pip install git-semver)
# Exit when latest commit is tagged
[[ $(git tag --points-at) ]] && exit 0
# Some basic variables
GIT_MAIL="cloudalchemybot@gmail.com"
GIT_USER="cloudalchemybot"
ORGANIZATION=$(echo "$TRAVIS_REPO_SLUG" | awk -F '/' '{print $1}')
PROJECT=$(echo "$TRAVIS_REPO_SLUG" | awk -F '/' '{print $2}')
GALAXY_URL="https://galaxy.ansible.com/${ORGANIZATION}/${PROJECT#ansible-}"
# Git config
git config --global user.email "${GIT_MAIL}"
git config --global user.name "${GIT_USER}"
GIT_URL=$(git config --get remote.origin.url)
GIT_URL=${GIT_URL#*//}
# Generate TAG
GIT_TAG=none
echo "Last commit message: $TRAVIS_COMMIT_MESSAGE"
case "${TRAVIS_COMMIT_MESSAGE}" in
*"[patch]"*|*"[fix]"*|*"[bugfix]"* ) GIT_TAG=$(git semver --next-patch) ;;
*"[minor]"*|*"[feat]"*|*"[feature]"* ) GIT_TAG=$(git semver --next-minor) ;;
*"[major]"*|*"[breaking change]"* ) GIT_TAG=$(git semver --next-major) ;;
*) echo "Keyword not detected. Doing nothing" ;;
esac
if [ "$GIT_TAG" != "none" ]; then
echo "Assigning new tag: $GIT_TAG"
git tag "$GIT_TAG" -a -m "Automatic tag generation for travis build no. $TRAVIS_BUILD_NUMBER"
git push "https://${GH_TOKEN}:@${GIT_URL}" --tags || exit 0
fi
# Generate CHANGELOG.md
git checkout master
git pull
docker run -it --rm -v "$(pwd)":/usr/local/src/your-app ferrarimarco/github-changelog-generator:1.14.3 \
-u "${ORGANIZATION}" -p "${PROJECT}" --token "${GH_TOKEN}" \
--release-url "${GALAXY_URL}" \
--unreleased-label "**Next release**" --no-compare-link
git add CHANGELOG.md
git commit -m '[ci skip] Automatic changelog update'
git push "https://${GH_TOKEN}:@${GIT_URL}" || exit 0
# Sync changelog to github releases
if [ "$GIT_TAG" != "none" ]; then
docker run -e CHANDLER_GITHUB_API_TOKEN="${GH_TOKEN}" -v "$(pwd)":/chandler -ti whizark/chandler push "${GIT_TAG}"
fi

View File

@ -1,12 +0,0 @@
#!/bin/bash
set -euo pipefail
if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
tox -- molecule test --all --destroy always
else
tox -- molecule test -s default --destroy always
if [ -d "./molecule/alternative" ]; then
tox -- molecule test -s alternative --destroy never
fi
fi

View File

@ -1,15 +0,0 @@
extends: default
ignore: |
.travis/
.travis.yml
.github/
meta/
rules:
braces:
max-spaces-inside: 1
level: error
brackets:
max-spaces-inside: 1
level: error
line-length: disable

View File

@ -1,381 +0,0 @@
# Change Log
## [**Next release**](https://galaxy.ansible.com/cloudalchemy/node-exporter)
**Implemented enhancements:**
- Hardcode node-exporter username and group [\#139](https://github.com/cloudalchemy/ansible-node-exporter/issues/139)
**Merged pull requests:**
- Do not manage system directories [\#140](https://github.com/cloudalchemy/ansible-node-exporter/pull/140) ([paulfantom](https://github.com/paulfantom))
- Add binary install directory [\#137](https://github.com/cloudalchemy/ansible-node-exporter/pull/137) ([guimaluf](https://github.com/guimaluf))
## [0.18.0](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2020-01-16)
**Closed issues:**
- Node exporter fails on ec2 builds with ""No file was found when using first\_found" [\#115](https://github.com/cloudalchemy/ansible-node-exporter/issues/115)
**Merged pull requests:**
- \[REPO SYNC\] Merge pull request \#4 from cloudalchemy/travis\_fix [\#138](https://github.com/cloudalchemy/ansible-node-exporter/pull/138) ([cloudalchemybot](https://github.com/cloudalchemybot))
- \[REPO SYNC\] use latest available python [\#136](https://github.com/cloudalchemy/ansible-node-exporter/pull/136) ([cloudalchemybot](https://github.com/cloudalchemybot))
- Fix syntax on SELinux installation for clearlinux [\#134](https://github.com/cloudalchemy/ansible-node-exporter/pull/134) ([paretl](https://github.com/paretl))
- \[REPO SYNC\] remove IRC link [\#133](https://github.com/cloudalchemy/ansible-node-exporter/pull/133) ([cloudalchemybot](https://github.com/cloudalchemybot))
- move installing selinux package dependencies into separate tasks [\#132](https://github.com/cloudalchemy/ansible-node-exporter/pull/132) ([paulfantom](https://github.com/paulfantom))
- Updated README.md [\#129](https://github.com/cloudalchemy/ansible-node-exporter/pull/129) ([envy7](https://github.com/envy7))
- add option to propagate binaries without access to internet [\#126](https://github.com/cloudalchemy/ansible-node-exporter/pull/126) ([DaazKu](https://github.com/DaazKu))
- \[REPO SYNC\] add declarative label sync; add autolabelling PRs [\#123](https://github.com/cloudalchemy/ansible-node-exporter/pull/123) ([cloudalchemybot](https://github.com/cloudalchemybot))
## [0.17.0](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2019-11-14)
**Closed issues:**
- Check is not working [\#107](https://github.com/cloudalchemy/ansible-node-exporter/issues/107)
**Merged pull requests:**
- \[REPO SYNC\] molecule: use CI images from quay.io instead of dockerhub [\#121](https://github.com/cloudalchemy/ansible-node-exporter/pull/121) ([cloudalchemybot](https://github.com/cloudalchemybot))
- \[REPO SYNC\] Update releaser.sh [\#120](https://github.com/cloudalchemy/ansible-node-exporter/pull/120) ([cloudalchemybot](https://github.com/cloudalchemybot))
- \[REPO SYNC\] add support for CentOS8 [\#119](https://github.com/cloudalchemy/ansible-node-exporter/pull/119) ([cloudalchemybot](https://github.com/cloudalchemybot))
- tasks: remove already covered entries when choosing an OS specific vars [\#118](https://github.com/cloudalchemy/ansible-node-exporter/pull/118) ([paulfantom](https://github.com/paulfantom))
- Run preflight tasks to register variables when check\_mode is enabled [\#117](https://github.com/cloudalchemy/ansible-node-exporter/pull/117) ([paulfantom](https://github.com/paulfantom))
- tasks: do not touch any settings of system directory /usr/local/bin [\#116](https://github.com/cloudalchemy/ansible-node-exporter/pull/116) ([paulfantom](https://github.com/paulfantom))
## [0.16.0](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2019-10-18)
**Fixed bugs:**
- Do not use createhome alias as it seems to break whole system permissions [\#111](https://github.com/cloudalchemy/ansible-node-exporter/pull/111) ([paulfantom](https://github.com/paulfantom))
**Closed issues:**
- allow custom ignored-mount-points [\#106](https://github.com/cloudalchemy/ansible-node-exporter/issues/106)
**Merged pull requests:**
- add official support for CentOS8 [\#114](https://github.com/cloudalchemy/ansible-node-exporter/pull/114) ([paulfantom](https://github.com/paulfantom))
- molecule/default/tests: test if permissions of other files are unchanged [\#112](https://github.com/cloudalchemy/ansible-node-exporter/pull/112) ([paulfantom](https://github.com/paulfantom))
## [0.15.0](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2019-09-11)
**Merged pull requests:**
- Synchronize files from cloudalchemy/skeleton [\#102](https://github.com/cloudalchemy/ansible-node-exporter/pull/102) ([cloudalchemybot](https://github.com/cloudalchemybot))
- add RHEL8 and debian buster support; remove testing on debian jessie [\#101](https://github.com/cloudalchemy/ansible-node-exporter/pull/101) ([paulfantom](https://github.com/paulfantom))
- Update minimum required ansible version [\#100](https://github.com/cloudalchemy/ansible-node-exporter/pull/100) ([cloudalchemybot](https://github.com/cloudalchemybot))
- Moving to python 3 and dropping support for python 2.x \(on deployer host\) [\#99](https://github.com/cloudalchemy/ansible-node-exporter/pull/99) ([cloudalchemybot](https://github.com/cloudalchemybot))
- Synchronize files from cloudalchemy/skeleton [\#97](https://github.com/cloudalchemy/ansible-node-exporter/pull/97) ([cloudalchemybot](https://github.com/cloudalchemybot))
- added restartsec and startlimitinterval configurations [\#96](https://github.com/cloudalchemy/ansible-node-exporter/pull/96) ([oguzhaninan](https://github.com/oguzhaninan))
- preflight: Fix detection of systemd version for systemd 240+ [\#93](https://github.com/cloudalchemy/ansible-node-exporter/pull/93) ([0xFelix](https://github.com/0xFelix))
- Updated README with correct default value [\#92](https://github.com/cloudalchemy/ansible-node-exporter/pull/92) ([nicholasamorim](https://github.com/nicholasamorim))
- node\_exporter version check [\#91](https://github.com/cloudalchemy/ansible-node-exporter/pull/91) ([rwos](https://github.com/rwos))
## [0.14.0](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2019-06-05)
**Merged pull requests:**
- New prometheus/node\_exporter upstream release! [\#90](https://github.com/cloudalchemy/ansible-node-exporter/pull/90) ([cloudalchemybot](https://github.com/cloudalchemybot))
- make node\_exporter executable file root-owned [\#89](https://github.com/cloudalchemy/ansible-node-exporter/pull/89) ([slrz](https://github.com/slrz))
- Add retries to package installs [\#88](https://github.com/cloudalchemy/ansible-node-exporter/pull/88) ([denmat](https://github.com/denmat))
- Fix wrong size of /home shown by node-exporter [\#87](https://github.com/cloudalchemy/ansible-node-exporter/pull/87) ([laurvas](https://github.com/laurvas))
- Create suse.yml [\#86](https://github.com/cloudalchemy/ansible-node-exporter/pull/86) ([jbhannah](https://github.com/jbhannah))
- New prometheus/node\_exporter upstream release! [\#85](https://github.com/cloudalchemy/ansible-node-exporter/pull/85) ([cloudalchemybot](https://github.com/cloudalchemybot))
- Synchronize files from cloudalchemy/skeleton [\#84](https://github.com/cloudalchemy/ansible-node-exporter/pull/84) ([cloudalchemybot](https://github.com/cloudalchemybot))
## [0.13.1](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2019-05-04)
**Fixed bugs:**
- Disable collectors [\#80](https://github.com/cloudalchemy/ansible-node-exporter/issues/80)
**Merged pull requests:**
- Fix systemd service startup ordering [\#83](https://github.com/cloudalchemy/ansible-node-exporter/pull/83) ([ko-zu](https://github.com/ko-zu))
## [0.13.0](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2019-04-01)
**Closed issues:**
- IPv4 assumption in SELinux tasks [\#75](https://github.com/cloudalchemy/ansible-node-exporter/issues/75)
- Node\_exporter is not running with fresh install on Debian 9 [\#71](https://github.com/cloudalchemy/ansible-node-exporter/issues/71)
**Merged pull requests:**
- fix preflight check responsible for collector enablement [\#81](https://github.com/cloudalchemy/ansible-node-exporter/pull/81) ([paulfantom](https://github.com/paulfantom))
- Refactor preflight checks [\#79](https://github.com/cloudalchemy/ansible-node-exporter/pull/79) ([paulfantom](https://github.com/paulfantom))
- make SELinux settings ipv6 compatible [\#78](https://github.com/cloudalchemy/ansible-node-exporter/pull/78) ([paulfantom](https://github.com/paulfantom))
- fix\(tasks/configure.yml\): typo in task name [\#77](https://github.com/cloudalchemy/ansible-node-exporter/pull/77) ([angristan](https://github.com/angristan))
- reintroduce user management into defaults and add testing user creation [\#74](https://github.com/cloudalchemy/ansible-node-exporter/pull/74) ([paulfantom](https://github.com/paulfantom))
- Add systemd state to started for first run of the role [\#72](https://github.com/cloudalchemy/ansible-node-exporter/pull/72) ([MCyprien](https://github.com/MCyprien))
## [0.12.1](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2019-02-19)
**Merged pull requests:**
- Correctly enable extra collectors [\#70](https://github.com/cloudalchemy/ansible-node-exporter/pull/70) ([SuperQ](https://github.com/SuperQ))
- Lock down systemd service [\#68](https://github.com/cloudalchemy/ansible-node-exporter/pull/68) ([ecksun](https://github.com/ecksun))
## [0.12.0](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2018-12-17)
**Merged pull requests:**
- Better tags and configuration handling [\#66](https://github.com/cloudalchemy/ansible-node-exporter/pull/66) ([paulfantom](https://github.com/paulfantom))
- add alternative tests [\#65](https://github.com/cloudalchemy/ansible-node-exporter/pull/65) ([paulfantom](https://github.com/paulfantom))
- simplify automated CPU arch choosing [\#64](https://github.com/cloudalchemy/ansible-node-exporter/pull/64) ([paulfantom](https://github.com/paulfantom))
## [0.11.4](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2018-12-05)
**Merged pull requests:**
- Add support for multi-line ansible\_managed strings [\#63](https://github.com/cloudalchemy/ansible-node-exporter/pull/63) ([etcet](https://github.com/etcet))
## [0.11.3](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2018-12-03)
**Closed issues:**
- Nice'ness fails node\_exporter [\#59](https://github.com/cloudalchemy/ansible-node-exporter/issues/59)
**Merged pull requests:**
- New node\_exporter upstream release! [\#62](https://github.com/cloudalchemy/ansible-node-exporter/pull/62) ([cloudalchemybot](https://github.com/cloudalchemybot))
- Remove setting niceness in systemd service file [\#60](https://github.com/cloudalchemy/ansible-node-exporter/pull/60) ([paulfantom](https://github.com/paulfantom))
## [0.11.2](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2018-10-08)
**Merged pull requests:**
- move to ansible 2.7 [\#58](https://github.com/cloudalchemy/ansible-node-exporter/pull/58) ([paulfantom](https://github.com/paulfantom))
## [0.11.1](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2018-10-04)
**Merged pull requests:**
- do not set specific capabilities [\#57](https://github.com/cloudalchemy/ansible-node-exporter/pull/57) ([paulfantom](https://github.com/paulfantom))
## [0.11.0](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2018-09-19)
**Closed issues:**
- Python crashes when running role [\#54](https://github.com/cloudalchemy/ansible-node-exporter/issues/54)
**Merged pull requests:**
- make textfile dir writable by node-exp group [\#56](https://github.com/cloudalchemy/ansible-node-exporter/pull/56) ([jillro](https://github.com/jillro))
- Add support for Clear linux [\#55](https://github.com/cloudalchemy/ansible-node-exporter/pull/55) ([bswinnerton](https://github.com/bswinnerton))
## [0.10.2](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2018-09-06)
**Fixed bugs:**
- Rate limit errors due to checksum fetching [\#50](https://github.com/cloudalchemy/ansible-node-exporter/issues/50)
**Merged pull requests:**
- reload-daemon on systemd enable [\#53](https://github.com/cloudalchemy/ansible-node-exporter/pull/53) ([jewzaam](https://github.com/jewzaam))
## [0.10.1](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2018-08-15)
**Merged pull requests:**
- download checksum file only once [\#51](https://github.com/cloudalchemy/ansible-node-exporter/pull/51) ([paulfantom](https://github.com/paulfantom))
## [0.10.0](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2018-07-15)
**Implemented enhancements:**
- import\_tasks instead of include; bringing role up to ansible-prometheus standards; minor changes [\#48](https://github.com/cloudalchemy/ansible-node-exporter/pull/48) ([paulfantom](https://github.com/paulfantom))
## [0.9.0](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2018-07-01)
**Fixed bugs:**
- Problems with `node\_exporter\_textfile\_dir` [\#43](https://github.com/cloudalchemy/ansible-node-exporter/issues/43)
**Closed issues:**
- node-exporter service handler is triggered before deployment [\#44](https://github.com/cloudalchemy/ansible-node-exporter/issues/44)
**Merged pull requests:**
- ansible 2.6 + allow remote docker host [\#46](https://github.com/cloudalchemy/ansible-node-exporter/pull/46) ([paulfantom](https://github.com/paulfantom))
- use tox for running test matrix [\#45](https://github.com/cloudalchemy/ansible-node-exporter/pull/45) ([paulfantom](https://github.com/paulfantom))
## [0.8.0](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2018-06-10)
**Merged pull requests:**
- Add support for textfile collector [\#42](https://github.com/cloudalchemy/ansible-node-exporter/pull/42) ([SuperQ](https://github.com/SuperQ))
## [0.7.0](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2018-06-10)
**Implemented enhancements:**
- Socket activation [\#41](https://github.com/cloudalchemy/ansible-node-exporter/issues/41)
**Merged pull requests:**
- specify file name for dest in get\_url call [\#40](https://github.com/cloudalchemy/ansible-node-exporter/pull/40) ([sarphram](https://github.com/sarphram))
- Install newer node\_exporter by default [\#36](https://github.com/cloudalchemy/ansible-node-exporter/pull/36) ([paulfantom](https://github.com/paulfantom))
## [0.6.20](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2018-05-27)
**Merged pull requests:**
- Fix architecture var parsing [\#39](https://github.com/cloudalchemy/ansible-node-exporter/pull/39) ([SuperQ](https://github.com/SuperQ))
- Offer a better IRC Web clients to users [\#38](https://github.com/cloudalchemy/ansible-node-exporter/pull/38) ([Porkepix](https://github.com/Porkepix))
## [0.6.19](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2018-05-23)
**Merged pull requests:**
- Fix failing role on non-SELinux RedHat [\#37](https://github.com/cloudalchemy/ansible-node-exporter/pull/37) ([noraab](https://github.com/noraab))
- split download and unarchive and add checksum validation [\#35](https://github.com/cloudalchemy/ansible-node-exporter/pull/35) ([paulfantom](https://github.com/paulfantom))
- move to molecule 2.x [\#34](https://github.com/cloudalchemy/ansible-node-exporter/pull/34) ([paulfantom](https://github.com/paulfantom))
## [0.6.18](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2018-04-13)
**Merged pull requests:**
- Make node\_exporter.service template compatible with both Python 2 and 3 [\#33](https://github.com/cloudalchemy/ansible-node-exporter/pull/33) ([nikosgraser](https://github.com/nikosgraser))
## [0.6.17](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2018-04-12)
**Merged pull requests:**
- Skip capabilities set in check\_mode [\#32](https://github.com/cloudalchemy/ansible-node-exporter/pull/32) ([Porkepix](https://github.com/Porkepix))
## [0.6.16](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2018-04-06)
**Merged pull requests:**
- Fix test done using a filter [\#31](https://github.com/cloudalchemy/ansible-node-exporter/pull/31) ([Porkepix](https://github.com/Porkepix))
- Fix \_\_pycache\_\_ in .gitignore [\#30](https://github.com/cloudalchemy/ansible-node-exporter/pull/30) ([Porkepix](https://github.com/Porkepix))
## [0.6.15](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2018-04-05)
## [0.6.14](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2018-04-02)
**Merged pull requests:**
- retry downloads [\#29](https://github.com/cloudalchemy/ansible-node-exporter/pull/29) ([paulfantom](https://github.com/paulfantom))
## [0.6.13](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2018-03-30)
**Merged pull requests:**
- Fix check mode [\#28](https://github.com/cloudalchemy/ansible-node-exporter/pull/28) ([Porkepix](https://github.com/Porkepix))
## [0.6.12](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2018-03-26)
**Merged pull requests:**
- Ubuntu bionic \(18.04\) support [\#26](https://github.com/cloudalchemy/ansible-node-exporter/pull/26) ([paulfantom](https://github.com/paulfantom))
## [0.6.11](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2018-03-24)
**Merged pull requests:**
- ansible 2.5 [\#27](https://github.com/cloudalchemy/ansible-node-exporter/pull/27) ([paulfantom](https://github.com/paulfantom))
## [0.6.10](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2018-03-05)
**Closed issues:**
- Adding option to configure collectors [\#18](https://github.com/cloudalchemy/ansible-node-exporter/issues/18)
**Merged pull requests:**
- Modify when-statement to not include jinja2 templating delimiters such [\#25](https://github.com/cloudalchemy/ansible-node-exporter/pull/25) ([swesterveld](https://github.com/swesterveld))
## [0.6.9](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2018-02-18)
**Closed issues:**
- Preflight checks [\#16](https://github.com/cloudalchemy/ansible-node-exporter/issues/16)
**Merged pull requests:**
- fedora support + issue 18 [\#24](https://github.com/cloudalchemy/ansible-node-exporter/pull/24) ([paulfantom](https://github.com/paulfantom))
## [0.6.8](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2018-02-14)
**Merged pull requests:**
- Make Prometheus node exporter restart/reload with sudo privileges. [\#23](https://github.com/cloudalchemy/ansible-node-exporter/pull/23) ([swesterveld](https://github.com/swesterveld))
## [0.6.7](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2018-01-14)
**Merged pull requests:**
- custom docker images; support more OSes [\#21](https://github.com/cloudalchemy/ansible-node-exporter/pull/21) ([paulfantom](https://github.com/paulfantom))
## [0.6.6](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2018-01-13)
**Merged pull requests:**
- Add preflight checks [\#22](https://github.com/cloudalchemy/ansible-node-exporter/pull/22) ([jkrol2](https://github.com/jkrol2))
## [0.6.5](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2018-01-13)
**Closed issues:**
- Permission denied to fs [\#17](https://github.com/cloudalchemy/ansible-node-exporter/issues/17)
**Merged pull requests:**
- Set home directory for node-exp user [\#20](https://github.com/cloudalchemy/ansible-node-exporter/pull/20) ([paulfantom](https://github.com/paulfantom))
## [0.6.4](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2018-01-09)
**Merged pull requests:**
- Fix \#17 [\#19](https://github.com/cloudalchemy/ansible-node-exporter/pull/19) ([paulfantom](https://github.com/paulfantom))
## [0.6.3](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2018-01-08)
## [0.6.2](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2018-01-06)
**Merged pull requests:**
- minor fix, added i386 to arch [\#15](https://github.com/cloudalchemy/ansible-node-exporter/pull/15) ([rdemachkovych](https://github.com/rdemachkovych))
## [0.6.1](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2018-01-04)
**Merged pull requests:**
- Lower niceness to increase app priority [\#14](https://github.com/cloudalchemy/ansible-node-exporter/pull/14) ([paulfantom](https://github.com/paulfantom))
- docs [\#13](https://github.com/cloudalchemy/ansible-node-exporter/pull/13) ([paulfantom](https://github.com/paulfantom))
## [0.6.0](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2018-01-02)
**Merged pull requests:**
- Update generatetag.sh [\#12](https://github.com/cloudalchemy/ansible-node-exporter/pull/12) ([paulfantom](https://github.com/paulfantom))
## [0.5.11](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2018-01-02)
**Merged pull requests:**
- support older raspberry pi [\#11](https://github.com/cloudalchemy/ansible-node-exporter/pull/11) ([paulfantom](https://github.com/paulfantom))
## [0.5.10](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2018-01-01)
**Closed issues:**
- Option to disable collectors [\#2](https://github.com/cloudalchemy/ansible-node-exporter/issues/2)
**Merged pull requests:**
- added node exporter disabled collectors option [\#10](https://github.com/cloudalchemy/ansible-node-exporter/pull/10) ([rdemachkovych](https://github.com/rdemachkovych))
## [0.5.9](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2017-12-27)
**Merged pull requests:**
- armv7l ansible arch translates to armv7 go arch [\#9](https://github.com/cloudalchemy/ansible-node-exporter/pull/9) ([anisse](https://github.com/anisse))
## [0.5.8](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2017-12-27)
**Implemented enhancements:**
- Support multiple go architectures [\#5](https://github.com/cloudalchemy/ansible-node-exporter/issues/5)
**Merged pull requests:**
- Remove unused command line flags [\#8](https://github.com/cloudalchemy/ansible-node-exporter/pull/8) ([anisse](https://github.com/anisse))
## [0.5.7](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2017-12-15)
**Merged pull requests:**
- update node\_exporter version [\#7](https://github.com/cloudalchemy/ansible-node-exporter/pull/7) ([paulfantom](https://github.com/paulfantom))
- auto set go architecture [\#6](https://github.com/cloudalchemy/ansible-node-exporter/pull/6) ([paulfantom](https://github.com/paulfantom))
## [0.5.6](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2017-12-06)
**Merged pull requests:**
- Stop pipeline on any error [\#4](https://github.com/cloudalchemy/ansible-node-exporter/pull/4) ([paulfantom](https://github.com/paulfantom))
## [0.5.5](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2017-11-30)
## [0.5.4](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2017-11-30)
## [0.5.3](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2017-11-28)
**Merged pull requests:**
- fix CI; remove company from role description [\#1](https://github.com/cloudalchemy/ansible-node-exporter/pull/1) ([paulfantom](https://github.com/paulfantom))
## [0.5.1](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2017-11-09)
## [0.5.0](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2017-10-16)
## [0.4.3](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2017-10-12)
## [0.4.2](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2017-10-05)
## [0.4.1](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2017-09-26)
## [0.4.0](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2017-09-20)
## [0.3.4](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2017-08-09)
## [0.3.3](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2017-08-09)
## [0.3.2](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2017-07-26)
## [0.3.1](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2017-07-26)
## [0.3.0](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2017-07-21)
## [0.2.0](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2017-07-21)
## [0.1.2](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2017-06-14)
## [0.1.1](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2017-06-14)
## [0.1.0](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2017-06-06)
## [0.0.2](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2017-05-18)
## [0.0.1](https://galaxy.ansible.com/cloudalchemy/node-exporter) (2017-04-19)
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*

View File

@ -1,97 +0,0 @@
# Contributor Guideline
This document provides an overview of how you can participate in improving this project or extending it. We are
grateful for all your help: bug reports and fixes, code contributions, documentation or ideas. Feel free to join, we
appreciate your support!!
## Communication
### GitHub repositories
Much of the issues, goals and ideas are tracked in the respective projects in GitHub. Please use this channel to report
bugs, ask questions, and request new features .
## git and GitHub
In order to contribute code please:
1. Fork the project on GitHub
2. Clone the project
3. Add changes (and tests)
4. Commit and push
5. Create a merge-request
To have your code merged, see the expectations listed below.
You can find a well-written guide [here](https://help.github.com/articles/fork-a-repo).
Please follow common commit best-practices. Be explicit, have a short summary, a well-written description and
references. This is especially important for the merge-request.
Some great guidelines can be found [here](https://wiki.openstack.org/wiki/GitCommitMessages) and
[here](http://robots.thoughtbot.com/5-useful-tips-for-a-better-commit-message).
## Releases
We try to stick to semantic versioning and our releases are automated. Release is created by assigning a keyword (in a
way similar to travis [`[ci skip]`](https://docs.travis-ci.com/user/customizing-the-build#Skipping-a-build)) to a
commit with merge request. Available keywords are (square brackets are important!):
* `[patch]`, `[fix]` - for PATCH version release
* `[minor]`, `[feature]`, `[feat]` - for MINOR version release
* `[major]`, `[breaking change]` - for MAJOR version release
## Changelog
Changelog is generateg automatically on every merged Pull Request and all information is taken from github issues, PRs
and labels.
## Expectations
### Keep it simple
We try to provide production ready ansible roles which should be as much zero-conf as possible but this doesn't mean to
overcomplicate things. Just follow [KISS](https://en.wikipedia.org/wiki/KISS_principle).
### Be explicit
* Please avoid using nonsensical property and variable names.
* Use self-describing attribute names for user configuration.
* In case of failures, communicate what happened and why a failure occurs to the user. Make it easy to track the code
or action that produced the error. Try to catch and handle errors if possible to provide improved failure messages.
### Add tests
We are striving to use at least two test scenarios located in [/molecule](molecule) directory. First one
([default](molecule/default)) is testing default configuration without any additional variables, second one
([alternative](molecule/alternative)) is testing what happens when many variables from
[/defaults/main.yml](defaults/main.yml) are changed. When adding new functionalities please add tests to proper
scenarios. Tests are written in testinfra framework and are located in `/tests` subdirectory of scenario directory
(for example default tests are in [/molecule/default/tests](molecule/default/tests)).
More information about:
- [testinfra](http://testinfra.readthedocs.io/en/latest/index.html)
- [molecule](https://molecule.readthedocs.io/en/latest/index.html)
### Follow best practices
Please follow [ansible best practices](http://docs.ansible.com/ansible/latest/playbooks_best_practices.html) and
especially provide meaningful names to tasks and even comments where needed.
Our test framework automatically lints code with [`yamllint`](https://yamllint.readthedocs.io) and
[`ansible-lint`](https://github.com/willthames/ansible-lint) programs so be sure to follow their rules.
Remember: Code is generally read much more often than written.
### Use Markdown
Wherever possible, please refrain from any other formats and stick to simple markdown.
## Requirements regarding roles design
We are trying to create the best and most secure installation method for non-containerized prometheus stack components.
To accomplish this all roles need to support:
- current and at least one previous ansible version (wherever possible we try to support 2 previous ansible versions)
- systemd as the only available process manager
- at least latest debian and CentOS distributions

View File

@ -1,21 +0,0 @@
The MIT License (MIT)
Copyright (c) 2017-2018 Pawel Krupa and Roman Demachkovych
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,76 +0,0 @@
<p><img src="https://www.circonus.com/wp-content/uploads/2015/03/sol-icon-itOps.png" alt="graph logo" title="graph" align="right" height="60" /></p>
# Ansible Role: node exporter
[![Build Status](https://travis-ci.org/cloudalchemy/ansible-node-exporter.svg?branch=master)](https://travis-ci.org/cloudalchemy/ansible-node-exporter)
[![License](https://img.shields.io/badge/license-MIT%20License-brightgreen.svg)](https://opensource.org/licenses/MIT)
[![Ansible Role](https://img.shields.io/badge/ansible%20role-cloudalchemy.node_exporter-blue.svg)](https://galaxy.ansible.com/cloudalchemy/node-exporter/)
[![GitHub tag](https://img.shields.io/github/tag/cloudalchemy/ansible-node-exporter.svg)](https://github.com/cloudalchemy/ansible-node-exporter/tags)
## Description
Deploy prometheus [node exporter](https://github.com/prometheus/node_exporter) using ansible.
## Requirements
- Ansible >= 2.7 (It might work on previous versions, but we cannot guarantee it)
- gnu-tar on Mac deployer host (`brew install gnu-tar`)
## Role Variables
All variables which can be overridden are stored in [defaults/main.yml](defaults/main.yml) file as well as in table below.
| Name | Default Value | Description |
| -------------- | ------------- | -----------------------------------|
| `node_exporter_version` | 0.18.1 | Node exporter package version. Also accepts latest as parameter. |
| `node_exporter_binary_local_dir` | "" | Allows to use local packages instead of ones distributed on github. As parameter it takes a directory where `node_exporter` binary is stored on host on which ansible is ran. This overrides `node_exporter_version` parameter |
| `node_exporter_web_listen_address` | "0.0.0.0:9100" | Address on which node exporter will listen |
| `node_exporter_enabled_collectors` | [ systemd, textfile ] | List of additionally enabled collectors. It adds collectors to [those enabled by default](https://github.com/prometheus/node_exporter#enabled-by-default) |
| `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). |
| `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.
## Example
### Playbook
Use it in a playbook as follows:
```yaml
- hosts: all
roles:
- cloudalchemy.node-exporter
```
### Demo site
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).
## Local Testing
The preferred way of locally testing the role is to use Docker and [molecule](https://github.com/metacloud/molecule) (v2.x). You will have to install Docker on your system. See "Get started" for a Docker package suitable to for your system.
We are using tox to simplify process of testing on multiple ansible versions. To install tox execute:
```sh
pip3 install tox
```
To run tests on all ansible versions (WARNING: this can take some time)
```sh
tox
```
To run a custom molecule command on custom environment with only default test scenario:
```sh
tox -e py35-ansible28 -- molecule test -s default
```
For more information about molecule go to their [docs](http://molecule.readthedocs.io/en/latest/).
If you would like to run tests on remote docker host just specify `DOCKER_HOST` variable before running tox tests.
## Travis CI
Combining molecule and travis 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 will take more time than local testing, so please be patient.
## Contributing
See [contributor guideline](CONTRIBUTING.md).
## License
This project is licensed under MIT License. See [LICENSE](/LICENSE) for more details.

View File

@ -1,16 +0,0 @@
---
node_exporter_version: 0.18.1
node_exporter_binary_local_dir: ""
node_exporter_web_listen_address: "0.0.0.0:9100"
node_exporter_textfile_dir: "/var/lib/node_exporter"
node_exporter_enabled_collectors:
- systemd
- textfile:
directory: "{{ node_exporter_textfile_dir }}"
# - filesystem:
# ignored-mount-points: "^/(sys|proc|dev)($|/)"
# ignored-fs-types: "^(sys|proc|auto)fs$"
node_exporter_disabled_collectors: []

View File

@ -1,7 +0,0 @@
---
- name: restart node_exporter
become: true
systemd:
daemon_reload: true
name: node_exporter
state: restarted

View File

@ -1,2 +0,0 @@
install_date: Sun Mar 15 11:37:41 2020
version: 0.19.0

View File

@ -1,32 +0,0 @@
---
galaxy_info:
author: Roman Demachkovych, Pawel Krupa
description: Prometheus Node Exporter
license: MIT
company: none
min_ansible_version: 2.7
platforms:
- name: Ubuntu
versions:
- bionic
- xenial
- name: Debian
versions:
- stretch
- buster
- name: EL
versions:
- 7
- 8
- name: Fedora
versions:
- 30
- 31
galaxy_tags:
- monitoring
- prometheus
- exporter
- metrics
- system
dependencies: []

View File

@ -1,74 +0,0 @@
---
dependency:
name: galaxy
driver:
name: docker
lint:
name: yamllint
platforms:
- name: bionic
image: quay.io/paulfantom/molecule-systemd:ubuntu-18.04
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- name: xenial
image: quay.io/paulfantom/molecule-systemd:ubuntu-16.04
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- name: stretch
image: quay.io/paulfantom/molecule-systemd:debian-9
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- name: buster
image: quay.io/paulfantom/molecule-systemd:debian-10
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- name: centos7
image: quay.io/paulfantom/molecule-systemd:centos-7
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- name: centos8
image: quay.io/paulfantom/molecule-systemd:centos-8
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
groups:
- python3
- name: fedora
image: quay.io/paulfantom/molecule-systemd:fedora-30
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
groups:
- python3
provisioner:
name: ansible
lint:
name: ansible-lint
playbooks:
create: ../default/create.yml
prepare: prepare.yml
converge: playbook.yml
destroy: ../default/destroy.yml
inventory:
group_vars:
python3:
ansible_python_interpreter: /usr/bin/python3
scenario:
name: alternative
verifier:
name: testinfra
lint:
name: flake8
enabled: true

View File

@ -1,13 +0,0 @@
---
- name: Run role
hosts: all
any_errors_fatal: true
roles:
- ansible-node-exporter
vars:
node_exporter_binary_local_dir: "/tmp/node_exporter-linux-amd64"
node_exporter_textfile_dir: ""
node_exporter_enabled_collectors:
- entropy
node_exporter_disabled_collectors:
- diskstats

View File

@ -1,37 +0,0 @@
---
- name: Prepare
hosts: localhost
gather_facts: false
vars:
go_arch: amd64
node_exporter_version: 0.18.1
tasks:
- name: Download node_exporter binary to local folder
become: false
get_url:
url: "https://github.com/prometheus/node_exporter/releases/download/v{{ node_exporter_version }}/node_exporter-{{ node_exporter_version }}.linux-{{ go_arch }}.tar.gz"
dest: "/tmp/node_exporter-{{ node_exporter_version }}.linux-{{ go_arch }}.tar.gz"
register: _download_binary
until: _download_binary is succeeded
retries: 5
delay: 2
run_once: true
check_mode: false
- name: Unpack node_exporter binary
become: false
unarchive:
src: "/tmp/node_exporter-{{ node_exporter_version }}.linux-{{ go_arch }}.tar.gz"
dest: "/tmp"
creates: "/tmp/node_exporter-{{ node_exporter_version }}.linux-{{ go_arch }}/node_exporter"
run_once: true
check_mode: false
- name: link to node_exporter binaries directory
become: false
file:
src: "/tmp/node_exporter-{{ node_exporter_version }}.linux-amd64"
dest: "/tmp/node_exporter-linux-amd64"
state: link
run_once: true
check_mode: false

View File

@ -1,29 +0,0 @@
import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
def test_directories(host):
dirs = [
"/var/lib/node_exporter"
]
for dir in dirs:
d = host.file(dir)
assert not d.exists
def test_service(host):
s = host.service("node_exporter")
# assert s.is_enabled
assert s.is_running
def test_socket(host):
sockets = [
"tcp://127.0.0.1:9100"
]
for socket in sockets:
s = host.socket(socket)
assert s.is_listening

View File

@ -1,37 +0,0 @@
---
- name: Create
hosts: localhost
connection: local
gather_facts: false
no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}"
tasks:
- name: Create molecule instance(s)
docker_container:
name: "{{ item.name }}"
docker_host: "{{ item.docker_host | default('unix://var/run/docker.sock') }}"
hostname: "{{ item.name }}"
image: "{{ item.image }}"
state: started
recreate: false
log_driver: json-file
command: "{{ item.command | default(omit) }}"
privileged: "{{ item.privileged | default(omit) }}"
volumes: "{{ item.volumes | default(omit) }}"
capabilities: "{{ item.capabilities | default(omit) }}"
exposed_ports: "{{ item.exposed_ports | default(omit) }}"
published_ports: "{{ item.published_ports | default(omit) }}"
ulimits: "{{ item.ulimits | default(omit) }}"
networks: "{{ item.networks | default(omit) }}"
dns_servers: "{{ item.dns_servers | default(omit) }}"
register: server
with_items: "{{ molecule_yml.platforms }}"
async: 7200
poll: 0
- name: Wait for instance(s) creation to complete
async_status:
jid: "{{ item.ansible_job_id }}"
register: docker_jobs
until: docker_jobs.finished
retries: 300
with_items: "{{ server.results }}"

View File

@ -1,32 +0,0 @@
---
- name: Destroy
hosts: localhost
connection: local
gather_facts: false
no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}"
tasks:
- name: Destroy molecule instance(s)
docker_container:
name: "{{ item.name }}"
docker_host: "{{ item.docker_host | default('unix://var/run/docker.sock') }}"
state: absent
force_kill: "{{ item.force_kill | default(true) }}"
register: server
with_items: "{{ molecule_yml.platforms }}"
async: 7200
poll: 0
- name: Wait for instance(s) deletion to complete
async_status:
jid: "{{ item.ansible_job_id }}"
register: docker_jobs
until: docker_jobs.finished
retries: 300
with_items: "{{ server.results }}"
- name: Delete docker network(s)
docker_network:
name: "{{ item }}"
docker_host: "{{ item.docker_host | default('unix://var/run/docker.sock') }}"
state: absent
with_items: "{{ molecule_yml.platforms | molecule_get_docker_networks }}"

View File

@ -1,74 +0,0 @@
---
dependency:
name: galaxy
driver:
name: docker
lint:
name: yamllint
platforms:
- name: bionic
image: quay.io/paulfantom/molecule-systemd:ubuntu-18.04
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- name: xenial
image: quay.io/paulfantom/molecule-systemd:ubuntu-16.04
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- name: stretch
image: quay.io/paulfantom/molecule-systemd:debian-9
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- name: buster
image: quay.io/paulfantom/molecule-systemd:debian-10
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- name: centos7
image: quay.io/paulfantom/molecule-systemd:centos-7
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- name: centos8
image: quay.io/paulfantom/molecule-systemd:centos-8
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
groups:
- python3
- name: fedora
image: quay.io/paulfantom/molecule-systemd:fedora-30
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
groups:
- python3
provisioner:
name: ansible
lint:
name: ansible-lint
playbooks:
create: create.yml
prepare: prepare.yml
converge: playbook.yml
destroy: destroy.yml
inventory:
group_vars:
python3:
ansible_python_interpreter: /usr/bin/python3
scenario:
name: default
verifier:
name: testinfra
lint:
name: flake8
enabled: true

View File

@ -1,7 +0,0 @@
---
- hosts: all
any_errors_fatal: true
roles:
- ansible-node-exporter
vars:
node_exporter_web_listen_address: "127.0.0.1:9100"

View File

@ -1,5 +0,0 @@
---
- name: Prepare
hosts: all
gather_facts: false
tasks: []

View File

@ -1,63 +0,0 @@
import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
def test_directories(host):
dirs = [
"/var/lib/node_exporter"
]
for dir in dirs:
d = host.file(dir)
assert d.is_directory
assert d.exists
def test_files(host):
files = [
"/etc/systemd/system/node_exporter.service",
"/usr/local/bin/node_exporter"
]
for file in files:
f = host.file(file)
assert f.exists
assert f.is_file
def test_permissions_didnt_change(host):
dirs = [
"/etc",
"/root",
"/usr",
"/var"
]
for file in dirs:
f = host.file(file)
assert f.exists
assert f.is_directory
assert f.user == "root"
assert f.group == "root"
def test_user(host):
assert host.group("node-exp").exists
assert "node-exp" in host.user("node-exp").groups
assert host.user("node-exp").shell == "/usr/sbin/nologin"
assert host.user("node-exp").home == "/"
def test_service(host):
s = host.service("node_exporter")
# assert s.is_enabled
assert s.is_running
def test_socket(host):
sockets = [
"tcp://127.0.0.1:9100"
]
for socket in sockets:
s = host.socket(socket)
assert s.is_listening

View File

@ -1,42 +0,0 @@
---
dependency:
name: galaxy
driver:
name: docker
lint:
name: yamllint
platforms:
- name: buster
image: quay.io/paulfantom/molecule-systemd:debian-10
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- name: fedora
image: quay.io/paulfantom/molecule-systemd:fedora-30
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
groups:
- python3
provisioner:
name: ansible
lint:
name: ansible-lint
playbooks:
create: ../default/create.yml
prepare: ../default/prepare.yml
converge: playbook.yml
destroy: ../default/destroy.yml
inventory:
group_vars:
python3:
ansible_python_interpreter: /usr/bin/python3
scenario:
name: latest
verifier:
name: testinfra
lint:
name: flake8
enabled: true

View File

@ -1,8 +0,0 @@
---
- name: Run role
hosts: all
any_errors_fatal: true
roles:
- ansible-node-exporter
vars:
node_exporter_version: latest

View File

@ -1,27 +0,0 @@
import pytest
import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
@pytest.mark.parametrize("files", [
"/etc/systemd/system/node_exporter.service",
"/usr/local/bin/node_exporter"
])
def test_files(host, files):
f = host.file(files)
assert f.exists
assert f.is_file
def test_service(host):
s = host.service("node_exporter")
# assert s.is_enabled
assert s.is_running
def test_socket(host):
s = host.socket("tcp://0.0.0.0:9100")
assert s.is_listening

View File

@ -1,29 +0,0 @@
---
- name: Copy the Node Exporter systemd service file
template:
src: node_exporter.service.j2
dest: /etc/systemd/system/node_exporter.service
owner: root
group: root
mode: 0644
notify: restart node_exporter
- name: Create textfile collector dir
file:
path: "{{ node_exporter_textfile_dir }}"
state: directory
owner: "{{ _node_exporter_system_user }}"
group: "{{ _node_exporter_system_group }}"
recurse: true
mode: 0775
when: node_exporter_textfile_dir | length > 0
- name: Allow Node Exporter port in SELinux on RedHat OS family
seport:
ports: "{{ node_exporter_web_listen_address.split(':')[-1] }}"
proto: tcp
setype: http_port_t
state: present
when:
- ansible_version.full is version_compare('2.4', '>=')
- ansible_selinux.status == "enabled"

View File

@ -1,62 +0,0 @@
---
- name: Create the node_exporter group
group:
name: "{{ _node_exporter_system_group }}"
state: present
system: true
when: _node_exporter_system_group != "root"
- name: Create the node_exporter user
user:
name: "{{ _node_exporter_system_user }}"
groups: "{{ _node_exporter_system_group }}"
append: true
shell: /usr/sbin/nologin
system: true
create_home: false
home: /
when: _node_exporter_system_user != "root"
- block:
- name: Download node_exporter binary to local folder
become: false
get_url:
url: "https://github.com/prometheus/node_exporter/releases/download/v{{ node_exporter_version }}/node_exporter-{{ node_exporter_version }}.linux-{{ go_arch }}.tar.gz"
dest: "/tmp/node_exporter-{{ node_exporter_version }}.linux-{{ go_arch }}.tar.gz"
checksum: "sha256:{{ node_exporter_checksum }}"
register: _download_binary
until: _download_binary is succeeded
retries: 5
delay: 2
delegate_to: localhost
check_mode: false
- name: Unpack node_exporter binary
become: false
unarchive:
src: "/tmp/node_exporter-{{ node_exporter_version }}.linux-{{ go_arch }}.tar.gz"
dest: "/tmp"
creates: "/tmp/node_exporter-{{ node_exporter_version }}.linux-{{ go_arch }}/node_exporter"
delegate_to: localhost
check_mode: false
- name: Propagate node_exporter binaries
copy:
src: "/tmp/node_exporter-{{ node_exporter_version }}.linux-{{ go_arch }}/node_exporter"
dest: "{{ _node_exporter_binary_install_dir }}/node_exporter"
mode: 0755
owner: root
group: root
notify: restart node_exporter
when: not ansible_check_mode
when: node_exporter_binary_local_dir | length == 0
- name: propagate locally distributed node_exporter binary
copy:
src: "{{ node_exporter_binary_local_dir }}/node_exporter"
dest: "{{ _node_exporter_binary_install_dir }}/node_exporter"
mode: 0755
owner: root
group: root
when: node_exporter_binary_local_dir | length > 0
notify: restart node_exporter

View File

@ -1,33 +0,0 @@
---
- import_tasks: preflight.yml
tags:
- node_exporter_install
- node_exporter_configure
- node_exporter_run
- import_tasks: install.yml
become: true
when: (not __node_exporter_is_installed.stat.exists) or (__node_exporter_current_version_output.stderr_lines[0].split(" ")[2] != node_exporter_version)
tags:
- node_exporter_install
- import_tasks: selinux.yml
become: true
when: ansible_selinux.status == "enabled"
tags:
- node_exporter_configure
- import_tasks: configure.yml
become: true
tags:
- node_exporter_configure
- name: Ensure Node Exporter is enabled on boot
become: true
systemd:
daemon_reload: true
name: node_exporter
enabled: true
state: started
tags:
- node_exporter_run

View File

@ -1,87 +0,0 @@
---
- name: Assert usage of systemd as an init system
assert:
that: ansible_service_mgr == 'systemd'
msg: "This role only works with systemd"
- name: Get systemd version
command: systemctl --version
changed_when: false
check_mode: false
register: __systemd_version
tags:
- skip_ansible_lint
- name: Set systemd version fact
set_fact:
node_exporter_systemd_version: "{{ __systemd_version.stdout_lines[0] | regex_replace('^systemd\\s(\\d+).*$', '\\1') }}"
- name: Naive assertion of proper listen address
assert:
that:
- "':' in node_exporter_web_listen_address"
- name: Assert collectors are not both disabled and enabled at the same time
assert:
that:
- "item not in node_exporter_enabled_collectors"
with_items: "{{ node_exporter_disabled_collectors }}"
- name: Check if node_exporter is installed
stat:
path: "{{ _node_exporter_binary_install_dir }}/node_exporter"
register: __node_exporter_is_installed
check_mode: false
tags:
- node_exporter_install
- name: Gather currently installed node_exporter version (if any)
command: "{{ _node_exporter_binary_install_dir }}/node_exporter --version"
args:
warn: false
changed_when: false
register: __node_exporter_current_version_output
check_mode: false
when: __node_exporter_is_installed.stat.exists
tags:
- node_exporter_install
- skip_ansible_lint
- block:
- name: Get latest release
uri:
url: "https://api.github.com/repos/prometheus/node_exporter/releases/latest"
method: GET
return_content: true
status_code: 200
body_format: json
validate_certs: false
user: "{{ lookup('env', 'GH_USER') | default(omit) }}"
password: "{{ lookup('env', 'GH_TOKEN') | default(omit) }}"
no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}"
register: _latest_release
until: _latest_release.status == 200
retries: 5
- name: "Set node_exporter version to {{ _latest_release.json.tag_name[1:] }}"
set_fact:
node_exporter_version: "{{ _latest_release.json.tag_name[1:] }}"
when:
- node_exporter_version == "latest"
- node_exporter_binary_local_dir | length == 0
delegate_to: localhost
run_once: true
- block:
- name: Get checksum list from github
set_fact:
_checksums: "{{ lookup('url', 'https://github.com/prometheus/node_exporter/releases/download/v' + node_exporter_version + '/sha256sums.txt', wantlist=True) | list }}"
run_once: true
- name: "Get checksum for {{ go_arch }} architecture"
set_fact:
node_exporter_checksum: "{{ item.split(' ')[0] }}"
with_items: "{{ _checksums }}"
when:
- "('linux-' + go_arch + '.tar.gz') in item"
when: node_exporter_binary_local_dir | length == 0

View File

@ -1,39 +0,0 @@
---
- name: Install selinux python packages [RHEL]
package:
name:
- "{{ ( (ansible_facts.distribution_major_version | int) < 8) | ternary('libselinux-python','python3-libselinux') }}"
- "{{ ( (ansible_facts.distribution_major_version | int) < 8) | ternary('libselinux-python','python3-policycoreutils') }}"
state: present
register: _install_selinux_packages
until: _install_selinux_packages is success
retries: 5
delay: 2
when:
- (ansible_distribution | lower == "redhat") or
(ansible_distribution | lower == "centos")
- name: Install selinux python packages [Fedora]
package:
name:
- "{{ ( (ansible_facts.distribution_major_version | int) < 29) | ternary('libselinux-python','python3-libselinux') }}"
- "{{ ( (ansible_facts.distribution_major_version | int) < 29) | ternary('libselinux-python','python3-policycoreutils') }}"
state: present
register: _install_selinux_packages
until: _install_selinux_packages is success
retries: 5
delay: 2
when:
- ansible_distribution | lower == "fedora"
- name: Install selinux python packages [clearlinux]
package:
name: sysadmin-basic
state: present
register: _install_selinux_packages
until: _install_selinux_packages is success
retries: 5
delay: 2
when:
- ansible_distribution | lower == "clearlinux"

View File

@ -1,51 +0,0 @@
{{ ansible_managed | comment }}
[Unit]
Description=Prometheus Node Exporter
After=network-online.target
StartLimitInterval=0
[Service]
Type=simple
User={{ _node_exporter_system_user }}
Group={{ _node_exporter_system_group }}
ExecStart={{ _node_exporter_binary_install_dir }}/node_exporter \
{% for collector in node_exporter_enabled_collectors -%}
{% if not collector is mapping %}
--collector.{{ collector }} \
{% else -%}
{% set name, options = (collector.items()|list)[0] -%}
--collector.{{ name }} \
{% for k,v in options|dictsort %}
--collector.{{ name }}.{{ k }}={{ v }} \
{% endfor -%}
{% endif -%}
{% endfor -%}
{% for collector in node_exporter_disabled_collectors %}
--no-collector.{{ collector }} \
{% endfor %}
--web.listen-address={{ node_exporter_web_listen_address }}
SyslogIdentifier=node_exporter
Restart=always
RestartSec=1
PrivateTmp=yes
{% for m in ansible_mounts if m.mount == '/home' %}
ProtectHome=read-only
{% else %}
ProtectHome=yes
{% endfor %}
NoNewPrivileges=yes
{% if node_exporter_systemd_version | int >= 232 %}
ProtectSystem=strict
ProtectControlGroups=true
ProtectKernelModules=true
ProtectKernelTunables=yes
{% else %}
ProtectSystem=full
{% endif %}
[Install]
WantedBy=multi-user.target

View File

@ -1,6 +0,0 @@
molecule>=2.15.0
docker
ansible-lint>=3.4.0
testinfra>=1.7.0
jmespath
selinux

View File

@ -1,21 +0,0 @@
[tox]
minversion = 1.8
basepython = python3.7
envlist = py37-ansible{27,28,29}
skipsdist = true
[travis:env]
ANSIBLE=
2.7: ansible27
2.8: ansible28
2.9: ansible29
[testenv]
passenv = GH_* DOCKER_HOST MOLECULE_*
deps =
-rtest-requirements.txt
ansible27: ansible<2.8
ansible28: ansible<2.9
ansible29: ansible<2.10
commands =
{posargs:molecule test --all --destroy always}

View File

@ -1,13 +0,0 @@
---
go_arch_map:
i386: '386'
x86_64: 'amd64'
aarch64: 'arm64'
armv7l: 'armv7'
armv6l: 'armv6'
go_arch: "{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}"
_node_exporter_binary_install_dir: "/usr/local/bin"
_node_exporter_system_group: "node-exp"
_node_exporter_system_user: "{{ _node_exporter_system_group }}"

View File

@ -2,7 +2,6 @@
common_required_packages:
- "autofs"
- "accountsservice"
- "python"
- "python3"
- "python3-pip"
- "vim"

View File

@ -1 +1,5 @@
---
- name: restart vsftpd
ansible.builtin.systemd:
name: vsftpd
state: restarted

Some files were not shown because too many files have changed in this diff Show More