From 0e0147732c091360c6c3c7e34962507f7548fa15 Mon Sep 17 00:00:00 2001
From: Emilien Macchi <emilien@redhat.com>
Date: Wed, 13 Jun 2018 11:35:49 -0700
Subject: [PATCH] Implement TripleoValidations composable service

Implement a service that will deploy TripleO Validations package and
user by using Puppet like we did with instack-undercloud. This service
will be included on the undercloud but disabled by default. We'll keep
the same interface in undercloud.conf to enable it or not so no change
for the end user.

Change-Id: Ida09f92010e31d952edd82b42a7fc20451537d42
---
 environments/tripleo-validations.yaml         |  4 ++
 overcloud-resource-registry-puppet.j2.yaml    |  1 +
 puppet/services/tripleo-validations.yaml      | 42 +++++++++++++++++++
 .../tripleo-validations-b231184816a9ab64.yaml |  5 +++
 roles/Undercloud.yaml                         |  1 +
 roles_data_undercloud.yaml                    |  1 +
 6 files changed, 54 insertions(+)
 create mode 100644 environments/tripleo-validations.yaml
 create mode 100644 puppet/services/tripleo-validations.yaml
 create mode 100644 releasenotes/notes/tripleo-validations-b231184816a9ab64.yaml

diff --git a/environments/tripleo-validations.yaml b/environments/tripleo-validations.yaml
new file mode 100644
index 0000000000..13d698d704
--- /dev/null
+++ b/environments/tripleo-validations.yaml
@@ -0,0 +1,4 @@
+# A Heat environment file that enables TripleO Validations.
+
+resource_registry:
+  OS::TripleO::Services::TripleoValidations: ../puppet/services/tripleo-validations.yaml
diff --git a/overcloud-resource-registry-puppet.j2.yaml b/overcloud-resource-registry-puppet.j2.yaml
index 7eeff015df..3bc2655bee 100644
--- a/overcloud-resource-registry-puppet.j2.yaml
+++ b/overcloud-resource-registry-puppet.j2.yaml
@@ -231,6 +231,7 @@ resource_registry:
   OS::TripleO::Services::Ipsec: OS::Heat::None
   OS::TripleO::Services::Rhsm: OS::Heat::None
   OS::TripleO::Services::MasqueradeNetworks: OS::Heat::None
+  OS::TripleO::Services::TripleoValidations: OS::Heat::None
   OS::TripleO::Services::UndercloudUpgrade: OS::Heat::None
   OS::TripleO::Services::Collectd: OS::Heat::None
   OS::TripleO::LoggingConfiguration: puppet/services/logging/fluentd-config.yaml
diff --git a/puppet/services/tripleo-validations.yaml b/puppet/services/tripleo-validations.yaml
new file mode 100644
index 0000000000..bba29d3e71
--- /dev/null
+++ b/puppet/services/tripleo-validations.yaml
@@ -0,0 +1,42 @@
+heat_template_version: rocky
+
+description: >
+  Configure TripleO Validations with Puppet.
+
+parameters:
+  ServiceData:
+    default: {}
+    description: Dictionary packing service data
+    type: json
+  ServiceNetMap:
+    default: {}
+    description: Mapping of service_name -> network name. Typically set
+                 via parameter_defaults in the resource registry.  This
+                 mapping overrides those in ServiceNetMapDefaults.
+    type: json
+  DefaultPasswords:
+    default: {}
+    type: json
+  RoleName:
+    default: ''
+    description: Role name on which the service is applied
+    type: string
+  RoleParameters:
+    default: {}
+    description: Parameters specific to the role
+    type: json
+  EndpointMap:
+    default: {}
+    description: Mapping of service endpoint -> protocol. Typically set
+                 via parameter_defaults in the resource registry.
+    type: json
+
+outputs:
+  role_data:
+    description: Role data for the TripleO Validations service.
+    value:
+      service_name: tripleo_validations
+      config_settings: {}
+      step_config: |
+        include tripleo::profile::base::validations
+      upgrade_tasks: []
diff --git a/releasenotes/notes/tripleo-validations-b231184816a9ab64.yaml b/releasenotes/notes/tripleo-validations-b231184816a9ab64.yaml
new file mode 100644
index 0000000000..44465914c8
--- /dev/null
+++ b/releasenotes/notes/tripleo-validations-b231184816a9ab64.yaml
@@ -0,0 +1,5 @@
+---
+features:
+  - |
+    Add composable service for TripleO Validations, that will be deployed
+    on the Undercloud when enabled.
diff --git a/roles/Undercloud.yaml b/roles/Undercloud.yaml
index 37ef2698a5..6bad637546 100644
--- a/roles/Undercloud.yaml
+++ b/roles/Undercloud.yaml
@@ -84,4 +84,5 @@
     - OS::TripleO::Services::TripleoUI
     - OS::TripleO::Services::Tuned
     - OS::TripleO::Services::UndercloudUpgrade
+    - OS::TripleO::Services::TripleoValidations
     - OS::TripleO::Services::Zaqar
diff --git a/roles_data_undercloud.yaml b/roles_data_undercloud.yaml
index 0574ac9315..30bef3e5a3 100644
--- a/roles_data_undercloud.yaml
+++ b/roles_data_undercloud.yaml
@@ -87,5 +87,6 @@
     - OS::TripleO::Services::TripleoUI
     - OS::TripleO::Services::Tuned
     - OS::TripleO::Services::UndercloudUpgrade
+    - OS::TripleO::Services::TripleoValidations
     - OS::TripleO::Services::Zaqar