|
31 | 31 | sudo: yes
|
32 | 32 |
|
33 | 33 | - name: clone postgres sources
|
34 |
| - git: repo=git://git.postgresql.org/git/postgresql.git |
| 34 | + git: repo={{pg_repo}} |
35 | 35 | dest={{pg_src}}
|
36 | 36 | version={{pg_version_tag}}
|
37 |
| - force=yes |
38 |
| - update=yes |
39 | 37 | depth=1
|
40 | 38 | accept_hostkey=True
|
41 | 39 | register: pg_sources
|
42 | 40 |
|
43 |
| -- name: upload patches |
44 |
| - get_url: "url={{pg_patch}} dest={{pg_src}}/p1.patch" |
45 |
| - # when: pg_sources.before != pg_sources.after |
46 |
| - |
47 |
| -- name: patch postgres |
48 |
| - patch: > |
49 |
| - src={{pg_src}}/p1.patch |
50 |
| - basedir={{pg_src}} |
51 |
| - remote_src=True |
52 |
| - strip=1 |
53 |
| -
|
54 |
| -
|
55 | 41 | #############################################################################
|
56 | 42 |
|
57 |
| -# - stat: path={{pg_datadir}}/postmaster.pid |
58 |
| -# register: pg_pidfile |
59 |
| - |
60 |
| -# - name: stop postgres if it was running |
61 |
| -# command: "{{pg_dst}}/bin/pg_ctl stop -w -D {{pg_datadir}}" |
62 |
| -# when: pg_pidfile.stat.exists |
63 |
| - |
64 |
| -# - name: force rebuild on changed sources |
65 |
| -# command: "rm {{pg_dst}}/bin/postgres" |
66 |
| -# when: pg_sources.changed |
67 |
| - |
68 |
| -# - name: build and install |
69 |
| -# shell: ./configure --prefix={{pg_dst}} --without-zlib && make clean && make -j {{makejobs}} && make install |
70 |
| -# args: |
71 |
| -# chdir: "{{pg_src}}" |
72 |
| -# creates: "{{pg_dst}}/bin/postgres" |
73 |
| - |
74 |
| -# - name: remove datadirs on datanodes |
75 |
| -# command: "rm -rf {{pg_datadir}}" |
76 |
| -# when: pg_destroy_and_init |
77 |
| - |
78 |
| -# - name: create datadirs on datanodes |
79 |
| -# command: "{{pg_dst}}/bin/initdb {{pg_datadir}}" |
80 |
| -# args: |
81 |
| -# creates: "{{pg_datadir}}" |
82 |
| - |
83 |
| -# - name: configure postgres on datanodes |
84 |
| -# lineinfile: |
85 |
| -# dest: "{{pg_datadir}}/postgresql.conf" |
86 |
| -# line: "{{item.line}}" |
87 |
| -# state: present |
88 |
| -# with_items: "{{pg_config}}" |
89 |
| - |
90 |
| -# - name: configure postgres on datanodes -- 2 |
91 |
| -# lineinfile: |
92 |
| -# dest: "{{pg_datadir}}/postgresql.conf" |
93 |
| -# line: "{{item.line}}" |
94 |
| -# state: present |
95 |
| -# with_items: "{{pg_config_role}}" |
96 |
| - |
97 |
| -# - name: enable blind trust on datanodes |
98 |
| -# lineinfile: |
99 |
| -# dest: "{{pg_datadir}}/pg_hba.conf" |
100 |
| -# line: "host all all 0.0.0.0/0 trust" |
101 |
| - |
102 |
| -# # - include: pg_shard.yml |
103 |
| -# # when: deploy_pg_shard |
104 |
| - |
105 |
| -# - name: start postgrespro |
106 |
| -# command: "{{pg_dst}}/bin/pg_ctl start -w -D {{pg_datadir}} -l {{pg_datadir}}/pg.log" |
| 43 | +- stat: path={{pg_datadir}}/postmaster.pid |
| 44 | + register: pg_pidfile |
| 45 | + |
| 46 | +- name: stop postgres if it was running |
| 47 | + command: "{{pg_dst}}/bin/pg_ctl stop -w -D {{pg_datadir}}" |
| 48 | + when: pg_pidfile.stat.exists |
| 49 | + |
| 50 | +- name: force rebuild on changed sources |
| 51 | + command: "rm {{pg_dst}}/bin/postgres" |
| 52 | + when: pg_sources.changed |
| 53 | + |
| 54 | +- name: build and install |
| 55 | + shell: ./configure --prefix={{pg_dst}} --without-zlib && make clean && make -j {{makejobs}} && make install |
| 56 | + args: |
| 57 | + chdir: "{{pg_src}}" |
| 58 | + creates: "{{pg_dst}}/bin/postgres" |
| 59 | + |
| 60 | +- name: remove datadirs on datanodes |
| 61 | + command: "rm -rf {{pg_datadir}}" |
| 62 | + when: pg_destroy_and_init |
| 63 | + |
| 64 | +- name: create datadirs on datanodes |
| 65 | + command: "{{pg_dst}}/bin/initdb {{pg_datadir}}" |
| 66 | + args: |
| 67 | + creates: "{{pg_datadir}}" |
| 68 | + |
| 69 | +- name: configure postgres on datanodes |
| 70 | + lineinfile: |
| 71 | + dest: "{{pg_datadir}}/postgresql.conf" |
| 72 | + line: "{{item.line}}" |
| 73 | + state: present |
| 74 | + with_items: "{{pg_config}}" |
| 75 | + |
| 76 | +- name: configure postgres on datanodes -- 2 |
| 77 | + lineinfile: |
| 78 | + dest: "{{pg_datadir}}/postgresql.conf" |
| 79 | + line: "{{item.line}}" |
| 80 | + state: present |
| 81 | + with_items: "{{pg_config_role}}" |
| 82 | + |
| 83 | +- name: enable blind trust on datanodes |
| 84 | + lineinfile: |
| 85 | + dest: "{{pg_datadir}}/pg_hba.conf" |
| 86 | + line: "host all all 0.0.0.0/0 trust" |
| 87 | + |
| 88 | +# - include: pg_shard.yml |
| 89 | +# when: deploy_pg_shard |
| 90 | + |
| 91 | +- name: start postgrespro |
| 92 | + command: "{{pg_dst}}/bin/pg_ctl start -w -D {{pg_datadir}} -l {{pg_datadir}}/pg.log" |
107 | 93 |
|
108 | 94 |
|
109 | 95 |
|
0 commit comments