File tree Expand file tree Collapse file tree 9 files changed +78
-24
lines changed
chatops_deployment/ansible Expand file tree Collapse file tree 9 files changed +78
-24
lines changed Original file line number Diff line number Diff line change 11---
2+ - name : Add SSH key to agent
3+ hosts : localhost
4+ tags :
5+ - key
6+ tasks :
7+ - name : Add SSH key
8+ ansible.builtin.include_role :
9+ name : add_ssh_key
10+
211- name : Configure load balancer
312 hosts : stack
413 roles :
3544 tags :
3645 - grafana
3746
47+ - name : Attach volume
48+ hosts : stack
49+ gather_facts : true
50+ roles :
51+ - volume
52+ tags :
53+ - volume
54+
3855- name : Configure Prometheus
3956 hosts : stack
4057 roles :
Original file line number Diff line number Diff line change 77 name : terraform
88 tasks_from : deploy
99
10- - name : Add known hosts of bastion host and private VMs
10+ - name : Add SSH key to agent
11+ hosts : localhost
12+ tasks :
13+ - name : Add SSH key
14+ ansible.builtin.include_role :
15+ name : add_ssh_key
16+
17+ - name : Add known host of stack VM
1118 hosts : localhost
1219 gather_facts : false
1320 roles :
Original file line number Diff line number Diff line change 1+ ---
2+ - name : Install expect
3+ become : true
4+ ansible.builtin.apt :
5+ name : expect
6+ update_cache : true
7+
8+ - name : Start ssh-agent
9+ # noqa: command-instead-of-shell
10+ # interpolation is not supported by the command module
11+ ansible.builtin.shell : ' eval $("ssh-agent -s")'
12+ register : add_ssh_key_start_agent
13+ changed_when : add_ssh_key_start_agent.rc == 0
14+
15+ - name : Add key to ssh-agent
16+ # noqa: command-instead-of-shell
17+ # We must use shell here as here-docs don't work with command
18+ ansible.builtin.shell : |
19+ expect << EOF
20+ spawn ssh-add {{ env }}-bastion-key
21+ expect "Enter passphrase for {{ env }}-bastion-key:"
22+ send "{{ bastion_key_passphrase }}\r"
23+ expect eof
24+ EOF
25+ register : add_ssh_key_add_key
26+ changed_when : add_ssh_key_add_key.rc == 0
Original file line number Diff line number Diff line change 11---
22path :
3- data : /var/elasticsearch/data
3+ data : /var/stack/ elasticsearch/data
44 logs : /var/log/elasticsearch
55cluster.name : chatops-elasticsearch
66xpack.security.enabled : true
Original file line number Diff line number Diff line change 3636 state : latest # noqa: package-latest
3737 update_cache : true
3838
39- - name : Attach data volume to Elasticsearch data directory
40- become : true
41- ansible.posix.mount :
42- boot : true
43- path : /var/elasticsearch/data
44- src : " {{ elasticsearch_device }}"
45- state : mounted
46- fstype : ext4
47-
4839- name : Set permissions on volume
4940 become : true
5041 ansible.builtin.file :
51- path : /var/elasticsearch/data
42+ path : /var/stack/ elasticsearch/data
5243 state : directory
5344 owner : root
5445 group : elasticsearch
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ Group=prometheus
99Restart =on-failure
1010ExecStart =/opt/prometheus/prometheus \
1111 --config.file =/opt/prometheus/prometheus.yml \
12- --storage.tsdb.path =/opt /prometheus/data \
12+ --storage.tsdb.path =/var/stack /prometheus/data \
1313 --storage.tsdb.retention.time =30d \
1414 --web.config.file =/opt/prometheus/web.yml
1515StandardOutput =append:/var/log/prometheus/prometheus.log
Original file line number Diff line number Diff line change 3434 - Move Prometheus binaries
3535 - Start Prometheus
3636
37- - name : Attach volume to Prometheus data directory
38- become : true
39- ansible.posix.mount :
40- boot : true
41- path : /var/prometheus/data
42- src : " {{ prometheus_device }}"
43- state : mounted
44- fstype : ext4
37+ - name : Flush handlers to move binaries
38+ ansible.builtin.meta : flush_handlers
4539
4640- name : Set permissions on volume
4741 become : true
4842 ansible.builtin.file :
49- path : /var/prometheus/data
43+ path : /var/stack/ prometheus/data
5044 state : directory
5145 owner : prometheus
5246 group : prometheus
5347 mode : " 0774"
48+ recurse : true
5449
5550- name : Copy prometheus service file
5651 become : true
Original file line number Diff line number Diff line change 2626- name : Download and extract systemd-exporter
2727 become : true
2828 ansible.builtin.unarchive :
29- src : " https://github.com/prometheus-community/systemd_exporter/releases/download/v{{ systemd_exporter_version }}/systemd_exporter-{{ systemd_exporter_version
30- }}.linux-amd64.tar.gz"
29+ src : " https://github.com/prometheus-community/systemd_exporter/releases/download/v{{ systemd_exporter_version }}/
30+ systemd_exporter-{{ systemd_exporter_version }}.linux-amd64.tar.gz"
3131 dest : /tmp
3232 remote_src : true
3333 creates : " /tmp/systemd_exporter-{{ systemd_exporter_version }}.linux-amd64"
Original file line number Diff line number Diff line change 1+ ---
2+ - name : Attach volume to stack host
3+ become : true
4+ ansible.posix.mount :
5+ boot : true
6+ path : /var/stack
7+ src : " {{ ansible_local.terraform.vars.stack_device }}"
8+ state : mounted
9+ fstype : ext4
10+
11+ - name : Set permissions
12+ become : true
13+ ansible.builtin.file :
14+ state : directory
15+ path : /var/stack
16+ owner : ubuntu
17+ group : ubuntu
18+ mode : " 0775"
You can’t perform that action at this time.
0 commit comments