Skip to content

Commit c98ca6e

Browse files
authored
Merge pull request #78 from wiseflat/dev/mgarcia/fix
Multiple fix
2 parents 72a0b39 + 5578c1f commit c98ca6e

File tree

27 files changed

+101
-99
lines changed

27 files changed

+101
-99
lines changed

ansible/playbooks/paas/roles/ansible-docker/defaults/main.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,10 @@ docker_tls_configuration: false
99
docker_tcp_listen_address: "127.0.0.1"
1010
docker_tcp_listen_port: 2376
1111

12-
docker_private_registry_state: false
13-
docker_private_registry_url: ""
14-
docker_private_registry_username: ""
15-
docker_private_registry_password: ""
16-
docker_private_registry_config:
17-
- /etc/docker/config.json
18-
- /root/.docker/config.json
12+
docker_private_registry:
13+
url: ""
14+
username: ""
15+
password: ""
1916

2017
# DNS
2118
docker_dns_configuration: true
@@ -25,6 +22,12 @@ docker_dns_servers:
2522

2623
docker_metrics_addr: "{{ docker_tcp_listen_address }}:9323"
2724

25+
docker_runtimes: []
26+
# - key: nvidia
27+
# value:
28+
# args: {}
29+
# path: nvidia-container-runtime
30+
2831
# TLS
2932
# CA
3033
docker_ca_install_tls_ca_host: localhost

ansible/playbooks/paas/roles/ansible-docker/tasks/install.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,21 +63,18 @@
6363
- name: Create home docker directory
6464
ansible.builtin.file:
6565
path: "{{ item }}"
66-
recurse: true
6766
state: directory
6867
mode: '0755'
6968
loop:
7069
- /root/.docker
7170

72-
- name: Copy config.json
71+
- name: Copy config.json to root directory
7372
ansible.builtin.template:
7473
src: config.json.j2
75-
dest: "{{ item }}"
74+
dest: /root/.docker/config.json
7675
owner: root
7776
group: root
7877
mode: '0600'
79-
when: docker_private_registry_state
80-
loop: "{{ docker_private_registry_config }}"
8178
notify: Docker_restart
8279

8380
- name: Copy daemon.json for DNS resolution
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"auths": {
3-
"{{ docker_private_registry_url }}": {
4-
"auth": "{{ (docker_private_registry_username + ':' + docker_private_registry_password) | b64encode }}"
3+
"{{ docker_private_registry.url }}": {
4+
"auth": "{{ (docker_private_registry.username + ':' + docker_private_registry.password) | b64encode }}"
55
}
66
}
77
}
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
{
22
"metrics-addr" : "{{ docker_metrics_addr }}",
3-
"dns": [{% for item in docker_dns_servers %}"{{ item }}"{% if not loop.last %},{% endif %}{% endfor %}]
3+
"dns": [{% for item in docker_dns_servers %}"{{ item }}"{% if not loop.last %},{% endif %}{% endfor %}],
4+
"runtimes": {
5+
{%- for runtime in docker_runtimes | default([]) -%}
6+
"{{ runtime.key }}": {{ runtime.value | to_json }}{% if not loop.last %},{% endif %}{% endfor %}
7+
}
48
}

ansible/playbooks/paas/roles/coredns/templates/Corefile.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ service.nomad.:1053 {
44
#debug
55
#log
66
nomad {
7-
address https://{{ hostvars[nomad_primary_master_node | default(inventory_hostname)]['ansible_' + nomad_iface].ipv4.address | default('127.0.0.1') }}:4646
7+
address https://{{ hostvars[nomad_primary_master_node | default(inventory_hostname)]['ansible_' + hostvars[nomad_primary_master_node | default(inventory_hostname)].nomad_iface].ipv4.address | default('127.0.0.1') }}:4646
88
token {{ lookup('simple-stack-ui', type='secret', key=nomad_primary_master_node | default(inventory_hostname), subkey='nomad_management_token', missing='error') }}
99
ttl 10
1010
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
2-
latest_version: "{{ (lookup('url', 'https://api.github.com/repos/{{ image.upstream.user }}/{{ image.upstream.repo }}/releases/latest', headers={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer ' + lookup('ansible.builtin.env', 'GITHUB_API_TOKEN') }) | from_json).get('tag_name') | replace('v', '') }}"
2+
latest_version: "{{ (lookup('url', 'https://api.github.com/repos/' + image.upstream.user + '/' + image.upstream.repo + '/releases/latest', headers={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer ' + lookup('ansible.builtin.env', 'GITHUB_API_TOKEN') }) | from_json).get('tag_name') | replace('v', '') }}"
33
upstream_file_name: "{{ image.upstream.file | replace('REPO', image.upstream.repo) | replace('VERSION', latest_version) | replace('OS', image.upstream.os) | replace('ARCH', upstream_default_arch) | replace('FORMAT', image.upstream.format) }}"
44
upstream_file_url: "https://github.com/{{ image.upstream.user }}/{{ image.upstream.repo }}/releases/download/v{{ latest_version }}/{{ upstream_file_name }}"

ansible/playbooks/paas/roles/nomad/defaults/main.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ nomad_group: simplestack
1818
nomad_dc_name: dc1
1919

2020
nomad_project: "{{ fact_instance.project }}"
21+
nomad_provider: "{{ fact_instance.provider }}"
2122
nomad_region: "{{ fact_instance.region }}"
2223
nomad_location: "{{ fact_instance.region }}"
2324

@@ -199,8 +200,8 @@ nomad_tls_ip_range: "{{ ((range(0,256) | map('regex_replace', '^', 'IP:192.168.0
199200
nomad_tls_check_delay: "+2w"
200201

201202
# TLS Server
202-
nomad_tls_cert_server: "{{ nomad_dc_name }}-server-nomad.pem"
203-
nomad_tls_privatekey_server: "{{ nomad_dc_name }}-server-nomad.key"
203+
nomad_tls_cert_server: "{{ nomad_region }}-{{ nomad_provider }}-{{ nomad_dc_name }}-server-nomad.pem"
204+
nomad_tls_privatekey_server: "{{ nomad_region }}-{{ nomad_provider }}-{{ nomad_dc_name }}-server-nomad.key"
204205

205206
nomad_tls_common_name_server: "*.{{ nomad_dc_name }}.{{ nomad_tls_common_name }}"
206207
nomad_tls_subject_alt_name_server: "DNS:localhost,IP:127.0.0.1,IP:172.17.0.1,{{ nomad_tls_ip_range }},DNS:server.global.nomad,DNS:server.{{ nomad_region }}.nomad,DNS:server.{{ nomad_dc_name }}.nomad,DNS:*.{{ nomad_dc_name }}.nomad"

ansible/playbooks/paas/roles/nomad/tasks/04_tls_certs.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
2-
- name: "Certificate | Create TLS directory on target"
2+
- name: "Nomad | Create TLS directory on target"
33
ansible.builtin.file:
44
path: "{{ nomad_tls_host_certificate_dir }}"
55
state: directory
66
mode: '0755'
77

8-
- name: "Certificate | Copy Public certs on nodes - {{ nomad_tls_ca_pubkey }}"
8+
- name: "Nomad | Copy Public certs on nodes - {{ nomad_tls_ca_pubkey }}"
99
ansible.builtin.copy:
1010
src: "{{ nomad_tls_ca_host_dir }}/{{ nomad_tls_ca_pubkey }}"
1111
dest: "{{ nomad_tls_host_certificate_dir }}/{{ nomad_tls_ca_pubkey }}"
@@ -42,7 +42,7 @@
4242
certificate_client_privatekey: "{{ nomad_tls_privatekey_server }}"
4343
certificate_common_name: "{{ nomad_tls_common_name_server }}"
4444
certificate_subject_alt_name: "{{ nomad_tls_subject_alt_name_server }}"
45-
run_once: true
45+
# run_once: true
4646
when: not cert_tls_server_present.stat.exists or (cert_tls_server_present.stat.exists and not tls_check_server.valid_at.delay)
4747

4848
- name: "Nomad | Copy certificates on server nodes"
@@ -64,7 +64,7 @@
6464
block:
6565
- name: "Nomad | Check if TLS cert exists for Client"
6666
ansible.builtin.stat:
67-
path: "{{ nomad_tls_ca_host_dir }}{{ nomad_tls_cert_client }}"
67+
path: "{{ nomad_tls_host_certificate_dir }}/{{ nomad_tls_cert_client }}"
6868
register: cert_tls_client_present
6969

7070
- name: "Nomad | Get information on generated certificate for Clients"
@@ -88,7 +88,7 @@
8888
certificate_client_privatekey: "{{ nomad_tls_privatekey_client }}"
8989
certificate_common_name: "{{ nomad_tls_common_name_client }}"
9090
certificate_subject_alt_name: "{{ nomad_tls_subject_alt_name_client }}"
91-
run_once: true
91+
# run_once: true
9292
when: not cert_tls_client_present.stat.exists or (cert_tls_client_present.stat.exists and not tls_check_client.valid_at.delay)
9393

9494

ansible/playbooks/paas/roles/nomad/tasks/06_configuration.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
owner: nomad
3939
group: nomad
4040
mode: "0644"
41+
notify: Nomad_restart
4142

4243
- name: "Nomad Install | Copy configurations files for servers"
4344
ansible.builtin.template:

ansible/playbooks/paas/roles/nomad/tasks/07_autoeligibility.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@
1717
return_content: true
1818
register: nomad_policies_list_raw
1919

20-
- name: Debug nomad_policies_list_raw (for auto eligibility)
21-
ansible.builtin.debug:
22-
msg: "{{ nomad_policies_list_raw.json }}"
23-
2420
- name: "Nomad Policy | Set policies list fact"
2521
ansible.builtin.set_fact:
2622
nomad_policies_list: "{{ nomad_policies_list_raw.json | community.general.json_query('[*].Name') | string }}"

0 commit comments

Comments
 (0)