|
| 1 | +- name: gandalf - system user |
| 2 | + user: |
| 3 | + name: gandalf |
| 4 | + groups: admin,gandalf,salt |
| 5 | + append: yes |
| 6 | + system: yes |
| 7 | + shell: /bin/sh |
| 8 | + |
| 9 | +- name: Setting arch (x86) |
| 10 | + set_fact: |
| 11 | + arch: "x86" |
| 12 | + when: platform == "amd64" |
| 13 | + |
| 14 | +- name: Setting arch (arm) |
| 15 | + set_fact: |
| 16 | + arch: "arm64" |
| 17 | + when: platform == "arm64" |
| 18 | + |
| 19 | +- name: Download gandalf archive |
| 20 | + get_url: |
| 21 | + url: "https://supabase-public-artifacts-bucket.s3.amazonaws.com/gandalf/v{{ gandalf_release }}/gandalf_{{ gandalf_release }}_linux_{{ arch }}.tar.gz" |
| 22 | + dest: "/tmp/gandalf.tar.gz" |
| 23 | + timeout: 90 |
| 24 | + |
| 25 | +- name: gandalf - unpack archive in /opt |
| 26 | + unarchive: |
| 27 | + remote_src: yes |
| 28 | + src: /tmp/gandalf.tar.gz |
| 29 | + dest: /opt |
| 30 | + owner: gandalf |
| 31 | + |
| 32 | +- name: gandalf - create symlink |
| 33 | + ansible.builtin.file: |
| 34 | + path: /opt/gandalf/gandalf |
| 35 | + src: "/opt/gandalf/gandalf-linux-{{ arch }}" |
| 36 | + state: link |
| 37 | + owner: gandalf |
| 38 | + mode: '0755' |
| 39 | + force: yes |
| 40 | + |
| 41 | +- name: gandalf - config dir |
| 42 | + file: |
| 43 | + path: /opt/gandalf |
| 44 | + owner: gandalf |
| 45 | + state: directory |
| 46 | + |
| 47 | +- name: gandalf - gpg dir |
| 48 | + file: |
| 49 | + path: /etc/salt/gpgkeys |
| 50 | + owner: root |
| 51 | + group: salt |
| 52 | + state: directory |
| 53 | + |
| 54 | +- name: give gandalf user permissions |
| 55 | + copy: |
| 56 | + src: files/gandalf.sudoers.conf |
| 57 | + dest: /etc/sudoers.d/gandalf |
| 58 | + mode: "0644" |
| 59 | + |
| 60 | +- name: gandalf - create salt systemd timer file |
| 61 | + copy: |
| 62 | + src: files/gandalf_config/gandalf_salt.timer |
| 63 | + dest: /etc/systemd/system/gandalf_salt.timer |
| 64 | + |
| 65 | +- name: gandalf - create salt service file |
| 66 | + copy: |
| 67 | + src: files/gandalf_config/gandalf_salt.service |
| 68 | + dest: /etc/systemd/system/gandalf_salt.service |
| 69 | + |
| 70 | +- name: gandalf - reload systemd |
| 71 | + systemd: |
| 72 | + daemon_reload: yes |
| 73 | + |
| 74 | +# Initially ensure gandalf is installed but not started |
| 75 | +- name: gandalf - DISABLE service |
| 76 | + systemd: |
| 77 | + name: gandalf_salt |
| 78 | + enabled: no |
| 79 | + state: stopped |
0 commit comments