Hello,
The task is as below:
- name: replace
lineinfile:
dest: /tmp/sample/test_file.txt
regexp: “#}”
insertafter: ’ "compute": 2,’
line: “}”
state: present
And below is my file content:
#OPENSTACK_API_VERSIONS = {
“data-processing”: 1.1,
“identity”: 3,
“image”: 2,
“volume”: 2,
“compute”: 2,
#}
#PROJECT_TABLE_EXTRA_INFO = {
‘phone_num’: _(‘Phone Number’),
#}
#USER_TABLE_EXTRA_INFO = {
‘phone_num’: _(‘Phone Number’),
#}
EXPECTED RESULT:
OPENSTACK_API_VERSIONS = {
“data-processing”: 1.1,
“identity”: 3,
“image”: 2,
“volume”: 2,
“compute”: 2,
}
#PROJECT_TABLE_EXTRA_INFO = {
‘phone_num’: _(‘Phone Number’),
#}
#USER_TABLE_EXTRA_INFO = {
‘phone_num’: _(‘Phone Number’),
#}
CURRENT RESULT:
OPENSTACK_API_VERSIONS = {
“data-processing”: 1.1,
“identity”: 3,
“image”: 2,
“volume”: 2,
“compute”: 2,
#}
#PROJECT_TABLE_EXTRA_INFO = {
‘phone_num’: _(‘Phone Number’),
#}
#USER_TABLE_EXTRA_INFO = {
‘phone_num’: _(‘Phone Number’),
}
The line mentioned in insertafter is not recognized. Kindly, suggest a way forward.
Regards,
Mona G