complicated replace fails to match

I’m trying to append to a line that has a reasonably complicated snippet of python looking code.

defaultStatsSchema= [_tuple for _tuple in defaultArchiveSchema if _tuple[0] in stats_types] + [(‘wind’, ‘VECTOR’)]

to that line, I’m trying to add the following:

  • [(‘windAv’, ‘VECTOR’)] + [(‘outTempDay’, ‘REAL’)] + [(‘outTempNight’, ‘REAL’)]

The pythonish format of the lines seem to be confusing the replace: module in ansible 1.7.2 - I think

  • replace: dest=/home/weewx/bin/user/schemas.py regexp=“{{ item.orig }}” replace=“{{ item.new }}”

with_items:

  • {

orig: “defaultStatsSchema= [_tuple for _tuple in defaultArchiveSchema if _tuple[0] in stats_types] + [(‘wind’, ‘VECTOR’)]” ,

new: "defaultStatsSchema= [_tuple for _tuple in defaultArchiveSchema if _tuple[0] in stats_types] + [(‘wind’, ‘VECTOR’)] + [(‘windAv’, ‘VECTOR’)] + [(‘outTempDay’, ‘REAL’)] + [(‘outTempNight’, ‘REAL’)]

}

I guess I’m lost what to (or to not) escape in the original line above. The multiple [whatever] words in there seem to confuse the heck out of the replace module and either say ‘ok’ when it isn’t actually matching anything, or blowing up with an error at runtime. Clarification/help appreciated…