4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
16 - name: create directory for kube token
18 path: "{{ caas.cert_path }}"
24 path: "{{ caas.cert_path }}/{{ caas.token_filename }}"
27 - name: Generate token
28 shell: "head -c 16 /dev/urandom | od -An -t x | tr -d ' '"
29 register: kube_token_output
31 when: not token_file.stat.exists
33 - name: Set token fact
35 kube_token: "{{ kube_token_output.stdout }}"
37 when: not token_file.stat.exists
41 content: "{{ kube_token }}"
42 dest: "{{ caas.cert_path }}/{{ caas.token_filename }}"
43 when: not token_file.stat.exists
45 - name: Set permissions on token
47 name: "{{ caas.cert_path }}/{{ caas.token_filename }}"
52 when: not token_file.stat.exists
54 - "{{ users.admin_user_name }}"
57 - name: Generate tokens.csv
60 dest: "{{ caas.cert_path }}/{{ caas.tokenscsv_filename }}"
62 when: not token_file.stat.exists
64 - name: Set permissions on tokens.csv
66 name: "{{ caas.cert_path }}/{{ caas.tokenscsv_filename }}"
71 when: not token_file.stat.exists
73 - "{{ users.admin_user_name }}"