Config Template doesn't respect variable names sections

Bug #1812245 reported by Andy McCrae
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
openstack-ansible
New
High
Kevin Carter

Bug Description

More information here:

https://github.com/ceph/ceph-ansible/issues/3496

Config Template will create duplicate sections if the override contains a section header that is a variable name. For example, using the following playbook and template file:

# cat playbooks/templates/test.file.j2
#This is my test file

[{{ ansible_hostname }}]
a = 1
b = 2
c = 3

# cat playbooks/test.yml
---
- name: test playbook
  hosts: localhost
  connection: local
  gather_facts: true
  tasks:
    - config_template:
        src: "templates/test.file.j2"
        config_type: "ini"
        config_overrides: "{{ my_overrides }}"
        dest: "/opt/test.file"
  vars:
    my_overrides:
      "{{ ansible_hostname }}":
        d: 4
        e: 5
        a: 3

# cat /opt/test.file
#This is my test file
[ubuntu]
a = 1
b = 2
c = 3

[ubuntu]
a = 3
d = 4
e = 5

Changed in openstack-ansible:
importance: Undecided → High
assignee: nobody → Kevin Carter (kevin-carter)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.