|
1 | 1 | # Downloading dependencies
|
2 |
| -- name: wal-g dependencies |
3 |
| - become: yes |
4 |
| - apt: |
5 |
| - pkg: |
6 |
| - - libbrotli-dev |
7 |
| - - liblzo2-dev |
8 |
| - - libsodium-dev |
9 |
| - - cmake |
| 2 | +# - name: wal-g dependencies |
| 3 | +# become: yes |
| 4 | +# apt: |
| 5 | +# pkg: |
| 6 | +# - libbrotli-dev |
| 7 | +# - liblzo2-dev |
| 8 | +# - libsodium-dev |
| 9 | +# - cmake |
10 | 10 |
|
11 | 11 | # install go dependency for WAL-G
|
12 |
| -- name: wal-g go dependency |
13 |
| - get_url: |
14 |
| - url: "https://golang.org/dl/go{{ golang_version }}.linux-{{ platform }}.tar.gz" |
15 |
| - dest: /tmp |
16 |
| - checksum: "{{ golang_version_checksum[platform] }}" |
17 |
| - timeout: 60 |
| 12 | +# - name: wal-g go dependency |
| 13 | +# get_url: |
| 14 | +# url: "https://golang.org/dl/go{{ golang_version }}.linux-{{ platform }}.tar.gz" |
| 15 | +# dest: /tmp |
| 16 | +# checksum: "{{ golang_version_checksum[platform] }}" |
| 17 | +# timeout: 60 |
18 | 18 |
|
19 |
| -- name: unpack go archive |
20 |
| - unarchive: |
21 |
| - remote_src: yes |
22 |
| - src: "/tmp/go{{ golang_version }}.linux-{{ platform }}.tar.gz" |
23 |
| - dest: /usr/local |
| 19 | +# - name: unpack go archive |
| 20 | +# unarchive: |
| 21 | +# remote_src: yes |
| 22 | +# src: "/tmp/go{{ golang_version }}.linux-{{ platform }}.tar.gz" |
| 23 | +# dest: /usr/local |
24 | 24 |
|
25 |
| -# Download WAL-G |
26 |
| -- name: wal-g - download latest version |
27 |
| - git: |
28 |
| - repo: https://github.com/wal-g/wal-g.git |
29 |
| - dest: /tmp/wal-g |
30 |
| - version: "v{{ wal_g_release }}" |
31 |
| - become: yes |
| 25 | +# # Download WAL-G |
| 26 | +# - name: wal-g - download latest version |
| 27 | +# git: |
| 28 | +# repo: https://github.com/wal-g/wal-g.git |
| 29 | +# dest: /tmp/wal-g |
| 30 | +# version: "v{{ wal_g_release }}" |
| 31 | +# become: yes |
32 | 32 |
|
33 |
| -- name: wal-g - pg_clean |
34 |
| - make: |
35 |
| - chdir: /tmp/wal-g |
36 |
| - target: pg_clean |
37 |
| - params: |
38 |
| - GOBIN: "/usr/local/bin" |
39 |
| - PATH: "{{ ansible_env.PATH }}:/usr/local/go/bin" |
40 |
| - USE_LIBSODIUM: true |
41 |
| - become: yes |
42 |
| - ignore_errors: yes |
| 33 | +# - name: wal-g - pg_clean |
| 34 | +# make: |
| 35 | +# chdir: /tmp/wal-g |
| 36 | +# target: pg_clean |
| 37 | +# params: |
| 38 | +# GOBIN: "/usr/local/bin" |
| 39 | +# PATH: "{{ ansible_env.PATH }}:/usr/local/go/bin" |
| 40 | +# USE_LIBSODIUM: true |
| 41 | +# become: yes |
| 42 | +# ignore_errors: yes |
43 | 43 |
|
44 |
| -- name: wal-g - deps |
45 |
| - make: |
46 |
| - chdir: /tmp/wal-g |
47 |
| - target: deps |
48 |
| - params: |
49 |
| - GOBIN: "/usr/local/bin" |
50 |
| - PATH: "{{ ansible_env.PATH }}:/usr/local/go/bin" |
51 |
| - USE_LIBSODIUM: true |
52 |
| - become: yes |
53 |
| - ignore_errors: yes |
| 44 | +# - name: wal-g - deps |
| 45 | +# make: |
| 46 | +# chdir: /tmp/wal-g |
| 47 | +# target: deps |
| 48 | +# params: |
| 49 | +# GOBIN: "/usr/local/bin" |
| 50 | +# PATH: "{{ ansible_env.PATH }}:/usr/local/go/bin" |
| 51 | +# USE_LIBSODIUM: true |
| 52 | +# become: yes |
| 53 | +# ignore_errors: yes |
54 | 54 |
|
55 |
| -- name: wal-g - build and install |
56 |
| - community.general.make: |
57 |
| - chdir: /tmp/wal-g |
58 |
| - target: pg_install |
59 |
| - jobs: "{{ parallel_jobs | default(omit) }}" |
60 |
| - params: |
61 |
| - GOBIN: "/usr/local/bin" |
62 |
| - PATH: "{{ ansible_env.PATH }}:/usr/local/go/bin" |
63 |
| - USE_LIBSODIUM: true |
64 |
| - become: yes |
| 55 | +# - name: wal-g - build and install |
| 56 | +# community.general.make: |
| 57 | +# chdir: /tmp/wal-g |
| 58 | +# target: pg_install |
| 59 | +# jobs: "{{ parallel_jobs | default(omit) }}" |
| 60 | +# params: |
| 61 | +# GOBIN: "/usr/local/bin" |
| 62 | +# PATH: "{{ ansible_env.PATH }}:/usr/local/go/bin" |
| 63 | +# USE_LIBSODIUM: true |
| 64 | +# become: yes |
65 | 65 |
|
66 | 66 | - name: Create wal-g group
|
67 | 67 | group:
|
68 | 68 | name: wal-g
|
69 | 69 | state: present
|
| 70 | + when: nixpkg_mode |
70 | 71 |
|
71 | 72 | - name: Create wal-g user
|
72 | 73 | user:
|
|
75 | 76 | comment: WAL-G user
|
76 | 77 | group: wal-g
|
77 | 78 | groups: wal-g, postgres
|
78 |
| - |
| 79 | + when: nixpkg_mode |
79 | 80 | - name: Create a config directory owned by wal-g
|
80 | 81 | file:
|
81 | 82 | path: /etc/wal-g
|
82 | 83 | state: directory
|
83 | 84 | owner: wal-g
|
84 | 85 | group: wal-g
|
85 | 86 | mode: '0770'
|
| 87 | + when: nixpkg_mode |
86 | 88 |
|
| 89 | +- name: Install wal-g from nix binary cache |
| 90 | + become: yes |
| 91 | + shell: | |
| 92 | + sudo -u wal-g bash -c ". /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh && nix profile install github:supabase/postgres/{{ git_commit_sha }}#wal-g" |
| 93 | + when: stage2_nix |
| 94 | + |
| 95 | +- name: Create symlink for wal-g from Nix profile to /usr/local/bin |
| 96 | + ansible.builtin.file: |
| 97 | + src: /home/wal-g/.nix-profile/bin/wal-g |
| 98 | + dest: /usr/local/bin/wal-g |
| 99 | + state: link |
| 100 | + force: yes # This will replace existing file/symlink if it exists |
| 101 | + become: yes # Need sudo to write to /usr/local/bin |
| 102 | + when: stage2_nix |
87 | 103 | - name: Create /etc/wal-g/config.json
|
88 | 104 | file:
|
89 | 105 | path: /etc/wal-g/config.json
|
90 | 106 | state: touch
|
91 | 107 | owner: wal-g
|
92 | 108 | group: wal-g
|
93 | 109 | mode: '0664'
|
| 110 | + when: stage2_nix |
94 | 111 |
|
95 | 112 | - name: Move custom wal-g.conf file to /etc/postgresql-custom/wal-g.conf
|
96 | 113 | template:
|
|
99 | 116 | mode: 0664
|
100 | 117 | owner: postgres
|
101 | 118 | group: postgres
|
| 119 | + when: stage2_nix |
102 | 120 |
|
103 | 121 | - name: Add script to be run for restore_command
|
104 | 122 | template:
|
|
107 | 125 | mode: 0500
|
108 | 126 | owner: postgres
|
109 | 127 | group: postgres
|
| 128 | + when: stage2_nix |
110 | 129 |
|
111 | 130 | - name: Add helper script for wal_fetch.sh
|
112 | 131 | template:
|
113 | 132 | src: "files/walg_helper_scripts/wal_change_ownership.sh"
|
114 | 133 | dest: /root/wal_change_ownership.sh
|
115 | 134 | mode: 0700
|
116 | 135 | owner: root
|
| 136 | + when: stage2_nix |
117 | 137 |
|
118 | 138 | - name: Include /etc/postgresql-custom/wal-g.conf in postgresql.conf
|
119 | 139 | become: yes
|
120 | 140 | replace:
|
121 | 141 | path: /etc/postgresql/postgresql.conf
|
122 | 142 | regexp: "#include = '/etc/postgresql-custom/wal-g.conf'"
|
123 | 143 | replace: "include = '/etc/postgresql-custom/wal-g.conf'"
|
124 |
| - |
125 |
| -# Clean up Go |
126 |
| -- name: Uninstall Go |
127 |
| - become: yes |
128 |
| - file: |
129 |
| - path: /usr/local/go |
130 |
| - state: absent |
| 144 | + when: stage2_nix |
0 commit comments