Merge "Fixing acronym for BGPVPN composable service"
[apex-tripleo-heat-templates.git] / puppet / services / panko-api.yaml
index fc127a2..43e7aa1 100644 (file)
@@ -24,6 +24,12 @@ parameters:
   EnableInternalTLS:
     type: boolean
     default: false
+  PankoApiPolicies:
+    description: |
+      A hash of policies to configure for Panko API.
+      e.g. { panko-context_is_admin: { key: context_is_admin, value: 'role:admin' } }
+    default: {}
+    type: json
 
 resources:
   PankoBase:
@@ -58,6 +64,7 @@ outputs:
                   "%{hiera('fqdn_$NETWORK')}"
                 params:
                   $NETWORK: {get_param: [ServiceNetMap, PankoApiNetwork]}
+            panko::policy::policies: {get_param: PankoApiPolicies}
             panko::api::service_name: 'httpd'
             panko::api::enable_proxy_headers_parsing: true
             tripleo.panko_api.firewall_rules:
@@ -85,8 +92,21 @@ outputs:
       metadata_settings:
         get_attr: [ApacheServiceBase, role_data, metadata_settings]
       upgrade_tasks:
-        # The panko API isn't installed in newton images, so install
-        # it on upgrade
-        - name: Install openstack-panko-api packages on upgrade
+        - name: Check if httpd is deployed
+          command: systemctl is-enabled httpd
+          tags: common
+          ignore_errors: True
+          register: httpd_enabled
+        - name: "PreUpgrade step0,validation: Check if httpd is running"
+          shell: >
+            /usr/bin/systemctl show 'httpd' --property ActiveState |
+            grep '\bactive\b'
+          when: httpd_enabled.rc == 0
+          tags: step0,validation
+        - name: Stop panko-api service (running under httpd)
+          tags: step1
+          service: name=httpd state=stopped
+          when: httpd_enabled.rc == 0
+        - name: Install openstack-panko-api package if it was not installed
           tags: step3
           yum: name=openstack-panko-api state=latest