Merge pull request 'node' (#4) from node into main

Reviewed-on: http://192.168.2.61/DmitriyA/ansible-playbooks/pulls/4
main
YurijO 2025-03-17 15:10:32 +03:00
commit b2b87fd120
20 changed files with 0 additions and 349 deletions

View File

@ -1,10 +0,0 @@
$ANSIBLE_VAULT;1.1;AES256
36326338343966663165373732326261623264396335386137356339363562353364373434313938
3335353137343230306563623464336630343532353035610a383736643433376133393038623135
34313638383030613464366537653735613166353264646263643433613161393666356461666633
3331366464393830620a313566623035636337323864393366316334343063323761626462303936
64626530663763336436396164363931393034353834666538383761303634666531396464316430
63646438633062303363383135396662653733336330353462663433306534383936373334386466
65303034323436363830383361366535663238316561393365353864323337666330326635323261
31306265326362653835633839343961646265643730333961616633316136313832303730373362
66373532333634373165336665303363663565643833333230616332643866323562

View File

@ -1,13 +0,0 @@
- name: Installing prometheus
become: yes
hosts: all
roles:
- role: prometheus-common
tags: prometheus
- name: Installing grafana
become: yes
hosts: all
roles:
- role: grafana-common
tags: grafana

View File

@ -1,38 +0,0 @@
Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).

View File

@ -1,2 +0,0 @@
---
# defaults file for grafana-common

View File

@ -1,2 +0,0 @@
---
# handlers file for grafana-common

View File

@ -1,34 +0,0 @@
galaxy_info:
author: your name
description: your role description
company: your company (optional)
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
# - MIT
# - GPL-2.0-or-later
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: license (GPL-2.0-or-later, MIT, etc)
min_ansible_version: 2.1
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.

View File

@ -1,34 +0,0 @@
---
- name: Download Grafana deb package
ansible.builtin.get_url:
url: "https://dl.grafana.com/oss/release/grafana_{{ grafana_version }}_{{ grafana_arch }}.deb"
dest: "{{ destination_directory }}"
- name: Update repos and upgrade system
apt:
update_cache: yes
upgrade: dist
autoremove: yes
- name: Install dependencies
apt:
name:
- adduser
- libfontconfig1
- musl
state: present
- name: Install Grafana from deb package
ansible.builtin.apt:
deb: "{{ destination_directory }}/grafana_{{ grafana_version }}_{{ grafana_arch }}.deb"
state: present
- name: Remove downloaded deb package
ansible.builtin.file:
path: "{{ destination_directory }}/grafana_{{ grafana_version }}_{{ grafana_arch }}.deb"
state: absent
- name: Enable and start Grafana service
ansible.builtin.systemd:
name: grafana-server
enabled: yes
state: started

View File

@ -1,2 +0,0 @@
localhost

View File

@ -1,5 +0,0 @@
---
- hosts: localhost
remote_user: root
roles:
- grafana-common

View File

@ -1,4 +0,0 @@
---
grafana_version: 11.4.0
grafana_arch: amd64
destination_directory: /home/user

View File

@ -1,38 +0,0 @@
Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).

View File

@ -1,2 +0,0 @@
---
# defaults file for prometheus-common

View File

@ -1,17 +0,0 @@
[Unit]
Description=Background service of Prometheus
Wants=network-online.target
After=network-online.target
[Service]
User=prometheus
Group=prometheus
Type=simple
ExecStart=/usr/local/bin/prometheus \
--config.file /etc/prometheus/prometheus.yml \
--storage.tsdb.path /var/lib/prometheus/ \
--web.console.templates=/etc/prometheus/consoles \
--web.console.libraries=/etc/prometheus/console_libraries
[Install]
WantedBy=multi-user.target

View File

@ -1,7 +0,0 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
- job_name: "prometheus"
static_configs:
- targets: ["192.168.2.34:9100"]

View File

@ -1,5 +0,0 @@
---
- name: restart prometheus
systemd:
name: prometheus
state: restarted

View File

@ -1,34 +0,0 @@
galaxy_info:
author: your name
description: your role description
company: your company (optional)
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
# - MIT
# - GPL-2.0-or-later
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: license (GPL-2.0-or-later, MIT, etc)
min_ansible_version: 2.1
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.

View File

@ -1,86 +0,0 @@
---
- name: Install dependencies
apt:
name:
- wget
- tar
- curl
state: present
update_cache: yes
when: ansible_os_family == "Debian"
- name: Create prometheus user and group
user:
name: "{{ prometheus_user }}"
group: "{{ prometheus_group }}"
system: yes
create_home: no
- name: Create required directories
file:
path: "{{ item }}"
state: directory
owner: "{{ prometheus_user }}"
group: "{{ prometheus_group }}"
mode: '0755'
with_items:
- "{{ prometheus_install_dir }}"
- "{{ prometheus_data_dir }}"
- "{{ prometheus_config_dir }}"
- name: Download Prometheus
get_url:
url: "https://github.com/prometheus/prometheus/releases/download/v{{ prometheus_version }}/prometheus-{{ prometheus_version }}.linux-amd64.tar.gz"
dest: "/tmp/prometheus-{{ prometheus_version }}.tar.gz"
- name: Extract Prometheus
unarchive:
src: "/tmp/prometheus-{{ prometheus_version }}.tar.gz"
dest: "{{ prometheus_install_dir }}"
remote_src: yes
- name: Move binaries to /usr/local/bin
command:
cmd: mv "{{ prometheus_install_dir }}/prometheus-{{ prometheus_version }}.linux-amd64/{{ item }}" /usr/local/bin/
with_items:
- "prometheus"
- "promtool"
- name: Set ownership of Prometheus files
file:
path: "{{ item }}"
owner: "{{ prometheus_user }}"
group: "{{ prometheus_group }}"
recurse: yes
with_items:
- "{{ prometheus_install_dir }}"
- "{{ prometheus_data_dir }}"
- "{{ prometheus_config_dir }}"
- name: Copy prometheus.yml configuration
copy:
src: prometheus.yml
dest: "{{ prometheus_config_dir }}/prometheus.yml"
owner: "{{ prometheus_user }}"
group: "{{ prometheus_group }}"
mode: '0644'
notify:
- restart prometheus
- name: Copy systemd service file
copy:
src: prometheus.service
dest: /etc/systemd/system/prometheus.service
owner: root
group: root
mode: '0644'
- name: Reload systemd
systemd:
daemon_reload: yes
- name: Enable Prometheus service
systemd:
name: prometheus
enabled: yes
state: started

View File

@ -1,2 +0,0 @@
localhost

View File

@ -1,5 +0,0 @@
---
- hosts: localhost
remote_user: root
roles:
- prometheus-common

View File

@ -1,9 +0,0 @@
---
prometheus_version: "3.1.0"
prometheus_user: "prometheus"
prometheus_group: "prometheus"
prometheus_install_dir: "/opt/prometheus"
prometheus_data_dir: "/var/lib/prometheus"
prometheus_config_dir: "/etc/prometheus"
prometheus_bin: "/usr/local/bin/prometheus"
prometheus_web_listen_address: ":9090"