aboutsummaryrefslogtreecommitdiffstats
path: root/puppet/services/zaqar.yaml
blob: ea7ce980113832285fc0a08bf77bf434b9b7a528 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
heat_template_version: ocata

description: >
  Openstack Zaqar service. Shared for all Heat services.

parameters:
  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
  EndpointMap:
    default: {}
    description: Mapping of service endpoint -> protocol. Typically set
                 via parameter_defaults in the resource registry.
    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
  Debug:
    default: ''
    description: Set to True to enable debugging on all services.
    type: string
  ZaqarPassword:
    description: The password for Zaqar
    type: string
    hidden: true
  KeystoneRegion:
    type: string
    default: 'regionOne'
    description: Keystone region for endpoint
  ZaqarPolicies:
    description: |
      A hash of policies to configure for Zaqar.
      e.g. { zaqar-context_is_admin: { key: context_is_admin, value: 'role:admin' } }
    default: {}
    type: json
  ZaqarWorkers:
    type: string
    description: Set the number of workers for zaqar::wsgi::apache
    default: '%{::os_workers}'
  EnableInternalTLS:
    type: boolean
    default: false

conditions:
  zaqar_workers_zero: {equals : [{get_param: ZaqarWorkers}, 0]}

resources:

  ApacheServiceBase:
    type: ./apache.yaml
    properties:
      ServiceNetMap: {get_param: ServiceNetMap}
      DefaultPasswords: {get_param: DefaultPasswords}
      EndpointMap: {get_param: EndpointMap}
      EnableInternalTLS: {get_param: EnableInternalTLS}

outputs:
  role_data:
    description: Shared role data for the Heat services.
    value:
      service_name: zaqar
      config_settings:
        map_merge:
          - get_attr: [ApacheServiceBase, role_data, config_settings]
          - zaqar::policy::policies: {get_param: ZaqarPolicies}
            zaqar::keystone::authtoken::password: {get_param: ZaqarPassword}
            zaqar::keystone::authtoken::project_name: 'service'
            zaqar::keystone::authtoken::auth_url: {get_param: [EndpointMap, KeystoneInternal, uri_no_suffix]}
            zaqar::keystone::authtoken::auth_uri: {get_param: [EndpointMap, KeystoneInternal, uri]}
            zaqar::debug: {get_param: Debug}
            zaqar::server::service_name: 'httpd'
            zaqar::transport::websocket::bind: {get_param: [EndpointMap, ZaqarInternal, host]}
            zaqar::wsgi::apache::ssl: false
            zaqar::wsgi::apache::bind_host: {get_param: [ServiceNetMap, ZaqarApiNetwork]}
            zaqar::message_pipeline: 'zaqar.notification.notifier'
            zaqar::unreliable: true
            zaqar::wsgi::apache::servername:
              str_replace:
                template:
                  "%{hiera('fqdn_$NETWORK')}"
                params:
                  $NETWORK: {get_param: [ServiceNetMap, ZaqarApiNetwork]}
          -
            if:
            - zaqar_workers_zero
            - {}
            - zaqar::wsgi::apache::workers: {get_param: ZaqarWorkers}
      service_config_settings:
        keystone:
          zaqar::keystone::auth::password: {get_param: ZaqarPassword}
          zaqar::keystone::auth::public_url: {get_param: [EndpointMap, ZaqarPublic, uri]}
          zaqar::keystone::auth::admin_url: {get_param: [EndpointMap, ZaqarAdmin, uri]}
          zaqar::keystone::auth::internal_url: {get_param: [EndpointMap, ZaqarInternal, uri]}
          zaqar::keystone::auth::region: {get_param: KeystoneRegion}
          zaqar::keystone::auth::tenant: 'service'
          zaqar::keystone::auth_websocket::password: {get_param: ZaqarPassword}
          zaqar::keystone::auth_websocket::public_url: {get_param: [EndpointMap, ZaqarWebSocketPublic, uri]}
          zaqar::keystone::auth_websocket::admin_url: {get_param: [EndpointMap, ZaqarWebSocketAdmin, uri]}
          zaqar::keystone::auth_websocket::internal_url: {get_param: [EndpointMap, ZaqarWebSocketInternal, uri]}
          zaqar::keystone::auth_websocket::region: {get_param: KeystoneRegion}
          zaqar::keystone::auth_websocket::tenant: 'service'

      step_config: |
        include ::tripleo::profile::base::zaqar
      upgrade_tasks:
        yaql:
          expression: $.data.apache_upgrade + $.data.zaqar_upgrade
          data:
            apache_upgrade:
              get_attr: [ApacheServiceBase, role_data, upgrade_tasks]
            zaqar_upgrade:
              - name: Check if zaqar is deployed
                command: systemctl is-enabled openstack-zaqar
                tags: common
                ignore_errors: True
                register: zaqar_enabled
              - name: "PreUpgrade step0,validation: Check if openstack-zaqar is running"
                shell: >
                  /usr/bin/systemctl show 'openstack-zaqar' --property ActiveState |
                  grep '\bactive\b'
                when: zaqar_enabled.rc == 0
                tags: step0,validation
              - name: Check for zaqar running under apache (post upgrade)
                tags: step1
                shell: "httpd -t -D DUMP_VHOSTS | grep -q zaqar_wsgi"
                register: zaqar_apache
                ignore_errors: true
              - name: Stop zaqar service (running under httpd)
                tags: step1
                service: name=httpd state=stopped
                when: zaqar_apache.rc == 0
              - name: Stop and disable zaqar service (pre-upgrade not under httpd)
                tags: step1
                when: zaqar_enabled.rc == 0
                service: name=openstack-zaqar state=stopped enabled=no
              - name: Install openstack-zaqar package if it was disabled
                tags: step3
                yum: name=openstack-zaqar state=latest
                when: zaqar_enabled.rc != 0