Add FreeIPA AAA (idp/idm) CI lab [WIP]

Change-Id: Ifdc78334379bf4e639ee3f5d8097b9f57b397135
diff --git a/classes/cluster/aaa_ha_freeipa/aaa/freeipa_client.yml b/classes/cluster/aaa_ha_freeipa/aaa/freeipa_client.yml
new file mode 100644
index 0000000..c9150cb
--- /dev/null
+++ b/classes/cluster/aaa_ha_freeipa/aaa/freeipa_client.yml
@@ -0,0 +1,15 @@
+classes:
+#- system.haproxy.proxy.listen.
+#- system.linux.system.repo.freeipa
+#- system.salt.minion.cert.
+- system.freeipa.client.cluster
+- system.freeipa.client.dns
+- system.freeipa.client.nsupdate
+- system.freeipa.client.keytab.krb5
+- system.freeipa.client.keytab.apache2
+- cluster.aaa_ha_freeipa.aaa
+parameters:
+  _param:
+    keepalived_vip_interface: ${_param:primary_interface}
+    keepalived_vip_virtual_router_id: 99
+    freeipa_client_nsupdate_01_address: ${_param:freeipa_node01_hostname}
diff --git a/classes/cluster/aaa_ha_freeipa/aaa/freeipa_server.yml b/classes/cluster/aaa_ha_freeipa/aaa/freeipa_server.yml
new file mode 100644
index 0000000..5216422
--- /dev/null
+++ b/classes/cluster/aaa_ha_freeipa/aaa/freeipa_server.yml
@@ -0,0 +1,43 @@
+classes:
+# RHEL/Centos based
+#- system.linux.system.repo.saltstack.rhel7
+#- system.haproxy.proxy.listen.
+#- system.salt.minion.cert.
+- system.freeipa.server.cluster
+- cluster.aaa_ha_freeipa.aaa
+parameters:
+  _param:
+    linux_system_codename: centos
+    keepalived_vip_interface: ${_param:primary_interface}
+    keepalived_vip_virtual_router_id: 99
+
+  freeipa:
+    server:
+      realm: ${_param:cluster_domain}
+      domain: ${_param:cluster_domain}
+      servers:
+        - idm01.${_param:cluster_domain}
+        - idm02.${_param:cluster_domain}
+        - idm03.${_param:cluster_domain}
+      admin:
+        password: password
+      ldap:
+        password: password
+      dns:
+        key:
+          axfrkey:
+            # bind9utils
+            # dnssec-keygen -a HMAC-MD5 -b 128 -n HOST rndc-key
+            secret: "xoDeAf49FmBTiJWRJ1zNng=="
+            algorithm: hmac-md5
+            # algorithm: hmac-sha512
+        zone:
+          # Main zones
+          aaa-freeipa.local: ${_param:freeipa_dns_zone}
+
+          # Additional/Internal zones
+          # opencontrail.cz: ${_param:freeipa_dns_zone}
+
+          # Reverse zones
+          # 105.0.10.in-addr.arpa: ${_param:freeipa_dns_zone_reverse}
+
diff --git a/classes/cluster/aaa_ha_freeipa/aaa/init.yml b/classes/cluster/aaa_ha_freeipa/aaa/init.yml
new file mode 100644
index 0000000..9fb2124
--- /dev/null
+++ b/classes/cluster/aaa_ha_freeipa/aaa/init.yml
@@ -0,0 +1,102 @@
+classes:
+- cluster.aaa_ha_freeipa.aaa
+- system.linux.system.single
+- system.openssh.server.team.lab
+- system.openssh.server.team.tcpcloud
+- system.openssh.server.team.mcp_qa
+- system.openssh.server.team.mmo_devops
+parameters:
+  _param:
+    salt_minion_ca_host: ${_param:infra_config_hostname}.${_param:cluster_domain}
+    salt_minion_ca_authority: salt_master_ca
+
+    # freeipa settings
+
+    # addresses and hostnames
+    identity_control_hostname: idm
+    identity_control_address: 172.16.10.240
+    identity_control_node01_hostname: idm01
+    identity_control_node02_hostname: idm02
+    identity_control_node03_hostname: idm03
+    identity_control_node01_address: 172.16.10.241
+    identity_control_node02_address: 172.16.10.242
+    identity_control_node03_address: 172.16.10.243
+    identity_proxy_node01_hostname: prx01
+    identity_proxy_node02_hostname: prx02
+    identity_proxy_node01_address: 172.16.10.244
+    identity_proxy_node02_address: 172.16.10.245
+
+    # cluster meta
+    cluster_vip_address: ${_param:identity_control_address}
+    cluster_local_address: ${_param:single_address}
+    cluster_node01_hostname: ${_param:identity_control_node01_hostname}
+    cluster_node01_address: ${_param:identity_control_node01_address}
+    cluster_node02_hostname: ${_param:identity_control_node02_hostname}
+    cluster_node02_address: ${_param:identity_control_node02_address}
+    cluster_node03_hostname: ${_param:identity_control_node03_hostname}
+    cluster_node03_address: ${_param:identity_control_node03_address}
+
+    freeipa_node01_hostname: ${_param:cluster_node01_address}
+    freeipa_node02_hostname: ${_param:cluster_node02_address}
+    freeipa_node03_hostname: ${_param:cluster_node03_address}
+    freeipa_client_nsupdate_01_address: ${_param:cluster_node01_address}
+
+
+  linux:
+    network:
+      resolv:
+        domain: virtual-aaa-freeipa.local
+        options:
+          - ndots:5
+          - timeout:2
+          - attempts:2
+      host:
+        idm:
+          address: ${_param:identity_control_address}
+          names:
+          - ${_param:identity_control_hostname}
+          - ${_param:identity_control_hostname}.${_param:cluster_domain}
+        idm01:
+          address: ${_param:identity_control_node01_address}
+          names:
+          - ${_param:identity_control_node01_hostname}
+          - ${_param:identity_control_node01_hostname}.${_param:cluster_domain}
+        idm02:
+          address: ${_param:identity_control_node02_address}
+          names:
+          - ${_param:identity_control_node02_hostname}
+          - ${_param:identity_control_node02_hostname}.${_param:cluster_domain}
+        idm03:
+          address: ${_param:identity_control_node03_address}
+          names:
+          - ${_param:identity_control_node03_hostname}
+          - ${_param:identity_control_node03_hostname}.${_param:cluster_domain}
+        cmp01:
+          address: ${_param:identity_compute_node01_address}
+          names:
+          - ${_param:identity_compute_node01_hostname}
+          - ${_param:identity_compute_node01_hostname}.${_param:cluster_domain}
+        cmp02:
+          address: ${_param:identity_compute_node02_address}
+          names:
+          - ${_param:identity_compute_node02_hostname}
+          - ${_param:identity_compute_node02_hostname}.${_param:cluster_domain}
+        prx01:
+          address: ${_param:identity_proxy_node01_address}
+          names:
+          - ${_param:identity_proxy_node01_hostname}
+          - ${_param:identity_proxy_node01_hostname}.${_param:cluster_domain}
+    system:
+      rc:
+        local: |
+          #!/bin/sh -e
+          #
+          # rc.local
+          #
+          ######### This file is managed by Salt! ##########
+          # This script is executed at the end of each multiuser runlevel.
+          # Make sure that the script will "exit 0" on success or any other
+          # value on error.
+          #
+          ip r a 10.254.0.0/16 dev ens3
+          exit 0
diff --git a/classes/cluster/aaa_ha_freeipa/infra/config.yml b/classes/cluster/aaa_ha_freeipa/infra/config.yml
new file mode 100644
index 0000000..c993809
--- /dev/null
+++ b/classes/cluster/aaa_ha_freeipa/infra/config.yml
@@ -0,0 +1,78 @@
+alasses:
+- system.linux.system.repo.ubuntu
+- system.openssh.client.lab
+- system.salt.master.pkg
+- system.salt.minion.ca.salt_master
+- system.salt.master.api
+- system.salt.minion.cert.k8s_server
+- system.mysql.client
+- system.reclass.storage.salt
+- system.reclass.storage.system.kubernetes_control_cluster
+- cluster.aaa_ha_freeipa
+parameters:
+  _param:
+    salt_master_base_environment: prd
+    reclass_data_repository: "https://gerrit.mcp.mirantis.net/salt-models/mcp-virtual-lab.git"
+    reclass_data_revision: master
+    reclass_config_master: ${_param:infra_config_deploy_address}
+    single_address: ${_param:infra_config_address}
+    linux_system_codename: xenial
+    salt_api_password_hash: "$6$WV0P1shnoDh2gI/Z$22/Bcd7ffMv0jDlFpT63cAU4PiXHz9pjXwngToKwqAsgoeK4HNR3PiKaushjxp3JsQ8hNoJmAC6TxzVqfV8WH/"
+    salt_master_host: 127.0.0.1
+  salt:
+    master:
+      reactor:
+        reclass/minion/classify:
+        - salt://reclass/reactor/node_register.sls
+  reclass:
+    storage:
+      class_mapping:
+        common_node:
+          expression: all
+          node_param:
+            single_address:
+              value_template: <<node_ip>>
+            linux_system_codename:
+              value_template: <<node_os>>
+            salt_master_host:
+              value_template: <<node_master_ip>>
+        infra_config:
+          expression: <<node_hostname>>__startswith__cfg
+          cluster_param:
+            infra_config_address:
+              value_template: <<node_ip>>
+            infra_config_deploy_address:
+              value_template: <<node_ip>>
+        identity_control01:
+          expression: <<node_hostname>>__equals__idm01
+          cluster_param:
+            identity_control_node01_address:
+              value_template: <<node_ip>>
+          node_class:
+            value_template:
+              #- system.linux.system.repo.saltstack.rhel7
+              - cluster.<<node_cluster>>.aaa.freeipa_server
+        identity_control02:
+          expression: <<node_hostname>>__equals__idm02
+          cluster_param:
+            identity_control_node02_address:
+              value_template: <<node_ip>>
+          node_class:
+            value_template:
+              #- system.linux.system.repo.saltstack.rhel7
+              - cluster.<<node_cluster>>.aaa.freeipa_server
+        identity_control03:
+          expression: <<node_hostname>>__equals__idm03
+          cluster_param:
+            identity_control_node03_address:
+              value_template: <<node_ip>>
+          node_class:
+            value_template:
+              #- system.linux.system.repo.saltstack.rhel7
+              - cluster.<<node_cluster>>.aaa.freeipa_server
+        identity_client:
+          expression: <<node_hostname>>__startswith__tst
+          node_class:
+            value_template:
+              - system.linux.system.repo.ubuntu
+              - cluster.<<node_cluster>>.aaa.freeipa_client
diff --git a/classes/cluster/aaa_ha_freeipa/infra/init.yml b/classes/cluster/aaa_ha_freeipa/infra/init.yml
new file mode 100644
index 0000000..783c19f
--- /dev/null
+++ b/classes/cluster/aaa_ha_freeipa/infra/init.yml
@@ -0,0 +1,41 @@
+classes:
+- system.linux.system.single
+- system.linux.system.repo.mcp.extra
+- system.linux.system.repo.mcp.salt
+- system.linux.system.repo.ubuntu
+- system.openssh.server.team.lab
+- system.openssh.server.team.tcpcloud
+- system.openssh.server.team.mcp_qa
+- system.openssh.server.team.mmo_devops
+- system.rsyslog.client.single
+parameters:
+  _param:
+    # infra service addresses
+    infra_config_hostname: cfg01
+    infra_config_address: 172.16.10.100
+    infra_config_deploy_address: 192.168.10.100
+
+    cluster_domain: virtual-aaa-freeipa.local
+    cluster_name: virtual-aaa-freeipa
+    apt_mk_version: nightly
+    primary_interface: ens3
+  linux:
+    network:
+      host:
+        cfg01:
+          address: ${_param:infra_config_address}
+          names:
+          - ${_param:infra_config_hostname}
+          - ${_param:infra_config_hostname}.${_param:cluster_domain}
+      interface:
+        primary_interface:
+          enabled: true
+          type: eth
+          proto: dhcp
+          #proto: static
+          #name: ${_param:primary_interface}
+          #address: ${_param:single_address}
+          #netmask: 255.255.255.0
+    system:
+      name: ${_param:infra_config_hostname}
+      domain: ${_param:cluster_domain}
diff --git a/classes/cluster/aaa_ha_freeipa/init.yml b/classes/cluster/aaa_ha_freeipa/init.yml
new file mode 100644
index 0000000..baec503
--- /dev/null
+++ b/classes/cluster/aaa_ha_freeipa/init.yml
@@ -0,0 +1,4 @@
+classes:
+- cluster.aaa_ha_freeipa.aaa.freeipa
+- cluster.aaa_ha_freeipa.infra
+- cluster.overrides