blob: 9c7b34ed358d3f7bd7fe52e840649ceddb62872e [file] [log] [blame]
Mohammed Naserafcf0a12024-05-19 00:13:27 +02001# Copyright (c) 2024 VEXXHOST, Inc.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
15- name: Detect if InitiatorName is set
16 ansible.builtin.slurp:
17 src: /etc/iscsi/initiatorname.iscsi
18 register: portworx_iscsi_initiatorname
19
20- name: Configure InitiatorName
21 when: "'InitiatorName' not in portworx_iscsi_initiatorname.content | b64decode"
22 block:
23 - name: Generate a new InitiatorName
24 ansible.builtin.shell:
25 cmd: iscsi-iname
26 register: portworx_iscsi_iname
27
28 - name: Write the new InitiatorName
29 ansible.builtin.copy:
30 content: "InitiatorName={{ portworx_iscsi_iname.stdout }}"
31 dest: /etc/iscsi/initiatorname.iscsi
32 owner: root
33 group: root
34 mode: "0644"
35
Mohammed Naserab360042024-06-21 13:45:10 -040036- name: Create namespace
37 kubernetes.core.k8s:
38 state: present
39 definition:
40 apiVersion: v1
41 kind: Namespace
42 metadata:
43 name: portworx
44
Mohammed Naserafcf0a12024-05-19 00:13:27 +020045- name: Install Portworx
46 run_once: true
47 kubernetes.core.k8s:
48 state: present
49 template:
50 - portworx.yml
51 - config.yml
52
53- name: Wait till the CRDs are created
54 run_once: true
55 kubernetes.core.k8s_info:
56 api_version: apiextensions.k8s.io/v1
57 kind: CustomResourceDefinition
58 name: storageclusters.core.libopenstorage.org
59 # NOTE(mnaser): Portworx operator creates the CRDs for the cluster
60 # so we need to make sure they're created before we proceed.
61 retries: 60
62 delay: 5
63 register: _result
64 until: _result.resources | length > 0
65
66- name: Create Portworx Storage Cluster
67 run_once: true
68 kubernetes.core.k8s:
69 state: present
70 template:
71 - storage_cluster.yml
72 - storage_class.yml