openstack-ansible/scripts/upgrade-utilities/playbooks/user-secrets-adjustment.yml
Jesse Pretorius 9b13d416bd Remove all MQ vhost/user and DB create tasks
Now that all the MQ and database creation tasks are in the roles,
and use appropriate defaults, we can remove all the wiring from
group_vars and the tasks.

To cater to the changes in passwords, we also ensure that the
upgrade tooling renames any existing secrets.

The healthcheck-infrastructure.yml playbook is deliberately left
alone due to it being refactored anyway in
https://review.openstack.org/587408

Change-Id: Ie3960e2e2ac9c0aff0bc36f46182be2fc0a038b3
2018-07-31 14:19:11 +01:00

85 lines
3.4 KiB
YAML

---
# Copyright 2015, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: User secrets adjustments
hosts: localhost
connection: local
gather_facts: false
user: root
tasks:
- name: Read example user secrets file
shell: "grep '^[a-zA-Z]' {{ playbook_dir }}/../../../etc/openstack_deploy/user_secrets.yml"
register: secrets
- name: Rename changed secrets
lineinfile:
dest: "/etc/openstack_deploy/{{ _osa_secrets_file_name }}"
regexp: "^{{ item.old_name }}: (.*)$"
line: "{{ item.new_name }}: \\1"
backrefs: yes
with_items:
- old_name: "keystone_rabbitmq_password"
new_name: "keystone_oslomsg_rpc_password"
- old_name: "ceilometer_rabbitmq_password"
new_name: "ceilometer_oslomsg_rpc_password"
- old_name: "aodh_rabbitmq_password"
new_name: "aodh_oslomsg_rpc_password"
- old_name: "cinder_rabbitmq_password"
new_name: "cinder_oslomsg_rpc_password"
- old_name: "glance_rabbitmq_password"
new_name: "glance_oslomsg_rpc_password"
- old_name: "heat_rabbitmq_password"
new_name: "heat_oslomsg_rpc_password"
- old_name: "ironic_rabbitmq_password"
new_name: "ironic_oslomsg_rpc_password"
- old_name: "neutron_rabbitmq_password"
new_name: "neutron_oslomsg_rpc_password"
- old_name: "nova_rabbitmq_password"
new_name: "nova_oslomsg_rpc_password"
- old_name: "octavia_rabbitmq_password"
new_name: "octavia_oslomsg_rpc_password"
- old_name: "sahara_rabbitmq_password"
new_name: "sahara_oslomsg_rpc_password"
- old_name: "swift_rabbitmq_telemetry_password"
new_name: "swift_oslomsg_notify_password"
- old_name: "magnum_rabbitmq_password"
new_name: "magnum_oslomsg_rpc_password"
- old_name: "trove_rabbitmq_password"
new_name: "trove_oslomsg_rpc_password"
- old_name: "barbican_rabbitmq_password"
new_name: "barbican_oslomsg_rpc_password"
- old_name: "designate_rabbitmq_password"
new_name: "designate_oslomsg_rpc_password"
- old_name: "tacker_rabbitmq_password"
new_name: "tacker_oslomsg_rpc_password"
- name: Read user secrets file
shell: "grep '^[a-zA-Z]' /etc/openstack_deploy/{{ _osa_secrets_file_name }}"
register: user_secrets
- name: Add missing secrets
lineinfile:
dest: "/etc/openstack_deploy/{{ _osa_secrets_file_name }}"
line: "{{ item }}"
with_items: "{{ secrets.stdout_lines }}"
when:
- "user_secrets.stdout.find(item) == -1"
- name: Generate new secrets
shell: "/opt/ansible-runtime/bin/python {{ playbook_dir }}/../../../scripts/pw-token-gen.py --file /etc/openstack_deploy/{{ _osa_secrets_file_name }}"
vars:
_osa_secrets_file_name: "{{ osa_secrets_file_name | default('user_secrets.yml') }}"
ansible_python_interpreter: "/usr/bin/python"