Better method for installing new versions

This commit is contained in:
Bahadır Kandemir 2015-10-22 20:14:15 +03:00
parent aa30374be6
commit f1fecea83e
2 changed files with 33 additions and 31 deletions

View file

@ -1,4 +1,6 @@
consul: consul:
version: 0.5.2
hash: b3ae610c670fc3b81737d44724ebde969da66ebf
service: false service: false
config: config:
server: false server: false

View file

@ -3,44 +3,44 @@
unzip: unzip:
pkg.installed pkg.installed
/usr/local/bin:
file.directory:
- recuse: True
consul_download: consul_download:
archive.extracted: file.managed:
- name: /opt/consul - name: /tmp/{{ consul.version }}_linux_amd64.zip
- source: http://dl.bintray.com/mitchellh/consul/0.5.2_linux_{{ salt['grains.get']('osarch', '386') }}.zip - source: https://dl.bintray.com/mitchellh/consul/{{ consul.version }}_linux_amd64.zip
{% if salt['grains.get']('osarch', '386') == 'amd64' %} - source_hash: sha1={{ consul.hash }}
- source_hash: sha1=b3ae610c670fc3b81737d44724ebde969da66ebf - unless: test -f /usr/local/bin/consul-{{ consul.version }}
{% else %}
- source_hash: sha1=a4eaaa66668682f40ccb40daefcf0732a185d3a4
{% endif %}
- archive_format: zip
- require:
- pkg: unzip
consul_ui_download: consul_extract:
archive.extracted: cmd.wait:
- name: /opt/consul - name: unzip /tmp/{{ consul.version }}_linux_amd64.zip -d /tmp
- source: http://dl.bintray.com/mitchellh/consul/0.5.2_web_ui.zip - watch:
- source_hash: sha1=67a2665e3c6aa6ca95c24d6176641010a1002cd6 - file: consul_download
- archive_format: zip
- if_missing: /opt/consul/dist
- require:
- pkg: unzip
consul_template_download: consul_install:
archive.extracted: file.rename:
- name: /usr/local/bin/consul-template - name: /usr/local/bin/consul-{{ consul.version }}
- source: https://github.com/hashicorp/consul-template/releases/download/v0.11.0/consul_template_0.11.0_linux_{{ salt['grains.get']('osarch', '386') }}.zip - source: /tmp/consul
{% if salt['grains.get']('osarch', '386') == 'amd64' %} - require:
- source_hash: sha1=4db740e15f04651f296ee81413f9bef82bab6eb2 - file: /usr/local/bin
{% else %} - watch:
- source_hash: sha1=7149bd3d6d39dd9c224aeab34b099f52f9851184 - cmd: consul_extract
{% endif %}
- archive_format: zip consul_clean:
file.absent:
- name: /tmp/{{ consul.version }}_linux_amd64.zip
- watch:
- file: consul_install
consul_link: consul_link:
file.symlink: file.symlink:
- target: /opt/consul/consul - target: consul-{{ consul.version }}
- name: /usr/local/bin/consul - name: /usr/local/bin/consul
- watch:
- file: consul_install
consul_user: consul_user:
group.present: group.present: