Skip to content

Commit d2b671a

Browse files
committed
Nomad 0.5.0 and better tasks
- Nomad 0.5.0 - Automatic SHA determination - Streamline and split out install, Docker, and SELinux tasks - Remove deprecated task files - Establish OS vars - Update documentation
1 parent b985bb1 commit d2b671a

File tree

14 files changed

+138
-241
lines changed

14 files changed

+138
-241
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ examples/hashistack
66
examples/hosts
77
files/*.zip
88
files/nomad
9+
nomad_*_SHA256SUMS

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,12 @@
101101

102102
- Correct var
103103
- More SELinux config
104+
105+
## v1.4.0
106+
107+
- Nomad 0.5.0
108+
- Automatic SHA determination
109+
- Streamline and split out install, Docker, and SELinux tasks
110+
- Remove deprecated task files
111+
- Establish OS vars
112+
- Update documentation

defaults/main.yml

Lines changed: 5 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
---
22
# File: defaults/main.yml - Main default variables for nomad
33

4-
nomad_version: "0.4.1"
4+
nomad_version: "0.5.0"
55
nomad_server_count: "2"
6+
nomad_checksum_file_url: "https://releases.hashicorp.com/nomad/{{ nomad_version }}/nomad_{{ nomad_version}}_SHA256SUMS"
67
nomad_zip_url: "https://releases.hashicorp.com/nomad/{{ nomad_version }}/nomad_{{ nomad_version }}_linux_amd64.zip"
78
nomad_zip_sha256: "0cdb5dd95c918c6237dddeafe2e9d2049558fea79ed43eacdfcd247d5b093d67"
89
nomad_bin_dir: "/usr/local/bin"
@@ -23,47 +24,7 @@ nomad_apt_key_url: "hkp://p80.pool.sks-keyservers.net:80"
2324
nomad_apt_key_sig: 58118E89F3A912897C070ADBF76221572C52609D
2425
nomad_apt_repo: deb https://apt.dockerproject.org/repo {{ ansible_lsb.id|lower }}-{{ ansible_lsb.codename|lower }} main
2526

26-
## Package vars
27-
28-
nomad_centos_pkg: "nomad_{{ nomad_version }}_linux_amd64.zip"
29-
nomad_centos_url: "{{ nomad_zip_url }}"
30-
nomad_centos_sha256: "{{ nomad_zip_sha256 }}"
31-
32-
nomad_centos_os_packages:
33-
- curl
34-
- git
35-
- libselinux-python
36-
- unzip
37-
38-
nomad_debian_pkg: "nomad_{{ nomad_version }}_linux_amd64.zip"
39-
nomad_debian_url: "{{ nomad_zip_url }}"
40-
nomad_debian_sha256: "{{ nomad_zip_sha256 }}"
41-
nomad_docker_debian_repo: "deb https://apt.dockerproject.org/repo debian-jessie main"
42-
nomad_debian_os_packages:
43-
- cgroup-bin
44-
- curl
45-
- git
46-
- libcgroup1
47-
- unzip
48-
49-
nomad_redhat_pkg: "nomad_{{ nomad_version }}_linux_amd64.zip"
50-
nomad_redhat_url: "{{ nomad_zip_url }}"
51-
nomad_redhat_sha256: "{{ nomad_zip_sha256 }}"
52-
53-
nomad_redhat_os_packages:
54-
- curl
55-
- git
56-
- libselinux-python
57-
- unzip
58-
59-
nomad_ubuntu_pkg: "nomad_{{ nomad_version }}_linux_amd64.zip"
60-
nomad_ubuntu_url: "{{ nomad_zip_url }}"
61-
nomad_ubuntu_sha256: "{{ nomad_zip_sha256 }}"
62-
nomad_docker_ubuntu_repo: "deb https://apt.dockerproject.org/repo ubuntu-xenial main"
63-
nomad_ubuntu_os_packages:
64-
- cgroup-bin
65-
- curl
66-
- git
67-
- libcgroup1
68-
- unzip
27+
## Distribution
6928

29+
### Consul
30+
nomad_pkg: "nomad_{{ nomad_version }}_linux_amd64.zip"

tasks/CentOS.yml

Lines changed: 0 additions & 42 deletions
This file was deleted.

tasks/Debian.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

tasks/RedHat.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

tasks/Ubuntu.yml

Lines changed: 0 additions & 50 deletions
This file was deleted.

tasks/docker.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
# File: tasks/docker.yml - Docker tasks for nomad
3+
4+
## Docker items
5+
6+
# Fix for https://github.com/docker/docker/issues/23347
7+
- name: Install dmsetup for Ubuntu 16.04
8+
apt:
9+
pkg: dmsetup
10+
state: "{{ dmsetup_pkg_state }}"
11+
update_cache: yes
12+
cache_valid_time: 600
13+
register: dmsetup_result
14+
when: ansible_distribution_version|version_compare(16.04, '=') and nomad_docker_enable == "true"
15+
tags: docker
16+
17+
- name: Run dmsetup for Ubuntu 16.04
18+
command: dmsetup mknodes
19+
when: dmsetup_result
20+
tags: docker

tasks/install.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
# File: tasks/install.yml - package installation tasks for Nomad
3+
4+
- name: OS packages
5+
package: "name={{ item }} state=present"
6+
with_items: "{{ nomad_os_packages }}"
7+
tags: installation
8+
9+
- name: Get nomad package checksum file
10+
become: no
11+
connection: local
12+
get_url: "url={{ nomad_checksum_file_url }} dest={{ role_path }}/files/nomad_{{ nomad_version }}_SHA256SUMS"
13+
run_once: true
14+
tags: installation
15+
16+
- name: Get nomad package checksum
17+
become: no
18+
connection: local
19+
shell: "grep {{ nomad_pkg }} {{ role_path }}/files/nomad_{{ nomad_version }}_SHA256SUMS"
20+
run_once: true
21+
register: nomad_sha256
22+
tags: installation
23+
24+
- name: Download nomad
25+
become: no
26+
connection: local
27+
get_url: "url={{ nomad_zip_url }} dest={{ role_path }}/files/{{ nomad_pkg }} checksum=sha256:{{ nomad_sha256.stdout.split(' ')|first }} timeout=42"
28+
run_once: true
29+
tags: installation
30+
31+
- name: Unarchive nomad
32+
become: no
33+
connection: local
34+
unarchive: "src={{ role_path }}/files/{{ nomad_pkg }} dest={{ role_path }}/files/ creates={{ role_path }}/files/nomad"
35+
run_once: true
36+
tags: installation
37+
38+
- name: Install nomad
39+
copy: "src={{ role_path }}/files/nomad dest=/usr/local/bin/ owner={{ nomad_user }} group={{ nomad_group }} mode=0755"
40+
tags: installation
41+
42+
- name: Cleanup
43+
become: no
44+
connection: local
45+
file: "dest={{ role_path }}/files/nomad* state=absent"
46+
run_once: true
47+
tags: installation

0 commit comments

Comments
 (0)