-
-
Notifications
You must be signed in to change notification settings - Fork 209
feat: Install gandalf, salt-wrapper for infra #1657
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
e09505f
feat: Install gandalf, salt-wrapper for infra
tomashley a9b2b23
Merge branch 'develop' into tom/ansible/gandalf
tomashley c7492f5
chore: version bumps
tomashley d609e22
bumping oriole build also
tomashley 6021a15
fix: create the Gandalf group
tomashley 4c17753
fix: implicitly create the gandalf group
tomashley 43fea2e
fix: correct gandalf archive path
tomashley 43eed3d
fix: unpack gandalf build correctly
tomashley ed49334
fix: reorganise order for gandalf installs
tomashley 0ca5760
fix: point to the correct path
tomashley eaa2bb5
chore: bump vars due to conflicts
Crispy1975 4eb81c4
fix: pin version of libpq to 17.x (#1649)
samrose d6e1159
ci: no longer build Oriole QEMU artifact
darora 605f9de
chore: disable auth config reloading within qemu artifact
darora c14a67d
chore: strip out unnecessary dependencies from QEMU builds
darora fc00957
chore: version bumps
tomashley 9482865
Merge branch 'develop' into tom/ansible/gandalf
Crispy1975 65cc743
tests: update user and group test adding gandalf
Crispy1975 9dc85fd
chore: add gandalf user to user list
Crispy1975 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
%gandalf ALL= NOPASSWD: /usr/bin/salt-call | ||
%gandalf ALL= NOPASSWD: /usr/bin/gpg --homedir /etc/salt/gpgkeys --import, /usr/bin/gpg --homedir /etc/salt/gpgkeys --list-secret-keys * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[Unit] | ||
Description=Configuration management via gandalf salt | ||
After=network.target | ||
|
||
[Service] | ||
Type=oneshot | ||
ExecStart=/opt/gandalf/gandalf --config /opt/gandalf/config.yaml salt --apply --store-result | ||
User=gandalf | ||
Group=gandalf | ||
StandardOutput=journal | ||
StandardError=journal | ||
StateDirectory=gandalf | ||
CacheDirectory=gandalf | ||
|
||
# Security hardening | ||
PrivateTmp=true | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[Unit] | ||
Description=Run Supabase gandalf salt on a schedule | ||
Requires=gandalf_salt.service | ||
|
||
[Timer] | ||
OnCalendar=*:0/10 | ||
# Random delay up to 30 seconds splay | ||
RandomizedDelaySec=30 | ||
AccuracySec=1s | ||
Persistent=true | ||
|
||
[Install] | ||
WantedBy=timers.target |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
- name: gandalf - system user | ||
user: | ||
name: gandalf | ||
groups: admin,gandalf,salt | ||
append: yes | ||
system: yes | ||
shell: /bin/sh | ||
|
||
- name: Setting arch (x86) | ||
set_fact: | ||
arch: "x86" | ||
when: platform == "amd64" | ||
|
||
- name: Setting arch (arm) | ||
set_fact: | ||
arch: "arm64" | ||
when: platform == "arm64" | ||
|
||
- name: Download gandalf archive | ||
get_url: | ||
url: "https://supabase-public-artifacts-bucket.s3.amazonaws.com/gandalf/v{{ gandalf_release }}/gandalf_{{ gandalf_release }}_linux_{{ arch }}.tar.gz" | ||
dest: "/tmp/gandalf.tar.gz" | ||
timeout: 90 | ||
|
||
- name: gandalf - unpack archive in /opt | ||
unarchive: | ||
remote_src: yes | ||
src: /tmp/gandalf.tar.gz | ||
dest: /opt | ||
owner: gandalf | ||
|
||
- name: gandalf - create symlink | ||
ansible.builtin.file: | ||
path: /opt/gandalf/gandalf | ||
src: "/opt/gandalf/gandalf-linux-{{ arch }}" | ||
state: link | ||
owner: gandalf | ||
mode: '0755' | ||
force: yes | ||
|
||
- name: gandalf - config dir | ||
file: | ||
path: /opt/gandalf | ||
owner: gandalf | ||
state: directory | ||
|
||
- name: gandalf - gpg dir | ||
file: | ||
path: /etc/salt/gpgkeys | ||
owner: root | ||
group: salt | ||
state: directory | ||
|
||
- name: give gandalf user permissions | ||
copy: | ||
src: files/gandalf.sudoers.conf | ||
dest: /etc/sudoers.d/gandalf | ||
mode: "0644" | ||
|
||
- name: gandalf - create salt systemd timer file | ||
copy: | ||
src: files/gandalf_config/gandalf_salt.timer | ||
dest: /etc/systemd/system/gandalf_salt.timer | ||
|
||
- name: gandalf - create salt service file | ||
copy: | ||
src: files/gandalf_config/gandalf_salt.service | ||
dest: /etc/systemd/system/gandalf_salt.service | ||
|
||
- name: gandalf - reload systemd | ||
systemd: | ||
daemon_reload: yes | ||
|
||
# Initially ensure gandalf is installed but not started | ||
- name: gandalf - DISABLE service | ||
systemd: | ||
name: gandalf_salt | ||
enabled: no | ||
state: stopped |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.