summaryrefslogtreecommitdiffstats
path: root/puppet/services/keystone.yaml
blob: e35316362633083fd7ac24b1a83296a81fddc1ac (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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
heat_template_version: 2016-04-08

description: >
  OpenStack Keystone service configured with Puppet

parameters:
  KeystoneEnableDBPurge:
    default: true
    description: |
        Whether to create cron job for purging soft deleted rows in Keystone database.
    type: boolean
  KeystoneSSLCertificate:
    default: ''
    description: Keystone certificate for verifying token validity.
    type: string
  KeystoneSSLCertificateKey:
    default: ''
    description: Keystone key for signing tokens.
    type: string
    hidden: true
  KeystoneNotificationDriver:
    description: Comma-separated list of Oslo notification drivers used by Keystone
    default: ['messaging']
    type: comma_delimited_list
  KeystoneNotificationFormat:
    description: The Keystone notification format
    default: 'basic'
    type: string
    constraints:
      - allowed_values: [ 'basic', 'cadf' ]
  KeystoneRegion:
    type: string
    default: 'regionOne'
    description: Keystone region for endpoint
  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
  DefaultPasswords:
    default: {}
    type: json
  EndpointMap:
    default: {}
    description: Mapping of service endpoint -> protocol. Typically set
                 via parameter_defaults in the resource registry.
    type: json
  Debug:
    type: string
    default: ''
  AdminEmail:
    default: 'admin@example.com'
    description: The email for the keystone admin account.
    type: string
    hidden: true
  AdminPassword:
    description: The password for the keystone admin account, used for monitoring, querying neutron etc.
    type: string
    hidden: true
  AdminToken:
    description: The keystone auth secret and db password.
    type: string
    hidden: true
  RabbitPassword:
    description: The password for RabbitMQ
    type: string
    hidden: true
  RabbitUserName:
    default: guest
    description: The username for RabbitMQ
    type: string
  RabbitClientUseSSL:
    default: false
    description: >
        Rabbit client subscriber parameter to specify
        an SSL connection to the RabbitMQ host.
    type: string
  RabbitClientPort:
    default: 5672
    description: Set rabbit subscriber port, change this if using SSL
    type: number
  KeystoneWorkers:
    type: string
    description: Set the number of workers for keystone::wsgi::apache
    default: '"%{::processorcount}"'
  MonitoringSubscriptionKeystone:
    default: 'overcloud-kestone'
    type: string
  KeystoneCredential0:
    type: string
    description: The first Keystone credential key. Must be a valid key.
  KeystoneCredential1:
    type: string
    description: The second Keystone credential key. Must be a valid key.
  KeystoneLoggingSource:
    type: json
    default:
      tag: openstack.keystone
      path: /var/log/keystone/keystone.log

resources:

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

outputs:
  role_data:
    description: Role data for the Keystone role.
    value:
      service_name: keystone
      monitoring_subscription: {get_param: MonitoringSubscriptionKeystone}
      logging_source: {get_param: KeystoneLoggingSource}
      logging_groups:
        - keystone
      config_settings:
        map_merge:
          - get_attr: [ApacheServiceBase, role_data, config_settings]
          - keystone::database_connection:
              list_join:
                - ''
                - - {get_param: [EndpointMap, MysqlInternal, protocol]}
                  - '://keystone:'
                  - {get_param: AdminToken}
                  - '@'
                  - {get_param: [EndpointMap, MysqlInternal, host]}
                  - '/keystone'
            keystone::admin_token: {get_param: AdminToken}
            keystone::roles::admin::password: {get_param: AdminPassword}
            keystone_ssl_certificate: {get_param: KeystoneSSLCertificate}
            keystone_ssl_certificate_key: {get_param: KeystoneSSLCertificateKey}
            keystone::enable_proxy_headers_parsing: true
            keystone::enable_credential_setup: true
            keystone::credential_keys:
              '/etc/keystone/credential-keys/0':
                content: {get_param: KeystoneCredential0}
              '/etc/keystone/credential-keys/1':
                content: {get_param: KeystoneCredential1}
            keystone::debug: {get_param: Debug}
            keystone::rabbit_userid: {get_param: RabbitUserName}
            keystone::rabbit_password: {get_param: RabbitPassword}
            keystone::rabbit_use_ssl: {get_param: RabbitClientUseSSL}
            keystone::rabbit_port: {get_param: RabbitClientPort}
            keystone::notification_driver: {get_param: KeystoneNotificationDriver}
            keystone::notification_format: {get_param: KeystoneNotificationFormat}
            keystone::roles::admin::email: {get_param: AdminEmail}
            keystone::roles::admin::password: {get_param: AdminPassword}
            keystone::endpoint::public_url: {get_param: [EndpointMap, KeystonePublic, uri_no_suffix]}
            keystone::endpoint::internal_url: {get_param: [EndpointMap, KeystoneInternal, uri_no_suffix]}
            keystone::endpoint::admin_url: {get_param: [EndpointMap, KeystoneAdmin, uri_no_suffix]}
            keystone::endpoint::region: {get_param: KeystoneRegion}
            keystone_enable_db_purge: {get_param: KeystoneEnableDBPurge}
            keystone::rabbit_heartbeat_timeout_threshold: 60
            keystone::cron::token_flush::maxdelay: 3600
            keystone::roles::admin::service_tenant: 'service'
            keystone::roles::admin::admin_tenant: 'admin'
            keystone::cron::token_flush::destination: '/dev/null'
            keystone::config::keystone_config:
              ec2/driver:
                value: 'keystone.contrib.ec2.backends.sql.Ec2'
            keystone::service_name: 'httpd'
            keystone::wsgi::apache::ssl: false
            keystone::wsgi::apache::servername:
              str_replace:
                template:
                  '"%{::fqdn_$NETWORK}"'
                params:
                  $NETWORK: {get_param: [ServiceNetMap, KeystonePublicApiNetwork]}
            keystone::wsgi::apache::servername_admin:
              str_replace:
                template:
                  '"%{::fqdn_$NETWORK}"'
                params:
                  $NETWORK: {get_param: [ServiceNetMap, KeystoneAdminApiNetwork]}
            keystone::wsgi::apache::workers: {get_param: KeystoneWorkers}
            # override via extraconfig:
            keystone::wsgi::apache::threads: 1
            keystone::db::database_db_max_retries: -1
            keystone::db::database_max_retries: -1
            tripleo.keystone.firewall_rules:
              '111 keystone':
                dport:
                  - 5000
                  - 13000
                  - 35357
                  - 13357
            # NOTE: bind IP is found in Heat replacing the network name with the
            # local node IP for the given network; replacement examples
            # (eg. for internal_api):
            # internal_api -> IP
            # internal_api_uri -> [IP]
            # internal_api_subnet - > IP/CIDR
            # NOTE: this applies to all 4 bind IP settings below...
            keystone::admin_bind_host: {get_param: [ServiceNetMap, KeystoneAdminApiNetwork]}
            keystone::public_bind_host: {get_param: [ServiceNetMap, KeystonePublicApiNetwork]}
            keystone::wsgi::apache::bind_host: {get_param: [ServiceNetMap, KeystonePublicApiNetwork]}
            keystone::wsgi::apache::admin_bind_host: {get_param: [ServiceNetMap, KeystoneAdminApiNetwork]}
      step_config: |
        include ::tripleo::profile::base::keystone
      service_config_settings:
        mysql:
          keystone::db::mysql::password: {get_param: AdminToken}
          keystone::db::mysql::user: keystone
          keystone::db::mysql::host: {get_param: [EndpointMap, MysqlInternal, host_nobrackets]}
          keystone::db::mysql::dbname: keystone
          keystone::db::mysql::allowed_hosts:
            - '%'
            - "%{hiera('mysql_bind_host')}"
t(url, target): cmd = ['wget', url, '--quiet', '--output-document', target] _clean_check(cmd, target) def has_wget(): cmd = ['wget', '--version'] with open(os.path.devnull, 'wb') as devnull: try: subprocess.check_call(cmd, stdout=devnull, stderr=devnull) except Exception: return False return True download_file_wget.viable = has_wget def download_file_insecure(url, target): """ Use Python to download the file, even though it cannot authenticate the connection. """ src = urlopen(url) try: # Read all the data in one block. data = src.read() finally: src.close() # Write all the data in one block to avoid creating a partial file. with open(target, "wb") as dst: dst.write(data) download_file_insecure.viable = lambda: True def get_best_downloader(): downloaders = ( download_file_powershell, download_file_curl, download_file_wget, download_file_insecure, ) viable_downloaders = (dl for dl in downloaders if dl.viable()) return next(viable_downloaders, None) def download_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir, delay=15, downloader_factory=get_best_downloader): """ Download setuptools from a specified location and return its filename `version` should be a valid setuptools version number that is available as an sdist for download under the `download_base` URL (which should end with a '/'). `to_dir` is the directory where the egg will be downloaded. `delay` is the number of seconds to pause before an actual download attempt. ``downloader_factory`` should be a function taking no arguments and returning a function for downloading a URL to a target. """ # making sure we use the absolute path to_dir = os.path.abspath(to_dir) zip_name = "setuptools-%s.zip" % version url = download_base + zip_name saveto = os.path.join(to_dir, zip_name) if not os.path.exists(saveto): # Avoid repeated downloads log.warn("Downloading %s", url) downloader = downloader_factory() downloader(url, saveto) return os.path.realpath(saveto) def _build_install_args(options): """ Build the arguments to 'python setup.py install' on the setuptools package """ return ['--user'] if options.user_install else [] def _parse_args(): """ Parse the command line for options """ parser = optparse.OptionParser() parser.add_option( '--user', dest='user_install', action='store_true', default=False, help='install in user site package (requires Python 2.6 or later)') parser.add_option( '--download-base', dest='download_base', metavar="URL", default=DEFAULT_URL, help='alternative URL from where to download the setuptools package') parser.add_option( '--insecure', dest='downloader_factory', action='store_const', const=lambda: download_file_insecure, default=get_best_downloader, help='Use internal, non-validating downloader' ) parser.add_option( '--version', help="Specify which version to download", default=DEFAULT_VERSION, ) options, args = parser.parse_args() # positional arguments are ignored return options def main(): """Install or upgrade setuptools and EasyInstall""" options = _parse_args() archive = download_setuptools( version=options.version, download_base=options.download_base, downloader_factory=options.downloader_factory, ) return _install(archive, _build_install_args(options)) if __name__ == '__main__': sys.exit(main())