Dynamic provisioner update
[ta/caas-storage.git] / ansible / roles / kubernetes_storage / tasks / create_ceph_storage_class.yaml
1 ---
2 # Copyright 2019 Nokia
3 #
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
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
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.
15
16   - name: get ceph mons
17     become: true
18     become_user: root
19     shell: "ceph mon dump -f json"
20     register: get_ceph_mons
21
22   - name: parse mons command output
23     set_fact:
24       ceph_mons_dump: "{{ get_ceph_mons.stdout | from_json }}"
25   - name: assemble mons list string
26     set_fact:
27       ceph_mons_list: "{{ ceph_mons_dump.mons | map(attribute='addr') | join(',')}}"
28
29   - name: get auth tokens
30     set_fact:
31       ceph_admin_token: "{{ auth_tokens | selectattr('name', 'search', 'admin') | first }}"
32       ceph_user_token: "{{ auth_tokens | selectattr('name', 'search', 'caas') | first }}"
33
34   - name: template storage class manifets
35     template:
36       src: ceph-storageclass.yaml.j2
37       dest: "{{ caas.manifests_directory }}/ceph-storageclass.yaml"
38     vars:
39       name: ceph-storage-class
40       pool: caas
41
42   - name: create kubernetes storage class
43     kubectl:
44       manifest: "{{ caas.manifests_directory }}/ceph-storageclass.yaml"
45       state: present
46     when: ( nodename | search("caas_master1") )