Adds network/cidr mapping into a new service property
[apex-tripleo-heat-templates.git] / puppet / services / monitoring / sensu-client.yaml
1 heat_template_version: pike
2
3 description: Sensu client configured with Puppet
4
5 parameters:
6   ServiceData:
7     default: {}
8     description: Dictionary packing service data
9     type: json
10   ServiceNetMap:
11     default: {}
12     description: Mapping of service_name -> network name. Typically set
13                  via parameter_defaults in the resource registry.  This
14                  mapping overrides those in ServiceNetMapDefaults.
15     type: json
16   DefaultPasswords:
17     default: {}
18     type: json
19   RoleName:
20     default: ''
21     description: Role name on which the service is applied
22     type: string
23   RoleParameters:
24     default: {}
25     description: Parameters specific to the role
26     type: json
27   EndpointMap:
28     default: {}
29     description: >
30       Mapping of service endpoint -> protocol. Typically set
31       via parameter_defaults in the resource registry.
32     type: json
33   AdminPassword:
34     description: Keystone admin user password
35     type: string
36   KeystoneRegion:
37     default: 'regionOne'
38     description: Keystone region for endpoint
39     type: string
40   SensuClientCustomConfig:
41     default: {}
42     description: Hash containing custom sensu-client variables.
43     type: json
44     label: Custom configuration for Sensu Client variables
45
46 resources:
47   SensuBase:
48     type: ./sensu-base.yaml
49     properties:
50       ServiceData: {get_param: ServiceData}
51       ServiceNetMap: {get_param: ServiceNetMap}
52       DefaultPasswords: {get_param: DefaultPasswords}
53       EndpointMap: {get_param: EndpointMap}
54       RoleName: {get_param: RoleName}
55       RoleParameters: {get_param: RoleParameters}
56
57 outputs:
58   role_data:
59     description: Role data for the Sensu client role.
60     value:
61       service_name: sensu_client
62       monitoring_subscription: all
63       config_settings:
64         map_merge:
65           - get_attr: [SensuBase, role_data, config_settings]
66           - sensu::api: false
67             sensu::client: true
68             sensu::server: false
69             sensu::client_custom:
70               map_merge:
71                 - {get_param: SensuClientCustomConfig}
72                 - openstack:
73                     username: 'admin'
74                     password: {get_param: AdminPassword}
75                     auth_url: {get_param: [EndpointMap, KeystoneInternal, uri]}
76                     tenant_name: 'admin'
77                     region: {get_param: KeystoneRegion}
78       step_config: |
79         include ::tripleo::profile::base::monitoring::sensu
80       upgrade_tasks:
81         - name: Check if sensu_client is deployed
82           command: systemctl is-enabled sensu-client
83           tags: common
84           ignore_errors: True
85           register: sensu_client_enabled
86         - name: Check status of sensu-client service
87           shell: >
88             /usr/bin/systemctl show sensu-client --property ActiveState |
89             grep '\bactive\b'
90           when: sensu_client_enabled.rc == 0
91           tags: step0,validation
92         - name: Stop sensu-client service
93           tags: step1
94           when: sensu_client_enabled.rc == 0
95           service: name=sensu-client state=stopped
96         - name: Install sensu package if it was disabled
97           tags: step3
98           yum: name=sensu state=latest
99           when: sensu_client_enabled.rc != 0