|
15 | 15 |
|
16 | 16 | - name: ensure dependencies (RedHat)
|
17 | 17 | yum: name="@Development tools" state=present
|
18 |
| - when: ansible_os_family == "RedHat" |
| 18 | + when: (pg_copydist is undefined) and ansible_os_family == "RedHat" |
19 | 19 | sudo: yes
|
20 | 20 |
|
21 | 21 | - name: ensure dependencies (RedHat)
|
|
27 | 27 | - bison
|
28 | 28 | - flex
|
29 | 29 | - readline-devel
|
30 |
| - when: ansible_os_family == "RedHat" |
| 30 | + when: (pg_copydist is undefined) and ansible_os_family == "RedHat" |
31 | 31 | sudo: yes
|
32 | 32 |
|
33 | 33 | - name: increase semaphores
|
34 | 34 | shell: sysctl kernel.sem='1000 128000 128 512'
|
35 | 35 | sudo: yes
|
36 | 36 |
|
| 37 | +############################################################################# |
| 38 | + |
37 | 39 | - name: clone postgres sources
|
38 | 40 | git: repo={{pg_repo}}
|
39 | 41 | dest={{pg_src}}
|
40 | 42 | version={{pg_version_tag}}
|
41 | 43 | depth=1
|
42 | 44 | accept_hostkey=True
|
43 | 45 | register: pg_sources
|
44 |
| - |
45 |
| -############################################################################# |
46 |
| - |
47 |
| -- stat: path={{pg_datadir}}/postmaster.pid |
48 |
| - register: pg_pidfile |
49 |
| - |
50 |
| -- name: stop postgres if it was running |
51 |
| - command: "{{pg_dst}}/bin/pg_ctl stop -w -D {{pg_datadir}}" |
52 |
| - when: pg_pidfile.stat.exists |
| 46 | + when: pg_copydist is undefined |
53 | 47 |
|
54 | 48 | - name: force rebuild on changed sources
|
55 | 49 | command: "rm -f {{pg_dst}}/bin/postgres"
|
56 |
| - when: pg_sources.changed |
| 50 | + when: (pg_copydist is undefined) and pg_sources.changed |
57 | 51 |
|
58 | 52 | - name: build and install
|
59 | 53 | shell: ./configure --prefix={{pg_dst}} --without-zlib && make clean && make -j {{makejobs}} && make install
|
60 | 54 | args:
|
61 | 55 | chdir: "{{pg_src}}"
|
62 | 56 | creates: "{{pg_dst}}/bin/postgres"
|
| 57 | + when: pg_copydist is undefined |
| 58 | + |
| 59 | +############################################################################# |
| 60 | + |
| 61 | +- name: copy pg source |
| 62 | + copy: src=./{{item}} dest=~/{{item}} mode=0755 |
| 63 | + with_items: |
| 64 | + - "pg_cluster_install.tgz" |
| 65 | + when: pg_copydist is defined |
| 66 | + |
| 67 | +- name: extract postgres |
| 68 | + command: "tar xzf pg_cluster_install.tgz" |
| 69 | + when: pg_copydist is defined |
| 70 | + |
| 71 | +############################################################################# |
| 72 | + |
| 73 | +- stat: path={{pg_datadir}}/postmaster.pid |
| 74 | + register: pg_pidfile |
| 75 | + |
| 76 | +- name: stop postgres if it was running |
| 77 | + command: "{{pg_dst}}/bin/pg_ctl stop -w -D {{pg_datadir}}" |
| 78 | + when: pg_pidfile.stat.exists |
63 | 79 |
|
64 | 80 | - name: remove datadirs on datanodes
|
65 | 81 | command: "rm -rf {{pg_datadir}}"
|
|
89 | 105 | dest: "{{pg_datadir}}/pg_hba.conf"
|
90 | 106 | line: "host all all 0.0.0.0/0 trust"
|
91 | 107 |
|
92 |
| -# - include: pg_shard.yml |
93 |
| -# when: deploy_pg_shard |
94 |
| - |
95 | 108 | - name: start postgrespro
|
96 | 109 | command: "{{pg_dst}}/bin/pg_ctl start -w -D {{pg_datadir}} -l {{pg_datadir}}/pg.log"
|
97 | 110 |
|
|
0 commit comments