Added support for installation on ARM architectures.

This commit is contained in:
J. Eduardo 2017-04-04 23:31:13 +02:00
parent f254e1d300
commit 7725253f1a
3 changed files with 22 additions and 6 deletions

View file

@ -1,6 +1,5 @@
consul: consul:
version: 0.7.0 version: 0.7.0
hash: b350591af10d7d23514ebaa0565638539900cdb3aaa048f077217c4c46653dd8
download_host: releases.hashicorp.com download_host: releases.hashicorp.com
service: false service: false

View file

@ -39,14 +39,14 @@ consul-data-dir:
# Install agent # Install agent
consul-download: consul-download:
file.managed: file.managed:
- name: /tmp/consul_{{ consul.version }}_linux_amd64.zip - name: /tmp/consul_{{ consul.version }}_linux_{{ consul.arch }}.zip
- source: https://{{ consul.download_host }}/consul/{{ consul.version }}/consul_{{ consul.version }}_linux_amd64.zip - source: https://{{ consul.download_host }}/consul/{{ consul.version }}/consul_{{ consul.version }}_linux_{{ consul.arch }}.zip
- source_hash: sha256={{ consul.hash }} - source_hash: https://releases.hashicorp.com/consul/{{ consul.version }}/consul_{{ consul.version }}_SHA256SUMS
- unless: test -f /usr/local/bin/consul-{{ consul.version }} - unless: test -f /usr/local/bin/consul-{{ consul.version }}
consul-extract: consul-extract:
cmd.wait: cmd.wait:
- name: unzip /tmp/consul_{{ consul.version }}_linux_amd64.zip -d /tmp - name: unzip /tmp/consul_{{ consul.version }}_linux_{{ consul.arch }}.zip -d /tmp
- watch: - watch:
- file: consul-download - file: consul-download
@ -61,7 +61,7 @@ consul-install:
consul-clean: consul-clean:
file.absent: file.absent:
- name: /tmp/consul_{{ consul.version }}_linux_amd64.zip - name: /tmp/consul_{{ consul.version }}_linux_{{ consul.arch }}.zip
- watch: - watch:
- file: consul-install - file: consul-install

View file

@ -1,5 +1,22 @@
{% import_yaml "consul/defaults.yaml" as defaults %} {% import_yaml "consul/defaults.yaml" as defaults %}
{## Add any overrides based on CPU architecture. ##}
{% set cpu_arch_map = salt['grains.filter_by']({
'armv6l': {
"arch": 'arm'
},
'armv7l': {
"arch": 'arm'
},
'x86_64': {
"arch": 'amd64'
}
}
,grain="cpuarch"
,merge=salt['pillar.get']('consul'))
%}
{% do defaults.consul.update(cpu_arch_map) %}
{% set consul = salt['pillar.get']('consul', default=defaults.consul, merge=True) %} {% set consul = salt['pillar.get']('consul', default=defaults.consul, merge=True) %}
{% do consul.config.update({'retry_join': consul.config.retry_join or []}) %} {% do consul.config.update({'retry_join': consul.config.retry_join or []}) %}