diff --git a/inventory.ini b/inventory.ini deleted file mode 100644 index ddecea5..0000000 --- a/inventory.ini +++ /dev/null @@ -1,10 +0,0 @@ -$ANSIBLE_VAULT;1.1;AES256 -36326338343966663165373732326261623264396335386137356339363562353364373434313938 -3335353137343230306563623464336630343532353035610a383736643433376133393038623135 -34313638383030613464366537653735613166353264646263643433613161393666356461666633 -3331366464393830620a313566623035636337323864393366316334343063323761626462303936 -64626530663763336436396164363931393034353834666538383761303634666531396464316430 -63646438633062303363383135396662653733336330353462663433306534383936373334386466 -65303034323436363830383361366535663238316561393365353864323337666330326635323261 -31306265326362653835633839343961646265643730333961616633316136313832303730373362 -66373532333634373165336665303363663565643833333230616332643866323562 diff --git a/prometheus/main.yml b/prometheus/main.yml deleted file mode 100644 index 9e1e7f1..0000000 --- a/prometheus/main.yml +++ /dev/null @@ -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 \ No newline at end of file diff --git a/prometheus/roles/grafana-common/README.md b/prometheus/roles/grafana-common/README.md deleted file mode 100644 index 225dd44..0000000 --- a/prometheus/roles/grafana-common/README.md +++ /dev/null @@ -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). diff --git a/prometheus/roles/grafana-common/defaults/main.yml b/prometheus/roles/grafana-common/defaults/main.yml deleted file mode 100644 index 4eab591..0000000 --- a/prometheus/roles/grafana-common/defaults/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# defaults file for grafana-common diff --git a/prometheus/roles/grafana-common/handlers/main.yml b/prometheus/roles/grafana-common/handlers/main.yml deleted file mode 100644 index e0191e1..0000000 --- a/prometheus/roles/grafana-common/handlers/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# handlers file for grafana-common diff --git a/prometheus/roles/grafana-common/meta/main.yml b/prometheus/roles/grafana-common/meta/main.yml deleted file mode 100644 index ea68190..0000000 --- a/prometheus/roles/grafana-common/meta/main.yml +++ /dev/null @@ -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. diff --git a/prometheus/roles/grafana-common/tasks/main.yml b/prometheus/roles/grafana-common/tasks/main.yml deleted file mode 100644 index 6ca0849..0000000 --- a/prometheus/roles/grafana-common/tasks/main.yml +++ /dev/null @@ -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 diff --git a/prometheus/roles/grafana-common/tests/inventory b/prometheus/roles/grafana-common/tests/inventory deleted file mode 100644 index 878877b..0000000 --- a/prometheus/roles/grafana-common/tests/inventory +++ /dev/null @@ -1,2 +0,0 @@ -localhost - diff --git a/prometheus/roles/grafana-common/tests/test.yml b/prometheus/roles/grafana-common/tests/test.yml deleted file mode 100644 index 0bb8afa..0000000 --- a/prometheus/roles/grafana-common/tests/test.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -- hosts: localhost - remote_user: root - roles: - - grafana-common diff --git a/prometheus/roles/grafana-common/vars/main.yml b/prometheus/roles/grafana-common/vars/main.yml deleted file mode 100644 index 2ebc9c4..0000000 --- a/prometheus/roles/grafana-common/vars/main.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -grafana_version: 11.4.0 -grafana_arch: amd64 -destination_directory: /home/user diff --git a/prometheus/roles/prometheus-common/README.md b/prometheus/roles/prometheus-common/README.md deleted file mode 100644 index 225dd44..0000000 --- a/prometheus/roles/prometheus-common/README.md +++ /dev/null @@ -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). diff --git a/prometheus/roles/prometheus-common/defaults/main.yml b/prometheus/roles/prometheus-common/defaults/main.yml deleted file mode 100644 index 8b6910b..0000000 --- a/prometheus/roles/prometheus-common/defaults/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# defaults file for prometheus-common diff --git a/prometheus/roles/prometheus-common/files/prometheus.service b/prometheus/roles/prometheus-common/files/prometheus.service deleted file mode 100644 index 64e6864..0000000 --- a/prometheus/roles/prometheus-common/files/prometheus.service +++ /dev/null @@ -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 \ No newline at end of file diff --git a/prometheus/roles/prometheus-common/files/prometheus.yml b/prometheus/roles/prometheus-common/files/prometheus.yml deleted file mode 100644 index 4c5a9bd..0000000 --- a/prometheus/roles/prometheus-common/files/prometheus.yml +++ /dev/null @@ -1,7 +0,0 @@ -global: - scrape_interval: 15s - evaluation_interval: 15s -scrape_configs: - - job_name: "prometheus" - static_configs: - - targets: ["192.168.2.34:9100"] diff --git a/prometheus/roles/prometheus-common/handlers/main.yml b/prometheus/roles/prometheus-common/handlers/main.yml deleted file mode 100644 index 5925f9d..0000000 --- a/prometheus/roles/prometheus-common/handlers/main.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -- name: restart prometheus - systemd: - name: prometheus - state: restarted diff --git a/prometheus/roles/prometheus-common/meta/main.yml b/prometheus/roles/prometheus-common/meta/main.yml deleted file mode 100644 index ea68190..0000000 --- a/prometheus/roles/prometheus-common/meta/main.yml +++ /dev/null @@ -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. diff --git a/prometheus/roles/prometheus-common/tasks/main.yml b/prometheus/roles/prometheus-common/tasks/main.yml deleted file mode 100644 index 84a7f3f..0000000 --- a/prometheus/roles/prometheus-common/tasks/main.yml +++ /dev/null @@ -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 diff --git a/prometheus/roles/prometheus-common/tests/inventory b/prometheus/roles/prometheus-common/tests/inventory deleted file mode 100644 index 878877b..0000000 --- a/prometheus/roles/prometheus-common/tests/inventory +++ /dev/null @@ -1,2 +0,0 @@ -localhost - diff --git a/prometheus/roles/prometheus-common/tests/test.yml b/prometheus/roles/prometheus-common/tests/test.yml deleted file mode 100644 index 583eacd..0000000 --- a/prometheus/roles/prometheus-common/tests/test.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -- hosts: localhost - remote_user: root - roles: - - prometheus-common diff --git a/prometheus/roles/prometheus-common/vars/main.yml b/prometheus/roles/prometheus-common/vars/main.yml deleted file mode 100644 index 7abcb3b..0000000 --- a/prometheus/roles/prometheus-common/vars/main.yml +++ /dev/null @@ -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"