aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/stor4nfv/roles/stor4nfv/tasks/post-install.yml
blob: 182c0a689eb8a1f106d67f5b41a3402fce5b4ac1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# #############################################################################
# Copyright (c) 2018 Intel Corp.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
# #############################################################################
---

- name: define image architecture
  set_fact:
    imgarch: "{{ 'arm64' if ansible_architecture == 'aarch64' else 'amd64' }}"

- name: ensure ceph-ansible dir exists
  stat:
    path: /opt/ceph-ansible
  ignore_errors: "true"
  register: ceph_ansible_exists

- name: copy post-install.yml to /opt/ceph-ansible
  remote_user: root
  template:
    src: post-install.yml.j2
    dest: /opt/ceph-ansible/post-install.yml
  when:
    - ceph_ansible_exists.stat.exists is defined and ceph_ansible_exists.stat.exists

- name: run post-install playbook
  shell: ansible-playbook post-install.yml -i ceph.hosts
  become: true
  args:
    chdir: /opt/ceph-ansible
  when:
    - ceph_ansible_exists.stat.exists is defined and ceph_ansible_exists.stat.exists

- name: remove post-install.yml
  file:
    path: /opt/ceph-ansible/post-install.yml
    state: absent
  when:
    - ceph_ansible_exists.stat.exists is defined and ceph_ansible_exists.stat.exists

- name: ensure osdsctl exists
  stat:
    path: /opt/opensds-v0.1.5-linux-{{ imgarch }}/bin/osdsctl
  ignore_errors: "true"
  register: osdsctl_exists

- name: ensure opensds csi directory exists
  stat:
    path: /opt/opensds-k8s-v0.1.0-linux-{{ imgarch }}
  ignore_errors: "true"
  register: csi_dir_exists

- name: create opensds default profile, csi pods
  remote_user: root
  shell: |
    cp /opt/opensds-v0.1.5-linux-{{ imgarch }}/bin/osdsctl /usr/local/bin;
    export OPENSDS_ENDPOINT=http://{{ public_vip.ip }}:50040;
    export OPENSDS_AUTH_STRATEGY=noauth;
    osdsctl profile create '{"name": "default", "description": "default policy"}'
    cd /opt/opensds-k8s-v0.1.0-linux-{{ imgarch }};
    kubectl create -f csi/deploy/kubernetes;
  ignore_errors: "true"
  when:
    - osdsctl_exists.stat.exists is defined and osdsctl_exists.stat.exists
    - csi_dir_exists.stat.exists is defined and csi_dir_exists.stat.exists