afinando nomad para 1 servidor e 1 cliente
This commit is contained in:
parent
f356504138
commit
d4e350ffcd
@ -1,4 +1,4 @@
|
||||
- name: Instala Consul
|
||||
- name: Instala Nomad
|
||||
hosts: nomad_node
|
||||
any_errors_fatal: true
|
||||
become: true
|
||||
|
4
proxmox-inv/group_vars/all/architectures.yml
Normal file
4
proxmox-inv/group_vars/all/architectures.yml
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
pkg_arch_map:
|
||||
aarch64: arm64
|
||||
x86_64: amd64
|
3
proxmox-inv/group_vars/nomad_node/all.yml
Normal file
3
proxmox-inv/group_vars/nomad_node/all.yml
Normal file
@ -0,0 +1,3 @@
|
||||
---
|
||||
nomad_datacenter: tr4ck
|
||||
network_cidr: 192.168.1.0/24
|
@ -2,10 +2,8 @@
|
||||
nomad_version: 1.6.2
|
||||
nomad_etc_dir: /etc/nomad.d
|
||||
nomad_data_dir: /opt/nomad
|
||||
nomad_datacenter: tr4ck
|
||||
nomad_datacenter: tr4ck
|
||||
|
||||
nomad_namespaces:
|
||||
admin:
|
||||
name: admin
|
||||
client:
|
||||
name: client
|
||||
- admin
|
||||
- client
|
||||
|
@ -15,8 +15,10 @@
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
update_cache: yes
|
||||
loop:
|
||||
- python3-pip
|
||||
loop:
|
||||
- tar
|
||||
- unzip
|
||||
- py3-pip
|
||||
- nomad
|
||||
become: true
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
cmd: nomad namespace apply -descr "{{ item }} namespace" {{ item }}
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
loop: "{{ nomad_namespaces }}"
|
||||
loop: "{{ nomad_namespaces }}"
|
||||
run_once: true
|
||||
|
||||
#- name: Setup csi plugins
|
||||
|
@ -1,4 +1,9 @@
|
||||
---
|
||||
- name: clean nomad alpine distribution config
|
||||
file:
|
||||
state: absent
|
||||
path: /etc/nomad.d/server.hcl
|
||||
|
||||
- name: setup nomad server/worker config
|
||||
ansible.builtin.template:
|
||||
src: "nomad.hcl.j2"
|
||||
|
@ -1,32 +1,33 @@
|
||||
datacenter = "{{ nomad_datacenter }}"
|
||||
data_dir = "{{ nomad_data_dir }}"
|
||||
bind_addr = "{{ vm_ip }}"
|
||||
bind_addr = "0.0.0.0"
|
||||
name = "{{ vm_name }}"
|
||||
advertise {
|
||||
http = "{{ vm_ip }}"
|
||||
rpc = "{{ vm_ip }}"
|
||||
serf = "{{ vm_ip }}"
|
||||
}
|
||||
|
||||
{% if 'admin' in group_names %}
|
||||
server {
|
||||
enabled = true
|
||||
bootstrap_expect = 3
|
||||
retry_join = [{% for host in groups['admin'] %}"{{ hostvars[host]['vm_ip'] }}"{% if not loop.last %},{% endif %}{% endfor %}]
|
||||
bootstrap_expect = 1
|
||||
|
||||
# uncoment retry_join if bootstrap_expect > 1
|
||||
# retry_join = [{% for host in groups['admin'] %}"{{ hostvars[host]['vm_ip'] }}"{% if not loop.last %},{% endif %}{% endfor %}]
|
||||
}
|
||||
{% endif %}
|
||||
|
||||
{% if 'client' in group_names %}
|
||||
client {
|
||||
enabled = true
|
||||
servers = [{% for host in groups['admin'] %}"{{ hostvars[host]['vm_ip'] }}"{% if not loop.last %},{% endif %}{% endfor %}]
|
||||
|
||||
host_network "public" {
|
||||
cidr = "{{ network_cidr }}"
|
||||
}
|
||||
meta {
|
||||
admin = {{ "1" if 'admin' in group_names else "0" }}
|
||||
}
|
||||
}
|
||||
{% endif %}
|
||||
|
||||
consul {
|
||||
address = "{{ vm_ip}}:8500"
|
||||
}
|
||||
|
||||
plugin "docker" {
|
||||
config {
|
||||
volumes {
|
||||
@ -50,6 +51,7 @@ plugin "docker" {
|
||||
allow_privileged = true
|
||||
}
|
||||
}
|
||||
|
||||
telemetry {
|
||||
collection_interval = "1s"
|
||||
disable_hostname = true
|
||||
|
Loading…
Reference in New Issue
Block a user