Skip to content

Commit 7b4257c

Browse files
committed
ability to copy compiled postgres instead of building it
1 parent baa9046 commit 7b4257c

File tree

2 files changed

+49
-32
lines changed

2 files changed

+49
-32
lines changed

tests/deploy/cluster.yml

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,38 @@
11
---
22

33
- hosts: nodes
4+
# gather_facts: no
5+
# pre_tasks:
6+
# - name: make a list
7+
# set_fact:
8+
# ansible_os_family: "Debian"
49

510
roles:
6-
711
- role: postgres
812
pg_port: 15432
913
pg_repo: https://github.com/kelvich/postgresql.git
1014
pg_version_tag: xtm_patched
1115
pg_destroy_and_init: true
16+
pg_copydist: true
1217
pg_config_role:
1318
- line: "dtm.vacuum_delay=60"
1419

1520
tasks:
16-
17-
- name: clone dtm sources
18-
git: repo=https://github.com/postgrespro/pg_tsdtm.git
19-
dest={{pg_prefix}}/pg_tsdtm
20-
accept_hostkey=yes
21-
update=yes
22-
force=yes
23-
register: dtm_sources
24-
25-
- name: build dtm
26-
shell: "make clean && make -j {{makejobs}} install"
27-
args:
28-
chdir: "{{pg_prefix}}/pg_tsdtm"
29-
environment:
30-
PG_CONFIG: "{{pg_dst}}/bin/pg_config"
31-
when: dtm_sources.changed
21+
# - name: clone dtm sources
22+
# git: repo=https://github.com/postgrespro/pg_tsdtm.git
23+
# dest={{pg_prefix}}/pg_tsdtm
24+
# accept_hostkey=yes
25+
# update=yes
26+
# force=yes
27+
# register: dtm_sources
28+
29+
# - name: build dtm
30+
# shell: "make clean && make -j {{makejobs}} install"
31+
# args:
32+
# chdir: "{{pg_prefix}}/pg_tsdtm"
33+
# environment:
34+
# PG_CONFIG: "{{pg_dst}}/bin/pg_config"
35+
# when: dtm_sources.changed
3236

3337
- name: enable dtm extension on datanodes
3438
lineinfile:

tests/deploy/roles/postgres/tasks/main.yml

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
- name: ensure dependencies (RedHat)
1717
yum: name="@Development tools" state=present
18-
when: ansible_os_family == "RedHat"
18+
when: (pg_copydist is undefined) and ansible_os_family == "RedHat"
1919
sudo: yes
2020

2121
- name: ensure dependencies (RedHat)
@@ -27,39 +27,55 @@
2727
- bison
2828
- flex
2929
- readline-devel
30-
when: ansible_os_family == "RedHat"
30+
when: (pg_copydist is undefined) and ansible_os_family == "RedHat"
3131
sudo: yes
3232

3333
- name: increase semaphores
3434
shell: sysctl kernel.sem='1000 128000 128 512'
3535
sudo: yes
3636

37+
#############################################################################
38+
3739
- name: clone postgres sources
3840
git: repo={{pg_repo}}
3941
dest={{pg_src}}
4042
version={{pg_version_tag}}
4143
depth=1
4244
accept_hostkey=True
4345
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
5347

5448
- name: force rebuild on changed sources
5549
command: "rm -f {{pg_dst}}/bin/postgres"
56-
when: pg_sources.changed
50+
when: (pg_copydist is undefined) and pg_sources.changed
5751

5852
- name: build and install
5953
shell: ./configure --prefix={{pg_dst}} --without-zlib && make clean && make -j {{makejobs}} && make install
6054
args:
6155
chdir: "{{pg_src}}"
6256
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
6379

6480
- name: remove datadirs on datanodes
6581
command: "rm -rf {{pg_datadir}}"
@@ -89,9 +105,6 @@
89105
dest: "{{pg_datadir}}/pg_hba.conf"
90106
line: "host all all 0.0.0.0/0 trust"
91107

92-
# - include: pg_shard.yml
93-
# when: deploy_pg_shard
94-
95108
- name: start postgrespro
96109
command: "{{pg_dst}}/bin/pg_ctl start -w -D {{pg_datadir}} -l {{pg_datadir}}/pg.log"
97110

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy