refactoring of ceph ha model

Change-Id: Ic1685dfba96bc39a3f0d300de58f5b315bc65b3f
diff --git a/classes/cluster/ceph_ha/ceph/common.yml b/classes/cluster/ceph_ha/ceph/common.yml
new file mode 100644
index 0000000..5117d12
--- /dev/null
+++ b/classes/cluster/ceph_ha/ceph/common.yml
@@ -0,0 +1,8 @@
+classes:
+- system.linux.system.repo.ceph
+- cluster.ceph_ha.infra
+parameters:
+  ceph:
+    common:
+      public_network: 10.1.0.0/24
+      cluster_network: 10.16.0.0/24
diff --git a/classes/cluster/ceph_ha/ceph/init.yml b/classes/cluster/ceph_ha/ceph/init.yml
index 2aedbf3..553ee24 100644
--- a/classes/cluster/ceph_ha/ceph/init.yml
+++ b/classes/cluster/ceph_ha/ceph/init.yml
@@ -1,16 +1,16 @@
 parameters:
   _param:
     linux_repo_ceph_component: kraken
-    ceph_monitor_keepalived_password: tv0jeM4m4neum1s0p3nSt4cK3m
+    ceph_version: kraken
+    ceph_mon_keepalived_password: tv0jeM4m4neum1s0p3nSt4cK3m
 
-    ceph_monitor_hostname: cmn
-    ceph_monitor_node01_hostname: cmn01
-    ceph_monitor_node02_hostname: cmn02
-    ceph_monitor_node03_hostname: cmn03
-    ceph_monitor_address: 172.16.10.89
-    ceph_monitor_node01_address: 172.16.10.91
-    ceph_monitor_node02_address: 172.16.10.92
-    ceph_monitor_node03_address: 172.16.10.93
+    ceph_mon_hostname: cmn
+    ceph_mon_node01_hostname: cmn01
+    ceph_mon_node02_hostname: cmn02
+    ceph_mon_node03_hostname: cmn03
+    ceph_mon_node01_address: ${_param:ceph_mon_node01_address}
+    ceph_mon_node02_address: ${_param:ceph_mon_node02_address}
+    ceph_mon_node03_address: ${_param:ceph_mon_node03_address}
 
     ceph_osd_node01_hostname: osd01
     ceph_osd_node02_hostname: osd02
@@ -21,29 +21,34 @@
 
     ceph_cfs_node01_hostname: cfs01
     ceph_cfs_node01_address: 172.16.10.97
+
+    ceph_cluster_fsid: a619c5fc-c4ed-4f22-9ed2-66cf2feca23d
+    ceph_mon_keyring: AQAnQIhZ6in5KxAAdf467upoRMWFcVg5pbh1yg==
+    ceph_admin_keyring: AQBHPYhZv5mYDBAAvisaSzCTQkC5gywGUp/voA==
+
   linux:
     network:
       host:
         cmn:
-          address: ${_param:ceph_monitor_address}
+          address: ${_param:ceph_mon_address}
           names:
-          - ${_param:ceph_monitor_hostname}
-          - ${_param:ceph_monitor_hostname}.${_param:cluster_domain}
+          - ${_param:ceph_mon_hostname}
+          - ${_param:ceph_mon_hostname}.${_param:cluster_domain}
         cmn01:
-          address: ${_param:ceph_monitor_node01_address}
+          address: ${_param:ceph_mon_node01_address}
           names:
-          - ${_param:ceph_monitor_node01_hostname}
-          - ${_param:ceph_monitor_node01_hostname}.${_param:cluster_domain}
+          - ${_param:ceph_mon_node01_hostname}
+          - ${_param:ceph_mon_node01_hostname}.${_param:cluster_domain}
         cmn02:
-          address: ${_param:ceph_monitor_node02_address}
+          address: ${_param:ceph_mon_node02_address}
           names:
-          - ${_param:ceph_monitor_node02_hostname}
-          - ${_param:ceph_monitor_node02_hostname}.${_param:cluster_domain}
+          - ${_param:ceph_mon_node02_hostname}
+          - ${_param:ceph_mon_node02_hostname}.${_param:cluster_domain}
         cmn03:
-          address: ${_param:ceph_monitor_node03_address}
+          address: ${_param:ceph_mon_node03_address}
           names:
-          - ${_param:ceph_monitor_node03_hostname}
-          - ${_param:ceph_monitor_node03_hostname}.${_param:cluster_domain}
+          - ${_param:ceph_mon_node03_hostname}
+          - ${_param:ceph_mon_node03_hostname}.${_param:cluster_domain}
         osd01:
           address: ${_param:ceph_osd_node01_address}
           names:
diff --git a/classes/cluster/ceph_ha/ceph/mon.yml b/classes/cluster/ceph_ha/ceph/mon.yml
new file mode 100644
index 0000000..33e9d6d
--- /dev/null
+++ b/classes/cluster/ceph_ha/ceph/mon.yml
@@ -0,0 +1,3 @@
+classes:
+- system.ceph.mon.cluster
+- cluster.ceph_ha.ceph.common
\ No newline at end of file
diff --git a/classes/cluster/ceph_ha/ceph/mon_init.yml b/classes/cluster/ceph_ha/ceph/mon_init.yml
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/classes/cluster/ceph_ha/ceph/mon_init.yml
diff --git a/classes/cluster/ceph_ha/ceph/monitor.yml b/classes/cluster/ceph_ha/ceph/monitor.yml
deleted file mode 100644
index 14b843d..0000000
--- a/classes/cluster/ceph_ha/ceph/monitor.yml
+++ /dev/null
@@ -1,59 +0,0 @@
-classes:
-- system.linux.system.repo.ubuntu
-- system.linux.system.repo.ceph
-- service.keepalived.cluster.single
-#- service.ceph.monitor.cluster
-- cluster.ceph_ha.infra
-parameters:
-  _param:
-    keepalived_ceph_monitor_vip_address: ${_param:ceph_monitor_address}
-    keepalived_ceph_monitor_vip_password: ${_param:ceph_monitor_keepalived_password}
-    keepalived_ceph_monitor_vip_interface: ens3
-    cluster_vip_address: ${_param:ceph_monitor_address}
-    cluster_local_address: ${_param:single_address}
-    cluster_node01_hostname: cmn01
-    cluster_node01_address: ${_param:ceph_monitor_node01_address}
-    cluster_node02_hostname: cmn02
-    cluster_node02_address: ${_param:ceph_monitor_node02_address}
-    cluster_node03_hostname: cmn03
-    cluster_node03_address: ${_param:ceph_monitor_node03_address}
-    ceph_frondend_network: 10.1.0.0/24
-    ceph_backend_network: 10.16.0.0/24
-    nova_storage_keyring: novakeyring
-    cinder_storage_keyring: cinderkeyrinig
-  ceph:
-    common:
-      version: kraken
-      fsid: a619c5fc-c4ed-4f22-9ed2-66cf2feca23d
-      public_network: 10.1.0.0/24
-      cluster_network: 10.16.0.0/24
-      members:
-        - name: ${_param:cluster_node01_hostname}
-          host: ${_param:cluster_node01_address}
-        - name: ${_param:cluster_node02_hostname}
-          host: ${_param:cluster_node02_address}
-        - name: ${_param:cluster_node03_hostname}
-          host: ${_param:cluster_node03_address}
-      keyring:
-        admin:
-          key: AQBHPYhZv5mYDBAAvisaSzCTQkC5gywGUp/voA==
-          caps:
-            mds: "allow *"
-            mgr: "allow *"
-            mon: "allow *"
-            osd: "allow *"
-
-    monitor:
-      enabled: true
-      keyring:
-        mon:
-          key: AQAnQIhZ6in5KxAAdf467upoRMWFcVg5pbh1yg==
-          caps:
-            mon: "allow *"
-        admin:
-          key: AQBHPYhZv5mYDBAAvisaSzCTQkC5gywGUp/voA==
-          caps:
-            mds: "allow *"
-            mgr: "allow *"
-            mon: "allow *"
-            osd: "allow *"
diff --git a/classes/cluster/ceph_ha/ceph/osd.yml b/classes/cluster/ceph_ha/ceph/osd.yml
index 8aed169..a09fc8e 100644
--- a/classes/cluster/ceph_ha/ceph/osd.yml
+++ b/classes/cluster/ceph_ha/ceph/osd.yml
@@ -1,33 +1,58 @@
 classes:
-- system.linux.system.repo.ceph
-- system.linux.system.repo.ubuntu
-- cluster.ceph_ha.infra
+- service.ceph.osd.cluster
+- cluster.ceph_ha.ceph.common
 parameters:
-  _param:
-    keepalived_ceph_monitor_vip_address: ${_param:ceph_monitor_address}
-    keepalived_ceph_monitor_vip_password: ${_param:ceph_monitor_keepalived_password}
-    keepalived_ceph_monitor_vip_interface: ens3
-    cluster_vip_address: ${_param:ceph_monitor_address}
-    cluster_local_address: ${_param:single_address}
-    cluster_node01_hostname: cmn01
-    cluster_node01_address: ${_param:ceph_monitor_node01_address}
-    cluster_node02_hostname: cmn02
-    cluster_node02_address: ${_param:ceph_monitor_node02_address}
-    cluster_node03_hostname: cmn03
-    cluster_node03_address: ${_param:ceph_monitor_node03_address}
-    ceph_frondend_network: 10.1.0.0/24
-    ceph_backend_network: 10.16.0.0/24
-    nova_storage_keyring: novakeyring
-    cinder_storage_keyring: cinderkeyrinig
   ceph:
     osd:
+      enabled: true
       copy_admin_key: true
       journal_type: raw
-      disks:
-        - /dev/sda:
-          journal: yes
-          journal_device: /dev/sdd
-        - /dev/sdb:
-          journal_device: /dev/sde
       dmcrypt: disable
       osd_scenario: raw_journal_devices
+      fs_type: xfs
+      disk:
+        '00':
+          rule: hdd
+          dev: /dev/vdb2
+          journal: /dev/vdb1
+          class: bestssd
+          weight: 1.5
+        '01':
+          rule: hdd
+          dev: /dev/vdc2
+          journal: /dev/vdc1
+          class: bestssd
+          weight: 1.5
+        '02':
+          rule: hdd
+          dev: /dev/vdd2
+          journal: /dev/vdd1
+          class: bestssd
+          weight: 1.5
+  linux:
+   storage:
+     disk:
+       first_drive:
+         name: /dev/vdb
+         type: gpt
+         partitions:
+         - size: 4000
+           type: xfs
+         - size: 6000
+           type: xfs
+       second_drive:
+         name: /dev/vdc
+         type: gpt
+         partitions:
+         - size: 4000
+           type: xfs
+         - size: 6000
+           type: xfs
+       third_drive:
+         name: /dev/vdd
+         type: gpt
+         partitions:
+         - size: 4000
+           type: xfs
+         - size: 6000
+           type: xfs
diff --git a/classes/cluster/ceph_ha/ceph/rgw.yml b/classes/cluster/ceph_ha/ceph/rgw.yml
new file mode 100644
index 0000000..eb6e409
--- /dev/null
+++ b/classes/cluster/ceph_ha/ceph/rgw.yml
@@ -0,0 +1,22 @@
+classes:
+- system.linux.system.repo.ceph
+- system.linux.system.repo.ubuntu
+- cluster.ceph_ha.ceph.common
+- cluster.ceph_ha.infra
+parameters:
+  _param:
+    keepalived_ceph_monitor_vip_address: ${_param:ceph_monitor_address}
+    keepalived_ceph_monitor_vip_password: ${_param:ceph_monitor_keepalived_password}
+    keepalived_ceph_monitor_vip_interface: ens3
+    cluster_vip_address: ${_param:ceph_monitor_address}
+    cluster_local_address: ${_param:single_address}
+    cluster_node01_hostname: cmn01
+    cluster_node01_address: ${_param:ceph_monitor_node01_address}
+    cluster_node02_hostname: cmn02
+    cluster_node02_address: ${_param:ceph_monitor_node02_address}
+    cluster_node03_hostname: cmn03
+    cluster_node03_address: ${_param:ceph_monitor_node03_address}
+    ceph_frondend_network: 10.1.0.0/24
+    ceph_backend_network: 10.16.0.0/24
+    nova_storage_keyring: novakeyring
+    cinder_storage_keyring: cinderkeyrinig
\ No newline at end of file
diff --git a/classes/cluster/ceph_ha/infra/config.yml b/classes/cluster/ceph_ha/infra/config.yml
index 8d76636..5038d3d 100644
--- a/classes/cluster/ceph_ha/infra/config.yml
+++ b/classes/cluster/ceph_ha/infra/config.yml
@@ -5,7 +5,7 @@
 - system.salt.minion.ca.salt_master
 - system.salt.master.api
 - system.reclass.storage.salt
-- system.reclass.storage.system.ceph_monitor_cluster
+- system.reclass.storage.system.ceph_mon_cluster
 - cluster.ceph_ha.ceph
 - cluster.ceph_ha.infra
 parameters:
@@ -40,6 +40,28 @@
         - salt://reclass/reactor/node_register.sls
   reclass:
     storage:
+      node:
+        infra_storage_rack01:
+          name: osd<<count>>
+          domain: ${_param:cluster_domain}
+          classes:
+          - cluster.${_param:cluster_name}.ceph.osd
+          repeat:
+            count: 3
+            start: 0
+            digits: 1
+            params:
+              ceph_host_id:
+                value: <<count>>
+                start: 1
+              single_address:
+                value: ceph_osd_node<<count>>_address
+                start: 1
+                digits: 2
+                interpolate: true
+          params:
+            salt_master_host: ${_param:reclass_config_master}
+            linux_system_codename: xenial
       class_mapping:
         common_node:
           expression: all
@@ -59,25 +81,35 @@
               value_template: <<node_deploy_ip>>
             cluster_domain:
               value_template: <<node_domain>>
-        ceph_osd:
-          expression: <<node_hostname>>__startswith__osd
-          node_class:
-            value_template:
-              - cluster.<<node_cluster>>.ceph.osd
-        ceph_monitor_01:
-          expression: <<node_hostname>>__equals__cmn01
+        ceph_osd_01:
+          expression: <<node_hostname>>__equals__osd0
           cluster_param:
-            ceph_monitor_01_address:
+            ceph_osd_node01_address:
               value_template: <<node_control_ip>>
-        ceph_monitor_02:
-          expression: <<node_hostname>>__equals__cmn02
+        ceph_osd_02:
+          expression: <<node_hostname>>__equals__osd1
           cluster_param:
-            ceph_monitor_02_address:
+            ceph_osd_node02_address:
               value_template: <<node_control_ip>>
-        ceph_monitor_03:
+        ceph_osd_03:
+          expression: <<node_hostname>>__equals__osd2
+          cluster_param:
+            ceph_osd_node03_address:
+              value_template: <<node_control_ip>>
+        ceph_mon_01:
           expression: <<node_hostname>>__equals__cmn03
           cluster_param:
-            ceph_monitor_03_address:
+            ceph_mon_node01_address:
+              value_template: <<node_control_ip>>
+        ceph_mon_02:
+          expression: <<node_hostname>>__equals__cmn02
+          cluster_param:
+            ceph_mon_node02_address:
+              value_template: <<node_control_ip>>
+        ceph_mon_03:
+          expression: <<node_hostname>>__equals__cmn03
+          cluster_param:
+            ceph_mon_node03_address:
               value_template: <<node_control_ip>>
         ceph_cfs:
           expression: <<node_hostname>>__startswith__cfs