2 # Copyright 2014, Rackspace US, Inc.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 # cmframework.requires: memcached-install.yml,galera-install.yml,rabbitmq-install.yml,rsyslog-install.yml
17 - name: Prepare MQ/DB services
20 environment: "{{ deployment_environment_variables | default({}) }}"
25 - name: Configure rabbitmq vhost/user
26 include: common-tasks/rabbitmq-vhost-user.yml
28 user: "{{ keystone_rabbitmq_userid }}"
29 password: "{{ keystone_rabbitmq_password }}"
30 vhost: "{{ keystone_rabbitmq_vhost }}"
31 _rabbitmq_host_group: "{{ keystone_rabbitmq_host_group }}"
33 - "groups[keystone_rabbitmq_host_group] | length > 0"
36 - name: Configure rabbitmq vhost/user (telemetry)
37 include: common-tasks/rabbitmq-vhost-user.yml
39 user: "{{ keystone_rabbitmq_telemetry_userid }}"
40 password: "{{ keystone_rabbitmq_telemetry_password }}"
41 vhost: "{{ keystone_rabbitmq_telemetry_vhost }}"
42 _rabbitmq_host_group: "{{ keystone_rabbitmq_telemetry_host_group }}"
44 - "keystone_ceilometer_enabled | bool"
45 - "groups[keystone_rabbitmq_telemetry_host_group] is defined"
46 - "groups[keystone_rabbitmq_telemetry_host_group] | length > 0"
47 - "groups[keystone_rabbitmq_telemetry_host_group] != groups[keystone_rabbitmq_host_group]"
50 - name: Configure MySQL user
51 include: common-tasks/mysql-db-user.yml
53 user_name: "{{ keystone_galera_user }}"
54 password: "{{ keystone_container_mysql_password }}"
55 login_host: "{{ keystone_galera_address }}"
56 db_name: "{{ keystone_galera_database }}"
61 - name: Installation and setup of Keystone
63 serial: "{{ keystone_serial | default(['1', '100%']) }}"
64 gather_facts: "{{ osa_gather_facts | default(True) }}"
65 environment: "{{ deployment_environment_variables | default({}) }}"
70 # In order to ensure that any container, software or
71 # config file changes which causes a container/service
72 # restart do not cause an unexpected outage, we drain
73 # the load balancer back end for this container.
74 - include: common-tasks/haproxy-endpoint-manage.yml
76 haproxy_backend: "{{ item }}"
77 haproxy_state: disabled
78 when: "groups['keystone_all'] | length > 1"
80 - "keystone_service-back"
81 - "keystone_admin-back"
83 - name: Configure container
84 include: "common-tasks/os-{{ container_tech | default('lxc') }}-container-setup.yml"
86 extra_container_config_no_restart:
87 - "lxc.start.order=19"
89 - name: Configure log directories (on metal)
90 include: common-tasks/os-log-dir-setup.yml
93 - src: "/openstack/log/{{ inventory_hostname }}-keystone"
94 dest: "/var/log/keystone"
96 - include: common-tasks/unbound-clients.yml
99 - hostvars['localhost']['resolvconf_enabled'] | bool
101 # todo(cloudnull): this task is being run only if/when keystone is installed on a physical host.
102 # This is not being run within a container because it is an unsupported action due to this
103 # issue: (https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1279041)
104 # This issue was resolved however we'll need to eval it in the next LTS release.
105 # Related OSA Bug: https://launchpad.net/bugs/1426371
106 - name: Add keystone reserved port to physical host
108 name: "{{ item.key }}"
109 value: "{{ item.value }}"
110 sysctl_set: "{{ item.set|default('yes') }}"
111 state: "{{ item.state|default('present') }}"
112 reload: "{{ item.reload|default('yes') }}"
114 - { key: "net.ipv4.ip_local_reserved_ports", value: "{{ keystone_admin_port }}"}
115 when: is_metal | bool
118 - role: "os_keystone"
119 when: (reinitialized_nodes is not defined and scaled_out_nodes is not defined) or ((reinitialized_nodes is defined) and ((reinitialized_nodes | intersect(groups['keystone_all'])) | length > 0)) or (scaled_out_nodes is defined and hostname in scaled_out_nodes)
120 - role: "openstack_openrc"
123 - role: "rsyslog_client"
124 rsyslog_client_log_rotate_file: keystone_log_rotate
125 rsyslog_client_log_dir: "/var/log/keystone"
126 rsyslog_client_config_name: "99-keystone-rsyslog-client.conf"
129 - role: "system_crontab_coordination"
134 # Now that container changes are done, we can set
135 # the load balancer back end for this container
136 # to available again.
137 - include: common-tasks/haproxy-endpoint-manage.yml
139 haproxy_backend: "{{ item }}"
140 haproxy_state: enabled
141 when: "groups['keystone_all'] | length > 1"
143 - "keystone_service-back"
144 - "keystone_admin-back"
146 # These facts are set against the deployment host to ensure that
147 # they are fast to access. This is done in preference to setting
148 # them against each target as the hostvars extraction will take
149 # a long time if executed against a large inventory.
150 - name: Finalise data migrations if required
153 environment: "{{ deployment_environment_variables | default({}) }}"
157 - name: refresh local facts
159 filter: ansible_local
160 gather_subset: "!all"
162 # This variable contains the values of the local fact set for the keystone
163 # venv tag for all hosts in the 'keystone_all' host group.
164 - name: Gather software version list
166 keystone_all_software_versions: "{{ (groups['keystone_all'] | map('extract', hostvars, ['ansible_local', 'openstack_ansible', 'keystone', 'venv_tag'])) | list }}"
167 delegate_to: localhost
170 # This variable outputs a boolean value which is True when
171 # keystone_all_software_versions contains a list of defined
172 # values. If they are not defined, it means that not all
173 # hosts have their software deployed yet.
174 - name: Set software deployed fact
176 keystone_all_software_deployed: "{{ (keystone_all_software_versions | select('defined')) | list == keystone_all_software_versions }}"
177 delegate_to: localhost
180 # This variable outputs a boolean when all the values in
181 # keystone_all_software_versions are the same and the software
182 - name: Set software updated fact
184 keystone_all_software_updated: "{{ ((keystone_all_software_versions | unique) | length == 1) and (keystone_all_software_deployed | bool) }}"
185 delegate_to: localhost
188 - name: Perform a Keystone DB sync contract
189 command: "{{ keystone_bin }}/keystone-manage db_sync --contract"
191 become_user: "{{ keystone_system_user_name }}"
193 - "keystone_all_software_updated | bool"
194 - "ansible_local['openstack_ansible']['keystone']['need_db_contract'] | bool"
195 register: dbsync_contract
198 - name: Disable the need for any further db sync
200 dest: "/etc/ansible/facts.d/openstack_ansible.fact"
202 option: "need_db_contract"
205 - "dbsync_contract | succeeded"