--- # Copyright 2019 Nokia # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - name: Create directory for kube token file: path: "{{ caas.cert_path }}" state: directory recurse: yes - name: Check token stat: path: "{{ caas.cert_path }}/{{ caas.token_filename }}" register: token_file when: not nodename | search("caas_master") - name: adding acl read to write cert_path acl: name: "{{ caas.cert_path }}" entity: "{{ users.admin_user_name }}" etype: user permissions: rwx state: present - name: Send kube token synchronize: src: "{{ caas.cert_path }}/{{ caas.token_filename }}" dest: "{{ caas.cert_path }}/{{ caas.token_filename }}" rsync_opts: - "-A" - "-X" when: not nodename | search("caas_master") and not token_file.stat.exists - name: Check token stat: path: "{{ caas.cert_path }}/{{ caas.tokenscsv_filename }}" register: tokencsv_file when: nodename | search("caas_master") and not nodename | search("caas_master1") - name: Get kube tokens.csv synchronize: src: "{{ caas.cert_path }}/{{ caas.tokenscsv_filename }}" dest: "{{ caas.cert_path }}/{{ caas.tokenscsv_filename }}" rsync_opts: - "-A" - "-X" when: nodename | search("caas_master") and not nodename | search("caas_master1") and not tokencsv_file.stat.exists - name: remove acl read to write cert_path acl: name: "{{ caas.cert_path }}" entity: "{{ users.admin_user_name }}" etype: user permissions: rx state: present