Skip to content

Commit ae6f474

Browse files
committed
Merge branch 'devel'
2 parents 04ad446 + faf5d37 commit ae6f474

File tree

6 files changed

+82
-144
lines changed

6 files changed

+82
-144
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,3 +147,9 @@
147147
## v1.5.0
148148

149149
- Version fix
150+
151+
## v1.5.1
152+
153+
- Enable the service when starting
154+
- Prefer compact YAML in tasks
155+
- Task cleanup

handlers/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
# handlers file for nomad
2+
# File: main.yml handlers file for nomad

meta/main.yml

Lines changed: 7 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -2,133 +2,27 @@
22
galaxy_info:
33
author: Brian Shumate
44
description: Nomad cluster role
5-
company: your company (optional)
6-
# If the issue tracker for your role is not on github, uncomment the
7-
# next line and provide a value
8-
# issue_tracker_url: http://example.com/issue/tracker
9-
# Some suggested licenses:
10-
# - BSD (default)
11-
# - MIT
12-
# - GPLv2
13-
# - GPLv3
14-
# - Apache
15-
# - CC-BY
16-
license: license BSD
17-
min_ansible_version: 1.9
18-
#
19-
# Below are all platforms currently available. Just uncomment
20-
# the ones that apply to your role. If you don't see your
21-
# platform on this list, let us know and we'll get it added!
22-
#
5+
company:
6+
license: BSD
7+
min_ansible_version: 2.1.0.0
238
platforms:
249
- name: EL
2510
versions:
26-
# - all
27-
# - 5
2811
- 6
2912
- 7
30-
#- name: GenericUNIX
31-
# versions:
32-
# - all
33-
# - any
34-
#- name: Fedora
35-
# versions:
36-
# - all
37-
# - 16
38-
# - 17
39-
# - 18
40-
# - 19
41-
# - 20
42-
# - 21
43-
# - 22
44-
#- name: SmartOS
45-
# versions:
46-
# - all
47-
# - any
48-
#- name: opensuse
49-
# versions:
50-
# - all
51-
# - 12.1
52-
# - 12.2
53-
# - 12.3
54-
# - 13.1
55-
# - 13.2
56-
#- name: Amazon
57-
# versions:
58-
# - all
59-
# - 2013.03
60-
# - 2013.09
61-
#- name: GenericBSD
62-
# versions:
63-
# - all
64-
# - any
6513
#- name: FreeBSD
6614
# versions:
67-
# - all
68-
# - 8.0
69-
# - 8.1
70-
# - 8.2
71-
# - 8.3
72-
# - 8.4
73-
# - 9.0
74-
# - 9.1
75-
# - 9.1
76-
# - 9.2
15+
# - 11.0
7716
- name: Ubuntu
7817
versions:
79-
# - all
80-
# - lucid
81-
# - maverick
82-
# - natty
83-
# - oneiric
84-
# - precise
85-
# - quantal
86-
# - raring
87-
# - saucy
88-
- trusty
89-
# - utopic
90-
# - vivid
91-
#- name: SLES
92-
# versions:
93-
# - all
94-
# - 10SP3
95-
# - 10SP4
96-
# - 11
97-
# - 11SP1
98-
# - 11SP2
99-
# - 11SP3
100-
#- name: GenericLinux
101-
# versions:
102-
# - all
103-
# - any
18+
- xenial
10419
- name: Debian
10520
versions:
106-
# - all
107-
# - etch
10821
- jessie
109-
# - lenny
110-
# - squeeze
111-
# - wheezy
112-
#
113-
# Below are all categories currently available. Just as with
114-
# the platforms above, uncomment those that apply to your role.
115-
#
11622
galaxy_tags:
117-
#- cloud
118-
#- cloud:ec2
119-
#- cloud:gce
120-
#- cloud:rax
23+
- cloud
12124
- clustering
122-
#- database
123-
#- database:nosql
124-
#- database:sql
125-
#- development
126-
#- monitoring
12725
- networking
128-
#- packaging
26+
- scheduling
12927
- system
130-
#- web
13128
dependencies: []
132-
# List your role dependencies here, one per line.
133-
# Be sure to remove the '[]' above if you add dependencies
134-
# to this list.

tasks/docker.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616

1717
- name: Run dmsetup for Ubuntu 16.04
1818
command: dmsetup mknodes
19-
when: dmsetup_result
20-
tags: docker
19+
when: dmsetup_result
20+
tags: docker

tasks/main.yml

Lines changed: 65 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
# File: tasks/main.yml - Main tasks for nomad
2+
# File: tasks/main.yml - Main tasks for Nomad
33

44
- name: Check distribution compatibility
55
fail:
@@ -8,73 +8,111 @@
88

99
- name: Fail if not a new release of Red Hat / CentOS
1010
fail:
11-
msg: "{{ ansible_distribution_version }} is not an acceptable version of {{ ansible_distribution }} for this role"
11+
msg: "{{ ansible_distribution_version }} is not a supported version of {{ ansible_distribution }} for this role"
1212
when: ansible_distribution in ['RedHat', 'CentOS'] and ansible_distribution_version|version_compare(6, '<')
1313

1414
- name: Fail if not a new release of Debian
1515
fail:
16-
msg: "{{ ansible_distribution_version }} is not an acceptable version of {{ ansible_distribution }} for this role"
16+
msg: "{{ ansible_distribution_version }} is not a supported version of {{ ansible_distribution }} for this role"
1717
when: ansible_distribution == "Debian" and ansible_distribution_version|version_compare(8.5, '<')
1818

1919
- name: Fail if not a new release of Ubuntu
2020
fail:
21-
msg: "{{ ansible_distribution_version }} is not an acceptable version of {{ ansible_distribution }} for this role"
21+
msg: "{{ ansible_distribution_version }} is not a supported version of {{ ansible_distribution }} for this role"
2222
when: ansible_distribution == "Ubuntu" and ansible_distribution_version|version_compare(13.04, '<')
2323

2424
- name: Create cluster groupings
25-
group_by: key={{ nomad_node_role }}
26-
27-
- group_by: key=os_{{ ansible_os_family }}
28-
29-
- name: "Add nomad user"
30-
user: name=nomad comment="nomad user" uid=1047 group=bin
31-
32-
- name: "Add nomad user to docker group"
33-
user: name=nomad groups=docker append=yes
25+
group_by:
26+
key: "{{ nomad_node_role }}"
27+
28+
- group_by:
29+
key: "os_{{ ansible_os_family }}"
30+
31+
- name: Add Nomad user
32+
user:
33+
name: nomad
34+
comment: "Nomad user"
35+
uid: 1047
36+
group: bin
37+
38+
- name: Add Nomad user to docker group
39+
user:
40+
name: nomad
41+
groups: docker
42+
append: yes
3443
when: nomad_enable_docker == "true"
3544

36-
# Include variables and define needed variables.
37-
- name: Include OS-specific variables.
45+
- name: Include OS variables
3846
include_vars: "{{ ansible_os_family }}.yml"
39-
40-
- name: Install specified packages
47+
48+
- name: Install OS packages
4149
include: install.yml
4250

4351
- name: Disable SELinux (RHEL)
4452
include: selinux.yml
4553
when: ansible_os_family == "RedHat"
4654

47-
- name: Directories
48-
file: "dest={{ item }} state=directory owner={{ nomad_user }} group={{ nomad_group}}"
55+
- name: Create directories
56+
file:
57+
dest: "{{ item }}"
58+
state: directory
59+
owner: "{{ nomad_user }}"
60+
group: "{{ nomad_group}}"
4961
with_items:
5062
- /opt/nomad
5163
- /var/nomad
5264
- /var/run/nomad
5365
- /etc/nomad.d
5466

5567
- name: Base configuration
56-
template: src=base.hcl.j2 dest={{ nomad_config_dir }}/base.hcl
68+
template:
69+
src: base.hcl.j2
70+
dest: "{{ nomad_config_dir }}/base.hcl"
5771

5872
- name: Bootstrap server configuration
59-
template: src=bootstrap.hcl.j2 dest={{ nomad_config_dir }}/bootstrap.hcl
73+
template:
74+
src: bootstrap.hcl.j2
75+
dest: "{{ nomad_config_dir }}/bootstrap.hcl"
6076

6177
- name: Server configuration
62-
template: src=server.hcl.j2 dest={{ nomad_config_dir }}/server.hcl
78+
template:
79+
src: server.hcl.j2
80+
dest: "{{ nomad_config_dir }}/server.hcl"
6381

6482
- name: Client configuration
65-
template: src=client.hcl.j2 dest={{ nomad_config_dir }}/client.hcl
83+
template:
84+
src: client.hcl.j2
85+
dest: "{{ nomad_config_dir }}/client.hcl"
6686

6787
- name: SYSV init script
68-
template: src=nomad_sysvinit.j2 dest=/etc/init.d/nomad owner=root group=root mode=755
88+
template:
89+
src: nomad_sysvinit.j2
90+
dest: /etc/init.d/nomad
91+
owner: root
92+
group: root
93+
mode: 0755
6994
when: not ansible_service_mgr == "systemd" and not ansible_os_family == "Debian"
7095

7196
- name: Debian init script
72-
template: src=nomad_debian.init.j2 dest=/etc/init.d/nomad owner=root group=root mode=755
97+
template:
98+
src: nomad_debian.init.j2
99+
dest: /etc/init.d/nomad
100+
owner: root
101+
group: root
102+
mode: 0755
73103
when: not ansible_service_mgr == "systemd" and ansible_os_family == "Debian"
74104

75105
- name: systemd script
76-
template: src=nomad_systemd.service.j2 dest=/lib/systemd/system/nomad.service owner=root group=root mode=644
106+
template:
107+
src: nomad_systemd.service.j2
108+
dest: /lib/systemd/system/nomad.service
109+
owner: root
110+
group: root
111+
mode: 644
77112
when: ansible_service_mgr == "systemd"
78113

79114
- name: Start Nomad
80-
service: name=nomad state=started
115+
service:
116+
name: nomad
117+
enabled: yes
118+
state: started

version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v1.5.0
1+
v1.5.1

0 commit comments

Comments
 (0)