Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ansible/playbooks/paas/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
ansible.builtin.apt:
pkg:
- python3-debian
- python3-venv
- unzip
- make
- jq
Expand All @@ -38,7 +39,10 @@

roles:
- unattended-upgrades
- ansible-ufw

- name: Configure timesyncd
ansible.builtin.import_playbook: timesyncd.yml
- name: Configure systemd resolved
ansible.builtin.import_playbook: systemd-resolved.yml
- name: Configure docker
Expand Down
4 changes: 0 additions & 4 deletions ansible/playbooks/paas/metrology.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
hosts: "{{ hosts_limit | default('infrastructure') }}"
gather_facts: true
become: true
vars_prompt:
- name: project
prompt: project name
private: false
tasks:
- name: End the play for hosts that are not in admins group
ansible.builtin.meta: end_host
Expand Down
10 changes: 5 additions & 5 deletions ansible/playbooks/paas/roles/prometheus/templates/config.j2
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ scrape_configs:
regex: "^(__tmp_keep_me)$"

static_configs:
{% for item in groups['infrastructure'] | default([]) if item.split('.')[4] == project %}
{% for item in groups['infrastructure'] | default([]) if item.split('.')[4] == prometheus_project %}
- targets: ['{{ hostvars[item]['ansible_' + hostvars[item].nomad_iface]['ipv4']['address'] }}:9100']
labels:
instance: "{{ item }}"
Expand Down Expand Up @@ -178,7 +178,7 @@ scrape_configs:
tls_config:
insecure_skip_verify: true
static_configs:
{% for item in groups['infrastructure'] | default([]) if item.split('.')[4] == project %}
{% for item in groups['infrastructure'] | default([]) if item.split('.')[4] == prometheus_project %}
- targets: ['{{ hostvars[item]['ansible_' + hostvars[item].nomad_iface]['ipv4']['address'] }}:9558']
labels:
instance: "{{ item }}"
Expand All @@ -194,7 +194,7 @@ scrape_configs:
format: ['prometheus']
metrics_path: /metrics
static_configs:
{% for item in groups['infrastructure'] | default([]) if item.split('.')[4] == project %}
{% for item in groups['infrastructure'] | default([]) if item.split('.')[4] == prometheus_project %}
- targets: ['{{ hostvars[item]['ansible_' + hostvars[item].nomad_iface]['ipv4']['address'] }}:9835']
labels:
instance: "{{ item }}"
Expand All @@ -214,7 +214,7 @@ scrape_configs:
tls_config:
insecure_skip_verify: true
static_configs:
{% for item in groups['infrastructure'] | default([]) if item.split('.')[4] == project %}
{% for item in groups['infrastructure'] | default([]) if item.split('.')[4] == prometheus_project %}
- targets: ['{{ hostvars[item]['ansible_' + hostvars[item].nomad_iface]['ipv4']['address'] }}:4646']
labels:
instance: "{{ item }}"
Expand Down Expand Up @@ -246,7 +246,7 @@ scrape_configs:
tls_config:
insecure_skip_verify: true
static_configs:
{% for item in groups['infrastructure'] | default([]) if item.split('.')[4] == project %}
{% for item in groups['infrastructure'] | default([]) if item.split('.')[4] == prometheus_project %}
- targets: ['{{ hostvars[item]['ansible_' + hostvars[item].nomad_iface]['ipv4']['address'] }}:9080']
labels:
instance: "{{ item }}"
Expand Down
6 changes: 3 additions & 3 deletions ansible/playbooks/paas/roles/script_exporter/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
- name: Script_exporter | Include upstream variables
ansible.builtin.include_vars: upstream.yml

- name: Script_exporter | Get speedtest script
include_tasks: speedtest.yml

- name: Script_exporter | Get binary
include_tasks: build.yml
when: ansible_local[image.name] is not defined or ansible_local[image.name] != latest_version

- name: Script_exporter | Get speedtest script
include_tasks: speedtest.yml

- name: Script_exporter | Create custom directories
ansible.builtin.file:
dest: "{{ item }}"
Expand Down
50 changes: 9 additions & 41 deletions ansible/playbooks/paas/roles/script_exporter/tasks/speedtest.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,18 @@
---
- debug:
msg: "https://install.speedtest.net/app/cli/ookla-speedtest-1.2.0-linux-{{ script_exporter_scripts.speedtest.architecture_map[ansible_facts.architecture] }}.tgz"
- name: Install speedtest packages
ansible.builtin.apt:
pkg:
- speedtest-cli

- name: Script_exporter | Create temporary build directory
ansible.builtin.file:
path: "{{ item }}"
recurse: true
state: directory
mode: '0755'
loop:
- "{{ build_work_dir }}/download"
- "{{ build_work_dir }}/{{ upstream_default_arch }}"

- name: Script_exporter | Download speedtest script
ansible.builtin.get_url:
url: "https://install.speedtest.net/app/cli/ookla-speedtest-1.2.0-linux-{{ script_exporter_scripts.speedtest.architecture_map[ansible_facts.architecture] }}.tgz"
dest: "{{ build_work_dir }}/download/speedtest.tgz"
mode: '0644'
force: no
register: download_result

- name: Script_exporter | Unarchive speedtest script
ansible.builtin.unarchive:
src: "{{ build_work_dir }}/download/speedtest.tgz"
dest: "{{ build_work_dir }}/download"
remote_src: true
when: download_result.changed

- name: Script_exporter | Install binary
- name: Script_exporter | Install speedtest-exporter
ansible.builtin.copy:
src: "{{ build_work_dir }}/download/speedtest"
src: speedtest-exporter
dest: /usr/local/bin/
owner: root
group: root
mode: '0755'
remote_src: true

- name: Script_exporter | Clean up
- name: Script_exporter | Remove old speedtest binary (TODO remove)
ansible.builtin.file:
path: "{{ build_work_dir }}"
state: absent

- name: Script_exporter | Install speedtest-exporter
ansible.builtin.copy:
src: speedtest-exporter
dest: /usr/local/bin/
owner: root
group: root
mode: '0755'
path: /usr/local/bin/speedtest
state: absent
2 changes: 1 addition & 1 deletion ansible/playbooks/paas/roles/script_exporter/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ script_exporter_scripts:
armv7: armhf
amd64: amd64
x86_64: x86_64
aarch64: aarch64
aarch64: arm64
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
listener 1883
persistence true
persistence_location /mosquitto/data/
log_type all
log_type error
log_dest file /mosquitto/log/mosquitto.log
allow_anonymous true
4 changes: 2 additions & 2 deletions ui/controllers/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ exports.install = function() {
ROUTE('+API /api/ -users_remove/{id} --> Users/remove');
ROUTE('-API /api/ +login --> Users/login');

ROUTE('+API /api/ -settings_read --> Users/settings_read');
ROUTE('+API /api/ +settings_update --> Users/settings_update');
ROUTE('+API /api/ -profile_read --> Users/profile_read');
ROUTE('+API /api/ +profile_update --> Users/profile_update');
ROUTE('+API /api/ +password --> Users/password_update');
ROUTE('+GET /logout/ --> Users/logout');

Expand Down
10 changes: 0 additions & 10 deletions ui/definitions/init.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
CONF.$customtitles = true;
CONF.version = '1.1';

MAIN.users = [];

(async function() {
var tmp = [];
for (let m of tmp) {
if (m !== null && m !== 'bot')
MAIN.users.push(m);
}
})();

LOCALIZE(ctrl => ctrl.query.language || (ctrl.user ? ctrl.user.language : CONF.language));
12 changes: 6 additions & 6 deletions ui/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<ui-component name="miniform" path="common.form" config="if:~PATH~;icon:cog;title:@(User settings);autofocus:true;reload:?/reload;scrollbar:1;submit:?/submit;width:400" class="hidden ~PATH~" plugin="~PATH~">
<ui-component name="miniform" path="common.form" config="if:~PATH~;icon:cog;title:@(User profile);autofocus:true;reload:?/reload;scrollbar:1;submit:?/submit;width:400" class="hidden ~PATH~" plugin="~PATH~">
<div>
<div class="padding">
<div class="grid-2">
Expand Down Expand Up @@ -30,14 +30,14 @@
<script>
PLUGIN(function(exports) {
exports.reload = function() {
exports.tapi('settings_read ERROR', function(result) {
exports.tapi('profile_read ERROR', function(result) {
exports.set(result);
});
};

exports.submit = function(hide) {
var model = exports.form;
exports.tapi('settings_update ERROR', model, function(result) {
exports.tapi('profile_update ERROR', model, function(result) {
hide();
SETTER('notify/success', '@(Done)');
});
Expand Down
2 changes: 1 addition & 1 deletion ui/schemas/spotlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ NEWACTION('Spotlight/search', {
ORIGIN.push({ id: 'users', form: 'formusers', search: 'users', name: TRANSLATE($.user.language || '', '@(Users)'), icon: 'users', color: '#EB73F8' });
ORIGIN.push('-');
}
ORIGIN.push({ id: 'settings', form: 'formsettings', search: 'settings', name: TRANSLATE($.user.language || '', '@(Your profile)'), icon: 'settings', color: '#EB73F8' });
ORIGIN.push({ id: 'profile', form: 'formprofile', search: 'profile', name: TRANSLATE($.user.language || '', '@(Your profile)'), icon: 'user', color: '#EB73F8' });
ORIGIN.push({ id: 'password', form: 'formpassword', search: 'user password', name: TRANSLATE($.user.language || '', '@(Your password)'), icon: 'key', color: '#EB73F8' });
ORIGIN.push('-');
ORIGIN.push({ id: 'logout', form: 'logout', search: 'logout', name: TRANSLATE($.user.language || '', '@(Logout)'), icon: 'power-off', color: '#EA71B0' });
Expand Down
8 changes: 4 additions & 4 deletions ui/schemas/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ NEWSCHEMA('Users', function (schema) {
}
});

schema.action('settings_read', {
name: 'Read a user information',
schema.action('profile_read', {
name: 'Read user profile',
action: async function ($) {
const user = await DATA.read('nosql/users')
.where('id', $.user.id)
Expand All @@ -173,8 +173,8 @@ NEWSCHEMA('Users', function (schema) {
}
});

schema.action('settings_update', {
name: 'Save settings',
schema.action('profile_update', {
name: 'Save user profile',
input: '*first_name:String, *last_name:String, *email:Email, *language:String',
action: async function ($, model) {
await DATA.update('nosql/users', model)
Expand Down
3 changes: 2 additions & 1 deletion ui/views/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@
<ui-component name="importer" path="common.form2" config="if:formsoftware;url:/forms/software.html"></ui-component>
<ui-component name="importer" path="common.form" config="if:formusers;url:/forms/users.html"></ui-component>
<ui-component name="importer" path="common.form2" config="if:formuser;url:/forms/user.html"></ui-component>
<ui-component name="importer" path="common.form" config="if:formsettings;url:/forms/settings.html"></ui-component>
<ui-component name="importer" path="common.form" config="if:formprofile;url:/forms/profile.html"></ui-component>
<ui-component name="importer" path="common.form" config="if:formpassword;url:/forms/password.html"></ui-component>
<ui-component name="importer" path="common.form" config="if:formsettings;url:/forms/settings.html"></ui-component>

@{json(model, 'pluginsdata')}

Expand Down