-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Grafana always up, teleport restart, register-ca
Make sure Teleport is restarted upon configuration change. Make sure grafana is up before moving on (fixes an issue where the prometheus role would fail if grafana was down). register-ca refactor to speed up the process.
- Loading branch information
Showing
7 changed files
with
68 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,44 @@ | ||
--- | ||
- name: "Register CA on all hosts" | ||
include_tasks: register_ca.yml target_host="{{ item }}" | ||
with_items: "{{ groups['control'] | union(groups['edge']) | union(groups['worker']) }}" | ||
- name: "Create distribution group" | ||
set_fact: | ||
register_ca_control: "{{ groups['control'][0] }}" | ||
register_ca_group: "{{ groups['control'] | union(groups['edge']) | union(groups['worker']) }}" | ||
|
||
- name: "Fetch remote CA" | ||
uri: | ||
headers: | ||
X-Vault-Token: "{{ vault_token }}" | ||
url: "http://127.0.0.1:8200/v1/{{ backend }}/pki/ca/pem" | ||
method: GET | ||
return_content: yes | ||
delegate_to: "{{ register_ca_control }}" | ||
register: ca_cert | ||
|
||
- name: "Save {{ backend }} CA to anchors folder" | ||
copy: | ||
content: "{{ ca_cert.content }}" | ||
dest: "/etc/pki/ca-trust/source/anchors/{{ backend }}.pem" | ||
register: anchors_copy | ||
delegate_to: "{{ item }}" | ||
with_items: "{{ register_ca_group }}" | ||
run_once: true | ||
|
||
- name: "Regenerate CAs" | ||
when: anchors_copy.changed|bool | ||
shell: update-ca-trust | ||
delegate_to: "{{ item }}" | ||
with_items: "{{ register_ca_group }}" | ||
run_once: true | ||
loop_control: | ||
label: "{{ item }}" | ||
register: cas_regeneration | ||
async: 7200 | ||
poll: 0 | ||
|
||
- name: "Wait for CAs to be regenerated" | ||
when: anchors_copy.changed|bool | ||
async_status: | ||
jid: "{{ item.ansible_job_id }}" | ||
register: cas_jobs | ||
until: cas_jobs.finished | ||
retries: 300 | ||
with_items: cas_regeneration.results |
22 changes: 0 additions & 22 deletions
22
docker-image/ansible/roles/register-ca/tasks/register_ca.yml
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
- name: "Restart teleport" | ||
service: | ||
name: teleport | ||
state: restarted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters