tripleo-ansible/tripleo_ansible/roles/tripleo_upgrade_hiera/tasks/remove.yml

38 lines
1.4 KiB
YAML

---
# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# 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: ensure tripleo-upgrade hiera file exists
include_tasks: create-tripleo-upgrade-file.yml
- name: reset tripleo_upgrade_hiera_data_del fact
set_fact:
tripleo_upgrade_hiera_data_del: {}
- name: remove a tripleo-upgrade key
set_fact:
tripleo_upgrade_hiera_data_del: "{{ tripleo_upgrade_hiera_data_del|combine({upgrade_hiera_item.key: upgrade_hiera_item.value}) }}"
cacheable: false
when: upgrade_hiera_item.key != tripleo_upgrade_key
loop_control:
loop_var: upgrade_hiera_item
loop: "{{ tripleo_upgrade_hiera_command.stdout | from_json | default({}) | dict2items }}"
- name: write the updated tripleo-upgrade hiera data
copy:
content: "{{ tripleo_upgrade_hiera_data_del | to_nice_json }}"
dest: "{{ tripleo_upgrade_hiera_file }}"
become: true