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
18 src: /etc/swift/usr/admin/admin.yml
22 - name: register infos for swift_auth
24 swift_credential: "{{ lookup('file', '/tmp/admin.yml') | from_yaml }}"
26 - name: pause to wait for swift-update to be ready
30 - name: authenticate on swift-upgrade
32 url: "{{ caas.swift_update }}/auth/v1.0"
34 X_Auth_User: admin:admin
35 X_Auth_Key: "{{ swift_credential.swift_password }}"
40 url: "{{ caas.swift_update }}/v1.0/AUTH_admin/packages"
43 X_Auth_Token: "{{ auth.x_auth_token }}"
46 - name: get charts from packages
48 charts: "{{ (packages.get('content','')|trim).split('\n') | select('search', 'charts.+\\.tgz') | list }}"
50 - name: get value files from packages
52 value_files: "{{ (packages.get('content','')|trim).split('\n') | select('search', 'releases.+\\.yaml') | list }}"
55 - name: create chart directory
60 - name: download charts
63 command: "curl -O -XGET -H'X-Auth-Token: {{ auth.x_auth_token }}' {{ caas.swift_update }}/v1.0/AUTH_admin/packages/{{ item }}"
64 with_items: "{{ charts }}"
66 - name: download value files
69 command: "curl -O -XGET -H'X-Auth-Token: {{ auth.x_auth_token }}' {{ caas.swift_update }}/v1.0/AUTH_admin/packages/{{ item }}"
70 with_items: "{{ value_files }}"
73 - name: upload charts via chart-repo
76 shell: "curl -sS -XPOST --cacert /etc/chart-repo/ssl/ca.pem --cert /etc/chart-repo/ssl/chart-repo?.pem --key /etc/chart-repo/ssl/chart-repo?-key.pem -H 'Content-Type: application/gzip' --data-binary @{{ item | basename }} {{ caas.chart_repo }}/{{ item }}"
77 with_items: "{{ charts }}"
79 - name: helm repo update
80 shell: helm repo update default {{ caas.chart_repo }}/charts
82 - name: authenticate on swift
84 url: "{{ caas.swift }}/auth/v1.0"
86 X_Auth_User: admin:admin
87 X_Auth_Key: "{{ swift_credential.swift_password }}"
91 - name: upload value file via swift
94 shell: "curl -XPUT -H 'X-Auth-Token: {{ auth_orig.x_auth_token }}' -T {{ item | basename }} {{ caas.swift }}/v1.0/AUTH_admin/packages/{{ item }}"
95 with_items: "{{ value_files }}"