I just tested (bit modified sls, no pillar so hard coded the version for testing in a throw away nspawn container). I downloaded first the tarball using the /opt destination, and then copied the downloaded directory to /mnt.
mattermost-opt:
archive.extracted:
- name: /mnt
- source: https://releases.mattermost.com/desktop/5.0.4/mattermost-desktop-5.0.4-linux-x64.tar.gz
- source_hash: sha256=cbd2981ce282eecfea1167c500d900cdd31bd041b0861025743b7d58e4cb9229
- user: mattermost
- group: mattermost
- require:
- mattermost-usergroup
It's working properly. No additional downloads. In fact, the archive state is slim enough to not redownload the archive if it's cached in /var/cache/salt/minion/extrn_files/{{saltenv}}, it will verify the hash and unpack stuff in the destination directory in case a file is missing.
So here it does nothing, everything is in place:
# salt-call state.apply mattermost
local:
----------
ID: mattermost-usergroup
Function: user.present
Name: mattermost
Result: True
Comment: User mattermost is present and up to date
Started: 21:09:26.078971
Duration: 12.33 ms
Changes:
----------
ID: mattermost-opt
Function: archive.extracted
Name: /mnt
Result: True
Comment: All files in archive are already present
Started: 21:09:26.091829
Duration: 1030.216 ms
Changes:
Summary for local
------------
Succeeded: 2
Failed: 0
------------
Total states run: 2
Total run time: 1.043 s
Let's remove one file from the untarred archive and retry it:
# rm /mnt/mattermost-desktop-5.0.4-linux-x64/vk_swiftshader_icd.json # salt-call state.apply mattermost
local:
----------
ID: mattermost-usergroup
Function: user.present
Name: mattermost
Result: True
Comment: User mattermost is present and up to date
Started: 21:09:45.753688
Duration: 11.511 ms
Changes:
----------
ID: mattermost-opt
Function: archive.extracted
Name: /mnt
Result: True
Comment: https://releases.mattermost.com/desktop/5.0.4/mattermost-desktop-5.0.4-linux-x64.tar.gz extracted to /mnt/, due to absence of one or more files/dirs. Output was trimmed to False number of lines
Started: 21:09:45.765712
Duration: 2165.587 ms
Changes:
----------
extracted_files:
{{ trimmed output }}
- mattermost-desktop-5.0.4-linux-x64/vk_swiftshader_icd.json
updated ownership:
True
Summary for local
------------
Succeeded: 2 (changed=1)
Failed: 0
------------
Total states run: 2
Total run time: 2.177 s