-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.yml
82 lines (67 loc) · 2.1 KB
/
main.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# vim:ft=yaml.ansible:
- name: Start setups
hosts: all
gather_facts: false
become: true
pre_tasks:
- name: Check if python3 is present
ansible.builtin.raw: test -e /usr/bin/python3
changed_when: false
failed_when: false
register: check_python
- name: Try to install python3 if not present
ansible.builtin.raw: "pacman -Sy --noconfirm python3; apt update; apt install -y python3; dnf -y install python3"
when: check_python.rc != 0
changed_when: check_python.rc != 0
failed_when: false
tasks:
- name: Gather fact now that python is installed
ansible.builtin.setup:
- name: Set path for distribution details
ansible.builtin.set_fact:
dist_detail_path: "vars/distributionDetails/"
- name: Import distro variables
ansible.builtin.include_vars: "{{ item }}"
when: "item is file"
loop:
- '{{ dist_detail_path }}Default.json'
- '{{ dist_detail_path }}{{ ansible_os_family }}.json'
- '{{ dist_detail_path }}{{ ansible_distribution }}.json'
- '{{ dist_detail_path }}{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.json'
- '{{ dist_detail_path }}{{ ansible_distribution }}-{{ ansible_distribution_version }}.json'
- name: Import general purpose variables
ansible.builtin.include_vars: "vars/general.json"
- name: Creating urls for Elasticsearch
ansible.builtin.set_fact:
elastic_cluster_elastic_url: "https://elastic:{{ elastic_elastic_password }}@localhost:9200"
elastic_cluster_osinter_url: "https://osinter:{{ elastic_osinter_password }}@localhost:9200"
- name: Setup prerequisites
hosts: all
become: true
roles:
- prerequisites
- name: Setup Elasticsearch
hosts: elasticsearch
become: true
roles:
- elasticsearch
- name: Setup backend
hosts: backend
become: true
roles:
- backend
- name: Setup api
hosts: api
become: true
roles:
- api
- name: Setup the webfrontend
hosts: frontend
become: true
roles:
- frontend
- name: Setup nginx
hosts: nginx
become: true
roles:
- nginx