diff options
author | Vishal Patil <vishal.patil@nuagenetworks.net> | 2016-03-01 13:07:33 -0500 |
---|---|---|
committer | Vishal Patil <vishal.patil@nuagenetworks.net> | 2016-03-01 16:44:11 -0500 |
commit | c16a92f804518fae19294280a9bd1d57976253ff (patch) | |
tree | bdbc90f55b2e09b685baef6eb20e344a27bd045f /roles/nuage_node/tasks | |
parent | fadad1f7e1934ab5542eae320af6fdaca7024479 (diff) | |
download | openshift-c16a92f804518fae19294280a9bd1d57976253ff.tar.gz openshift-c16a92f804518fae19294280a9bd1d57976253ff.tar.bz2 openshift-c16a92f804518fae19294280a9bd1d57976253ff.tar.xz openshift-c16a92f804518fae19294280a9bd1d57976253ff.zip |
Changes required for Nuage monitor REST server
Diffstat (limited to 'roles/nuage_node/tasks')
-rw-r--r-- | roles/nuage_node/tasks/certificates.yml | 50 | ||||
-rw-r--r-- | roles/nuage_node/tasks/main.yaml | 2 |
2 files changed, 52 insertions, 0 deletions
diff --git a/roles/nuage_node/tasks/certificates.yml b/roles/nuage_node/tasks/certificates.yml new file mode 100644 index 000000000..0fe6f7bac --- /dev/null +++ b/roles/nuage_node/tasks/certificates.yml @@ -0,0 +1,50 @@ +--- +- name: Create a directory to hold the certificates + file: path="{{ nuage_plugin_rest_client_crt_dir }}" state=directory + delegate_to: "{{ nuage_ca_master }}" + +- name: Create the key + command: > + openssl genrsa -out "{{ nuage_ca_master_plugin_key }}" 4096 + delegate_to: "{{ nuage_ca_master }}" + +- name: Create the req file + command: > + openssl req -key "{{ nuage_ca_master_plugin_key }}" -new -out "{{ nuage_plugin_rest_client_crt_dir }}/restClient.req" -subj "/CN=nuage-client" + delegate_to: "{{ nuage_ca_master }}" + +- name: Generate the crt file + command: > + openssl x509 -req -in "{{ nuage_plugin_rest_client_crt_dir }}/restClient.req" -CA "{{ nuage_ca_crt }}" -CAkey "{{ nuage_ca_key }}" -CAserial "{{ nuage_ca_serial }}" -out "{{ nuage_ca_master_plugin_crt }}" -extensions clientauth -extfile "{{ nuage_ca_dir }}"/openssl.cnf + delegate_to: "{{ nuage_ca_master }}" + +- name: Remove the req file + file: path="{{ nuage_plugin_rest_client_crt_dir }}/restClient.req" state=absent + delegate_to: "{{ nuage_ca_master }}" + +- name: Copy nuage CA crt + shell: cp "{{ nuage_ca_crt }}" "{{ nuage_plugin_rest_client_crt_dir }}" + delegate_to: "{{ nuage_ca_master }}" + +- name: Archive the certificate dir + shell: "cd {{ nuage_plugin_rest_client_crt_dir }} && tar -czvf /tmp/{{ ansible_nodename }}.tgz *" + delegate_to: "{{ nuage_ca_master }}" + +- name: Create a temp directory for the certificates + local_action: command mktemp -d "/tmp/openshift-{{ ansible_nodename }}-XXXXXXX" + register: mktemp + +- name: Download the certificates + fetch: src="/tmp/{{ ansible_nodename }}.tgz" dest="{{ mktemp.stdout }}/{{ ansible_nodename }}.tgz" flat=yes + delegate_to: "{{ nuage_ca_master }}" + +- name: Extract the certificates + unarchive: src="{{ mktemp.stdout }}/{{ ansible_nodename }}.tgz" dest={{ nuage_plugin_crt_dir }} + +- name: Delete the certificates after copy + file: path="{{ nuage_plugin_rest_client_crt_dir }}" state=absent + delegate_to: "{{ nuage_ca_master }}" + +- name: Delete the temp directory + file: path="{{ mktemp.stdout }}" state=absent + delegate_to: "{{ nuage_ca_master }}" diff --git a/roles/nuage_node/tasks/main.yaml b/roles/nuage_node/tasks/main.yaml index c1e49902d..d7dd53802 100644 --- a/roles/nuage_node/tasks/main.yaml +++ b/roles/nuage_node/tasks/main.yaml @@ -29,6 +29,8 @@ - nuage.key - nuage.kubeconfig +- include: certificates.yml + - name: Set the vsp-openshift.yaml sudo: true template: src=vsp-openshift.j2 dest={{ vsp_openshift_yaml }} owner=root mode=0644 |