-
Notifications
You must be signed in to change notification settings - Fork 3
/
install.yml
63 lines (56 loc) · 1.84 KB
/
install.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
---
- name: "Create inventory with target host(s)"
hosts: localhost
connection: local
gather_facts: no
tasks:
- include_role:
name: inventory_helper
tasks_from: create_single_host_inventory.yml
- name: GET /catalog/service/consul
ansible.builtin.uri:
url: "{{ lookup('env', 'CONSUL_URL') }}/v1/catalog/service/consul"
method: GET
headers:
Authorization: "Bearer {{ lookup('env', 'CONSUL_TOKEN') }}"
register: get_consul_service_nodes
- name: Set public consul server ip
ansible.builtin.set_fact:
consul_public_server_ip: "{{ get_consul_service_nodes.json | map(attribute='Address') | default([]) | first }}"
- name: Set public consul server url
ansible.builtin.set_fact:
consul_public_server_url: "http://{{consul_public_server_ip}}:8500"
delegate_to: "{{ item }}"
delegate_facts: true
loop: "{{ groups['all'] }}"
- name: "Install - FabOS Device"
hosts: all
gather_facts: yes
become: yes
tasks:
- ansible.builtin.include_role:
name: "node_exporter"
- ansible.builtin.include_role:
name: "basyx_server"
- name: Install consul client
ansible.builtin.include_role:
name: "consul"
vars:
consul_url: "{{ consul_public_server_url }}"
consul_token: "{{ lookup('env', 'CONSUL_TOKEN') }}"
consul_client_node_id: "{{ resource_id }}"
- name: "Add host to Prometheus targets"
hosts: all
gather_facts: no
become: no
vars:
ansible_connection: local
tasks:
- ansible.builtin.include_role:
name: "prometheus"
tasks_from: add_target.yml
vars:
node_exporter_port: 9100
consul_url: "{{ consul_public_server_url }}"
consul_token: "{{ lookup('env', 'CONSUL_TOKEN') }}"
consul_client_node_id: "{{ resource_id }}"