|
|
@ -26,7 +26,7 @@ |
|
|
|
|
|
|
|
- name: generate host request |
|
|
|
set_fact: |
|
|
|
cert_request: |
|
|
|
ca_request: |
|
|
|
type: 'sign_request' |
|
|
|
request: |
|
|
|
keyType: 'ssh_host' |
|
|
@ -34,16 +34,13 @@ |
|
|
|
keyData: "{{ vm_public_key['content'] | b64decode | replace('\n', '')}}" |
|
|
|
|
|
|
|
- debug: |
|
|
|
var: cert_request | to_json |
|
|
|
var: ca_request | to_json |
|
|
|
verbosity: 2 |
|
|
|
|
|
|
|
- name: start sign request |
|
|
|
raw: "{{ cert_request | to_json }}" |
|
|
|
delegate_to: ca_request |
|
|
|
delegate_facts: True |
|
|
|
connection: ssh |
|
|
|
register: request_result |
|
|
|
failed_when: "( request_result.stdout | from_json ).failed" |
|
|
|
include: ca-dialog.yaml |
|
|
|
vars: |
|
|
|
ansible_connection: ssh |
|
|
|
|
|
|
|
- debug: |
|
|
|
var: request_result |
|
|
@ -58,31 +55,29 @@ |
|
|
|
|
|
|
|
- name: generate get request |
|
|
|
set_fact: |
|
|
|
get_request: |
|
|
|
ca_request: |
|
|
|
type: 'get_certificate' |
|
|
|
requestID: '{{ request_output.requestID }}' |
|
|
|
|
|
|
|
- debug: |
|
|
|
var: get_request |
|
|
|
var: ca_request |
|
|
|
verbosity: 2 |
|
|
|
|
|
|
|
- debug: |
|
|
|
msg: "Please manualy confirm sign request with id {{ request_output.requestID }}" |
|
|
|
|
|
|
|
- name: wait for cert |
|
|
|
raw: "{{ get_request | to_json }}" |
|
|
|
delegate_to: ca_request |
|
|
|
delegate_facts: True |
|
|
|
connection: ssh |
|
|
|
register: cert_result |
|
|
|
failed_when: "(cert_result.stdout | from_json).failed" |
|
|
|
include: ca-dialog.yaml |
|
|
|
vars: |
|
|
|
ansible_connection: ssh |
|
|
|
request: get_request |
|
|
|
|
|
|
|
- debug: |
|
|
|
var: cert_result |
|
|
|
var: request_result |
|
|
|
verbosity: 2 |
|
|
|
|
|
|
|
- set_fact: |
|
|
|
cert_key: "{{ cert_result.stdout | string | from_json }}" |
|
|
|
cert_key: "{{ request_result.stdout | string | from_json }}" |
|
|
|
|
|
|
|
- name: Write certificate to container |
|
|
|
copy: |
|
|
@ -118,7 +113,7 @@ |
|
|
|
|
|
|
|
- meta: flush_handlers |
|
|
|
|
|
|
|
- name: "waiting for ssh on {{ inventory_hostname }} vm to start" |
|
|
|
- name: "waiting for ssh on {{ ansible_docker_extra_args | default(inventory_hostname) }} to start" |
|
|
|
wait_for: |
|
|
|
host: "{{ hostvars[inventory_hostname]['ansible_host'] }}" |
|
|
|
port: 22 |
|
|
|