Merge "Add environment to preselect only VIP IP addresses"
[apex-tripleo-heat-templates.git] / docker / services / keystone.yaml
1 heat_template_version: ocata
2
3 description: >
4   OpenStack containerized Keystone service
5
6 parameters:
7   DockerNamespace:
8     description: namespace
9     default: 'tripleoupstream'
10     type: string
11   DockerKeystoneImage:
12     description: image
13     default: 'centos-binary-keystone:latest'
14     type: string
15   EndpointMap:
16     default: {}
17     description: Mapping of service endpoint -> protocol. Typically set
18                  via parameter_defaults in the resource registry.
19     type: json
20   ServiceNetMap:
21     default: {}
22     description: Mapping of service_name -> network name. Typically set
23                  via parameter_defaults in the resource registry.  This
24                  mapping overrides those in ServiceNetMapDefaults.
25     type: json
26   DefaultPasswords:
27     default: {}
28     type: json
29   AdminPassword:
30     description: The password for the keystone admin account, used for monitoring, querying neutron etc.
31     type: string
32     hidden: true
33   KeystoneTokenProvider:
34     description: The keystone token format
35     type: string
36     default: 'fernet'
37     constraints:
38       - allowed_values: ['uuid', 'fernet']
39   EnableInternalTLS:
40     type: boolean
41     default: false
42
43 resources:
44
45   ContainersCommon:
46     type: ./containers-common.yaml
47
48   KeystoneBase:
49     type: ../../puppet/services/keystone.yaml
50     properties:
51       EndpointMap: {get_param: EndpointMap}
52       ServiceNetMap: {get_param: ServiceNetMap}
53       DefaultPasswords: {get_param: DefaultPasswords}
54
55 conditions:
56
57   internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]}
58
59 outputs:
60   role_data:
61     description: Role data for the Keystone API role.
62     value:
63       service_name: {get_attr: [KeystoneBase, role_data, service_name]}
64       config_settings:
65         map_merge:
66           - get_attr: [KeystoneBase, role_data, config_settings]
67           - apache::default_vhost: false
68       step_config: &step_config
69         list_join:
70           - "\n"
71           - - "['Keystone_user', 'Keystone_endpoint', 'Keystone_domain', 'Keystone_tenant', 'Keystone_user_role', 'Keystone_role', 'Keystone_service'].each |String $val| { noop_resource($val) }"
72             - {get_attr: [KeystoneBase, role_data, step_config]}
73       service_config_settings: {get_attr: [KeystoneBase, role_data, service_config_settings]}
74       # BEGIN DOCKER SETTINGS
75       puppet_config:
76         config_volume: keystone
77         puppet_tags: keystone_config
78         step_config: *step_config
79         config_image: &keystone_image
80           list_join:
81             - '/'
82             - [ {get_param: DockerNamespace}, {get_param: DockerKeystoneImage} ]
83       kolla_config:
84         /var/lib/kolla/config_files/keystone.json:
85           command: /usr/sbin/httpd -DFOREGROUND
86       docker_config:
87         step_3:
88           keystone-init-log:
89             start_order: 0
90             image: *keystone_image
91             user: root
92             command: ['/bin/bash', '-c', 'mkdir -p /var/log/httpd && mkdir -p /var/log/keystone && chown keystone:keystone /var/log/keystone']
93             volumes:
94               - logs:/var/log
95           keystone_db_sync:
96             start_order: 1
97             image: *keystone_image
98             net: host
99             privileged: false
100             detach: false
101             volumes: &keystone_volumes
102               yaql:
103                 expression: $.data.common.concat($.data.service)
104                 data:
105                   common: {get_attr: [ContainersCommon, volumes]}
106                   service:
107                     - /var/lib/kolla/config_files/keystone.json:/var/lib/kolla/config_files/config.json:ro
108                     - /var/lib/config-data/keystone/var/www/:/var/www/:ro
109                     - /var/lib/config-data/keystone/etc/keystone/:/etc/keystone/:ro
110                     - /var/lib/config-data/keystone/etc/httpd/:/etc/httpd/:ro
111                     - logs:/var/log
112                     -
113                       if:
114                         - internal_tls_enabled
115                         - /etc/pki/tls/certs/httpd:/etc/pki/tls/certs/httpd:ro
116                         - ''
117                     -
118                       if:
119                         - internal_tls_enabled
120                         - /etc/pki/tls/private/httpd:/etc/pki/tls/private/httpd:ro
121                         - ''
122             environment:
123               - KOLLA_BOOTSTRAP=True
124               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
125           keystone:
126             start_order: 1
127             image: *keystone_image
128             net: host
129             privileged: false
130             restart: always
131             volumes: *keystone_volumes
132             environment:
133               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
134           keystone_bootstrap:
135             start_order: 2
136             action: exec
137             command:
138               [ 'keystone', 'keystone-manage', 'bootstrap', '--bootstrap-password', {get_param: AdminPassword} ]
139       docker_puppet_tasks:
140         # Keystone endpoint creation occurs only on single node
141         step_3:
142           config_volume: 'keystone_init_tasks'
143           puppet_tags: 'keystone_config,keystone_domain_config,keystone_endpoint,keystone_identity_provider,keystone_paste_ini,keystone_role,keystone_service,keystone_tenant,keystone_user,keystone_user_role,keystone_domain'
144           step_config: 'include ::tripleo::profile::base::keystone'
145           config_image: *keystone_image
146       upgrade_tasks:
147         - name: Stop and disable keystone service (running under httpd)
148           tags: step2
149           service: name=httpd state=stopped enabled=no
150       metadata_settings:
151         get_attr: [KeystoneBase, role_data, metadata_settings]