kolla-ansible/ansible/roles/certificates/tasks/generate.yml
jamesbagwell c0a3970e36 Removing '/certificates' entry in generate.yml as this causes an
incorrect path when generating certificates.

The 'setting permissions on key' task fails because the task looks for
the haproxy.key in an invalid path. The certificates_dir is defined as
'{{ node_config }}/certificates' in the main.yml . The 'Setting
permissions on Key' task has a path of '{{ certificates_dir
}}/certificates/private/haproxy.key which is incorrect. Removing the
'certificates' in the path corrects this problem and allows the user to
successfully create certificates using 'kolla-ansible certificates'.

Change-Id: I37b10b994b05d955b6f67c908df1472231a91160
Closes-Bug: 1821805
2019-03-27 09:26:58 -06:00

54 lines
1.4 KiB
YAML

---
- name: Ensuring config directories exist
become: true
file:
path: "{{ certificates_dir }}/private"
state: "directory"
recurse: yes
- name: Creating SSL configuration file
become: true
template:
src: "{{ item }}.j2"
dest: "{{ certificates_dir }}/{{ item }}"
with_items:
- "openssl-kolla.cnf"
- name: Creating Key
become: true
command: creates="{{ item }}" openssl genrsa -out {{ item }}
with_items:
- "{{ certificates_dir }}/private/haproxy.key"
- name: Setting permissions on key
become: true
file:
path: "{{ certificates_dir }}/private/haproxy.key"
mode: 0600
state: file
- name: Creating Server Certificate
become: true
command: creates="{{ item }}" openssl req -new -nodes -sha256 -x509 \
-subj "/C=US/ST=NC/L=RTP/O=kolla/CN={{ kolla_external_fqdn }}" \
-config {{ certificates_dir }}/openssl-kolla.cnf \
-days 3650 \
-extensions v3_req \
-key {{ certificates_dir }}/private/haproxy.key \
-out {{ item }}
with_items:
- "{{ certificates_dir }}/private/haproxy.crt"
- name: Creating CA Certificate File
become: true
copy:
src: "{{ certificates_dir }}/private/haproxy.crt"
dest: "{{ kolla_external_fqdn_cacert }}"
- name: Creating Server PEM File
become: true
assemble:
src: "{{ certificates_dir }}/private"
dest: "{{ kolla_external_fqdn_cert }}"
mode: 0600