-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: enable telegraf geoip role for peer cache
- Loading branch information
1 parent
0b04a68
commit ba1f7a8
Showing
12 changed files
with
172 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
resources/ansible/roles/cache_webserver/templates/nginx.conf.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
resources/ansible/roles/cache_webserver/templates/nginx_status.conf.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
server { | ||
listen 127.0.0.1:8080; | ||
|
||
location /nginx_status { | ||
stub_status; | ||
allow 127.0.0.1; | ||
deny all; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
resources/ansible/roles/telegraf-configuration/defaults/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
network_dashboard_branch: rc-2024.12.1 | ||
network_dashboard_branch: main | ||
network_dashboard_github_url: git@github.com:maidsafe/network-dashboard.git | ||
network_dashboard_repo_path: /root/network-dashboard | ||
network_dashboard_sk_path: /root/.ssh/network-dashboard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
network_dashboard_branch: main | ||
network_dashboard_github_url: git@github.com:maidsafe/network-dashboard.git | ||
network_dashboard_repo_path: /root/network-dashboard | ||
network_dashboard_sk_path: /root/.ssh/network-dashboard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
--- | ||
# This role has to be run after the telegraf-configuration role. | ||
- name: stop telegraf service | ||
systemd: | ||
name: telegraf | ||
state: stopped | ||
|
||
- name: stop telegraf-elasticsearch service | ||
systemd: | ||
name: telegraf-elasticsearch | ||
state: stopped | ||
|
||
- name: ensure target directory exists | ||
file: | ||
path: "{{ network_dashboard_repo_path }}" | ||
state: directory | ||
|
||
- name: check if network dashboard repo already cloned | ||
stat: | ||
path: "{{ network_dashboard_repo_path }}/.git" | ||
register: repo_stat | ||
|
||
- name: clone the network dashboard repo | ||
git: | ||
repo: "{{ network_dashboard_github_url }}" | ||
dest: "{{ network_dashboard_repo_path }}" | ||
version: "{{ network_dashboard_branch }}" | ||
key_file: "{{ network_dashboard_sk_path }}" | ||
accept_hostkey: yes | ||
when: not repo_stat.stat.exists | ||
|
||
- name: ensure GeoIP directory exists | ||
file: | ||
path: /var/lib/geoip | ||
state: directory | ||
mode: '0755' | ||
|
||
- name: copy over MaxMind's GeoIP | ||
copy: | ||
src: "{{ network_dashboard_repo_path }}/telegraf/Plugins/geoip/GeoLite2-City.mmdb" | ||
dest: /var/lib/geoip/GeoLite2-City.mmdb | ||
mode: '0644' | ||
remote_src: yes | ||
|
||
- name: copy over Telegraf-Geoip Processor Plugin configuration file | ||
copy: | ||
src: "{{ network_dashboard_repo_path }}/telegraf/Plugins/geoip/geoip_config_file_influxdb" | ||
dest: /var/lib/geoip/geoip_config_file_influxdb | ||
mode: '0644' | ||
remote_src: yes | ||
|
||
- name: copy over Telegraf-Geoip Processor Plugin configuration file | ||
copy: | ||
src: "{{ network_dashboard_repo_path }}/telegraf/Plugins/geoip/geoip_config_file_elasticsearch" | ||
dest: /var/lib/geoip/geoip_config_file_elasticsearch | ||
mode: '0644' | ||
remote_src: yes | ||
|
||
- name: Add telegraf user to adm group | ||
user: | ||
name: telegraf | ||
groups: adm | ||
append: yes | ||
|
||
- name: copy telegraf nginx config file | ||
copy: | ||
src: "{{ network_dashboard_repo_path }}/telegraf/ConfigurationFile/peer_cache_nodes/telegraf_nginx.conf" | ||
dest: /etc/telegraf/telegraf.d/telegraf_nginx.conf | ||
remote_src: yes | ||
|
||
- name: create telegraf-elasticsearch.d subdir | ||
file: | ||
path: /etc/telegraf-elasticsearch/telegraf-elasticsearch.d | ||
state: directory | ||
mode: '0755' | ||
|
||
- name: copy telegraf nginx elasticsearch config file | ||
copy: | ||
src: "{{ network_dashboard_repo_path }}/telegraf/ConfigurationFile/peer_cache_nodes/telegraf_nginx_elasticsearch.conf" | ||
dest: /etc/telegraf-elasticsearch/telegraf-elasticsearch.d/telegraf_nginx_elasticsearch.conf | ||
remote_src: yes | ||
|
||
- name: copy telegraf elasticsearch system service file | ||
copy: | ||
src: "{{ network_dashboard_repo_path }}/telegraf/SystemServiceFile/telegraf-elasticsearch.service" | ||
dest: /lib/systemd/system/telegraf-elasticsearch.service | ||
remote_src: yes | ||
|
||
- name: reload the configuration files for systemctl daemon | ||
become: True | ||
command: systemctl daemon-reload | ||
|
||
- name: start telegraf-elasticsearch service | ||
systemd: | ||
name: telegraf-elasticsearch | ||
enabled: yes | ||
state: started | ||
|
||
- name: start telegraf service | ||
systemd: | ||
name: telegraf | ||
enabled: yes | ||
state: started |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters