File tree Expand file tree Collapse file tree 6 files changed +20
-21
lines changed Expand file tree Collapse file tree 6 files changed +20
-21
lines changed Original file line number Diff line number Diff line change 1
1
* .retry
2
- inventory /manual
2
+ inventory_manual /manual
3
3
logs /
4
4
5
5
/postgresql.conf.common
6
6
/postgresql.conf.lord
7
- /postgresql.conf.worker
7
+ /postgresql.conf.worker
8
+
9
+ * .log
Original file line number Diff line number Diff line change 1
- # ## initdb and send configs
1
+ # ## initdb, send configs and add all workers.
2
2
3
3
---
4
4
- hosts : nodes
68
68
- name : add manual workers
69
69
command : >
70
70
psql -p {{ pg_port }} -c "select shardman.add_node(
71
- 'hostaddr={{ item] }} port={{ pg_port }}')"
71
+ 'hostaddr={{ item }} port={{ pg_port }}')"
72
72
with_items : " {{ groups.manual_workers }}"
73
73
tags :
74
74
- add_nodes
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ pg_repo=git://git.postgresql.org/git/postgresql.git
17
17
pg_version_tag=REL_10_STABLE
18
18
pg_prefix="{{ansible_env.HOME}}/pg"
19
19
pg_src="{{pg_prefix}}/src"
20
+ cflags="-O0"
20
21
pg_dst="{{pg_prefix}}/install"
21
22
pg_datadir="{{pg_prefix}}/data_{{pg_port}}"
22
23
pg_logfile="{{pg_datadir}}/pg.log"
@@ -31,7 +32,7 @@ shardman_repo=https://github.com/postgrespro/pg_shardman.git
31
32
shardman_src="{{pg_prefix}}/pg_shardman"
32
33
shardman_version_tag=master
33
34
34
- cflags="-O0 "
35
+ shardman_shardlord_connstring="host={{ shardlord_ip }} port={{ pg_port }} user={{ ansible_user }} "
35
36
36
37
[nodes:children]
37
38
ec2
@@ -55,10 +56,16 @@ manual_init_node
55
56
56
57
# empty groups to be able to run without ec2/manual inventories
57
58
[ec2]
59
+ [ec2:vars]
60
+ # for ec2, take private ip
61
+ shardlord_ip="{{ hostvars[groups['shardlord'][0]]['ec2_private_ip_address'] }}"
58
62
[ec2_shardlord]
59
63
[ec2_workers]
60
64
[ec2_init_node]
61
65
[manual]
66
+ [manual:vars]
67
+ # for manual, use just ip specified in inventory
68
+ shardlord_ip="{{ groups['shardlord'][0] }}"
62
69
[manual_shardlord]
63
70
[manual_workers]
64
71
[manual_init_node]
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -51,6 +51,8 @@ ansible-playbook -i inventory_ec2 pg_ctl.yml -e "pg_ctl_action=restart"
51
51
52
52
Read cmd log on shardlord:
53
53
ansible-playbook -i inventory_ec2/ psql.yml --limit 'shardlord' -e "cmd='\'table shardman.cmd_log\''"
54
+ Read nodes table on workers:
55
+ nodes': ansible-playbook -i inventory_manual/ psql.yml --limit 'workers' -e "cmd='\'table shardman.nodes\''"
54
56
55
57
Gather logs to ./logs:
56
58
ansible-playbook -i inventory_ec2/ logs.yml
@@ -67,6 +69,8 @@ Things that made me wonder during writing this:
67
69
why projects like
68
70
https://github.com/larsks/ansible-toolbox
69
71
emerge. Printing cmd output via saved var is pretty horrible too.
72
+ * They also try to reinvent all the concepts of normal languages in YML. How
73
+ about infinite repeat..until?
70
74
* No way to specify multiple inventory files, only whole directory or one file.
71
75
* No way to append file to file, except for j2 templates, which doesn't work
72
76
with files outside the template dir, really?
Original file line number Diff line number Diff line change 5
5
6
6
{% include "postgresql.conf.lord" ignore missing %}
7
7
8
+ shardman.shardlord_connstring = '{{ shardman_shardlord_connstring }}'
9
+
8
10
{% include "postgresql.conf.devops.common" ignore missing %}
9
11
10
12
{% include "postgresql.conf.devops.lord" ignore missing %}
You can’t perform that action at this time.
0 commit comments