Skip to content

Commit

Permalink
fix: calculate nomad_cpu_total_compute on arm & arm64
Browse files Browse the repository at this point in the history
Works around the issue reported in hashicorp/nomad#2638
  • Loading branch information
kennethkalmer committed Jan 3, 2021
1 parent 3c065af commit 6fc9ed7
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,17 @@
notify:
- restart nomad

- name: Calculate nomad_cpu_total_compute for amd64
shell: >-
cpu_freq="$(dmidecode -t 4 | grep 'Current Speed' | sed 's/.*: //' | sed 's/ .*//' | awk '{s+=$1} END {print s}')"
cpu_count=$(dmidecode -t 4 | grep 'Core Enabled' | sed 's/.*: //' | sed 's/ .*//' | awk '{s+=$1} END {print s}')
echo $(( $cpu_count * $cpu_freq ))
args:
executable: /bin/bash
register: nomad_cpu_total_compute
when:
- nomad_architecture in ['arm', 'arm64']

- name: Client configuration
template:
src: client.hcl.j2
Expand Down

0 comments on commit 6fc9ed7

Please sign in to comment.