Skip to content

Commit 3d528d0

Browse files
authored
fix(atlantis): use versioned dir + symlink, restart on changes (#748)
1 parent 73ca3a2 commit 3d528d0

1 file changed

Lines changed: 32 additions & 8 deletions

File tree

atlantis/atlantis.sls

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,35 @@ atlantis_config_repos:
3232
- contents: |
3333
{{ pillar['atlantis']['repos'] | indent(8) }}
3434
35+
atlantis_install_dir:
36+
file.directory:
37+
- name: /opt/atlantis/versions/{{ pillar['atlantis']['version'] }}
38+
- user: 0
39+
- group: 0
40+
- mode: '0755'
41+
- makedirs: True
42+
3543
atlantis_binary:
3644
archive.extracted:
37-
- name: /opt/atlantis/bin
45+
- name: /opt/atlantis/versions/{{ pillar['atlantis']['version'] }}
3846
- source: https://github.com/runatlantis/atlantis/releases/download/v{{ pillar['atlantis']['version'] }}/atlantis_linux_amd64.zip
39-
- user: 0
40-
- group: 0
47+
- source_hash: https://github.com/runatlantis/atlantis/releases/download/v{{ pillar['atlantis']['version'] }}/checksums.txt
48+
- user: root
49+
- group: root
4150
- enforce_toplevel: False
42-
- skip_verify: True
51+
- if_missing: /opt/atlantis/versions/{{ pillar['atlantis']['version'] }}/atlantis
52+
- require:
53+
- file: atlantis_install_dir
54+
55+
atlantis_symlink:
56+
file.symlink:
57+
- name: /opt/atlantis/bin/atlantis
58+
- target: /opt/atlantis/versions/{{ pillar['atlantis']['version'] }}/atlantis
59+
- force: True
60+
- require:
61+
- archive: atlantis_binary
62+
- watch_in:
63+
- service: atlantis
4364
4465
atlantis_systemd_1:
4566
file.managed:
@@ -61,7 +82,7 @@ systemd-reload:
6182
cmd.run:
6283
- name: systemctl daemon-reload
6384
- onchanges:
64-
- file: /etc/systemd/system/atlantis.service
85+
- file: atlantis_systemd_1
6586
6687
atlantis_systemd_2:
6788
service.running:
@@ -72,8 +93,11 @@ atlantis_systemd_3:
7293
cmd.run:
7394
- name: systemctl restart atlantis
7495
- onchanges:
75-
- file: /etc/systemd/system/atlantis.service
76-
- file: /opt/atlantis/etc/config.yaml
77-
- file: /opt/atlantis/etc/repos.yaml
96+
- file: atlantis_systemd_1
97+
- file: atlantis_config
98+
- file: atlantis_config_repos
99+
- file: atlantis_symlink
100+
- require:
101+
- cmd: systemd-reload
78102
{% endif %}
79103

0 commit comments

Comments
 (0)