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: fetch files from server which contains the necessary variables
17 fetch: src={{ item }} dest=/tmp/ flat=yes
19 - /etc/swift/usr/admin/admin.yml
21 - name: register infos for swift_auth
23 swift_credential: "{{ lookup('file', swift_admin_path + '/admin.yml') | from_yaml }}"
25 - name: authenticate on swift
27 url: "{{ caas.swift }}/auth/v1.0"
29 X_Auth_User: admin:admin
30 X_Auth_Key: "{{ swift_credential.swift_password }}"
33 - name: clean charts list file if exists
35 path: /tmp/charts_list
38 - name: get current charts list
39 shell: "curl -H'X_Auth_Token: {{ auth.x_auth_token }}' {{ caas.swift }}/v1.0/AUTH_admin/packages > /tmp/charts_list"
43 chart_pattern: "{{ chart_name | replace('*', '.*') }}"
45 - name: version_pattern
47 version_pattern: "{{ chart_version | replace('*', '[0-9]+') }}"
50 shell: cat /tmp/charts_list | egrep "charts/{{ chart_pattern }}-[0-9]+\.[0-9]+\.[0-9]+" | egrep "{{ version_pattern }}\.tgz"
51 register: chart_matched
53 - name: delete the chart from swift
54 shell: "curl -XDELETE {{ caas.chart_repo }}/{{ item }}"
55 with_items: "{{ chart_matched.stdout_lines }}"
57 - name: helm repo update
58 shell: helm repo update default {{ caas.chart_repo }}/charts