Bug 1904559

Summary: Unexpected template error when generating ReaR configuration file for control plane backup.
Product: Red Hat OpenStack Reporter: Alex Callejas <acalleja>
Component: tripleo-ansibleAssignee: Adriano Petrich <apetrich>
Status: CLOSED DUPLICATE QA Contact: David Rosenfeld <drosenfe>
Severity: low Docs Contact:
Priority: low    
Version: 16.1 (Train)CC: aschultz, drosenfe, jbadiapa, mburns, mrunge, slinaber
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-12-21 07:44:11 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Alex Callejas 2020-12-04 18:52:45 UTC
Description of problem:

Unexpected template error when generating ReaR configuration file for control plane backup.

Version-Release number of selected component (if applicable):

tripleo-ansible-0.5.1-0.20200611113659.34b8fcc.el8ost.noarch

How reproducible:

Following the instructions in the documentation (https://access.redhat.com/documentation/en-us/red_hat_openstack_platform/16.1/html-single/undercloud_and_control_plane_back_up_and_restore/index#installing-rear-on-the-undercloud-node_osp-ctlplane-br), in the section Installing ReaR on the undercloud node (step 3), when running playbook, results in the error:

AnsibleError: Unexpected templating type error occurred on (# This configuration file is generated automatically\n# by the backup-and-restore role part of TripleO\n# Ansible. No not edit this file, all changes\n# will be lost. Refer to the following URL for\n# more information and implementation details:\n# https://opendev.org/openstack/tripleo-ansible\n)

Steps to Reproduce:
1. Generate inventory file

   (undercloud) [stack@undercloud ~]$ tripleo-ansible-inventory \
   --ansible_ssh_user heat-admin \
   --static-yaml-inventory /home/stack/tripleo-inventory.yaml

2. Create playbook bar_rear_setup-undercloud.yaml

   (undercloud) [stack@undercloud ~]$ cat <<'EOF' > ~/bar_rear_setup-undercloud.yaml
   # Playbook
   # Installing and configuring ReaR on the undercloud node
   - become: true
     hosts: undercloud
     name: Install ReaR
     roles:
     - role: backup-and-restore
   EOF

3. Run the playbook

   (undercloud) [stack@undercloud ~]$ ansible-playbook \
       -v -i ~/tripleo-inventory.yaml \
       --extra="ansible_ssh_common_args='-o StrictHostKeyChecking=no'" \
       --become \
       --become-user root \
       --tags bar_setup_rear \
       ~/bar_rear_setup-undercloud.yaml

Actual results:

TASK [backup-and-restore : Generate ReaR config file] ***********************************************************************************************************************
task path: /usr/share/ansible/roles/backup-and-restore/setup_rear/tasks/main.yml:81
fatal: [undercloud]: FAILED! => {"changed": false, "msg": "AnsibleError: Unexpected templating type error occurred on (# This configuration file is generated automatically\n# by the backup-and-restore role part of TripleO\n# Ansible. No not edit this file, all changes\n# will be lost. Refer to the following URL for\n# more information and implementation details:\n# https://opendev.org/openstack/tripleo-ansible\n\nOUTPUT_URL={{ tripleo_backup_and_restore_output_url }}\nISO_PREFIX={{ tripleo_backup_and_restore_hostname.stdout }}\nBACKUP_PROG_OPTIONS+=( --anchored --xattrs-include='*.*' --xattrs )\nBACKUP_PROG_EXCLUDE=( {{ tripleo_backup_and_restore_exclude_paths | sum(start=[]) | map('quote') | join(' ') }} )\nBACKUP_URL={{ tripleo_backup_and_restore_backup_url }}\n{% for item in (tripleo_backup_and_restore_local_config | dict2items) %}\n{{ item.key }}={{ item.value }}\n{% endfor %}\n): can only concatenate list (not \"str\") to list"}

PLAY RECAP ******************************************************************************************************************************************************************
undercloud                 : ok=9    changed=3    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   

Expected results:

TASK [backup-and-restore : Generate ReaR config file] ***********************************************************************************************************************
changed: [undercloud] => {"backup_file": "/etc/rear/local.conf.208110.2020-12-04@13:32:26~", "changed": true, "checksum": "4692a28ba1364eca64303e85a57424635a4c2f4e", "dest": "/etc/rear/local.conf", "gid": 0, "group": "root", "md5sum": "defeb96580a5f714f754f8f066446abb", "mode": "0644", "owner": "root", "secontext": "system_u:object_r:etc_t:s0", "size": 706, "src": "/tmp/ansible-stack/ansible-tmp-1607106745.315044-207148-111409132503223/source", "state": "file", "uid": 0}

TASK [backup-and-restore : Generate ReaR rescue file] ***********************************************************************************************************************
changed: [undercloud] => {"changed": true, "checksum": "67805497abaa960b0a94f60914f1136c402bfdb4", "dest": "/etc/rear/rescue.conf", "gid": 0, "group": "root", "md5sum": "ff3cde95c2745ee7180646eadc06ddd5", "mode": "0644", "owner": "root", "secontext": "system_u:object_r:etc_t:s0", "size": 359, "src": "/tmp/ansible-stack/ansible-tmp-1607106746.1486518-208420-15165577755047/source", "state": "file", "uid": 0}

TASK [backup-and-restore : Gather variables for each operating system] ******************************************************************************************************
ok: [undercloud] => (item=/usr/share/ansible/roles/backup-and-restore/vars/redhat.yml) => {"ansible_facts": {"tripleo_backup_and_restore_nfs_packages": ["nfs-utils"], "tripleo_backup_and_restore_rear_packages": ["rear", "syslinux", "genisoimage", "nfs-utils"]}, "ansible_included_var_files": ["/usr/share/ansible/roles/backup-and-restore/vars/redhat.yml"], "ansible_loop_var": "item", "changed": false, "item": "/usr/share/ansible/roles/backup-and-restore/vars/redhat.yml"}

PLAY RECAP ******************************************************************************************************************************************************************
undercloud                 : ok=12   changed=6    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0  

Additional info:

There is a documented workaround on opendev.org [https://opendev.org/openstack/tripleo-ansible/commit/c384348f5586bb5fb47bf59b7bb9e0a61f8178bf] that works.

Comment the register line (#67) of the file /usr/share/ansible/roles/backup-and-restore/setup_rear/tasks/main.yml:

#register: tripleo_backup_and_restore_exclude_paths

Comment 2 Juan Badia Payno 2020-12-21 07:44:11 UTC

*** This bug has been marked as a duplicate of bug 1860439 ***