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