ansible-role-yedit
ansible-role-yedit copied to clipboard
Error with string value beginning from "!" sign
I use ansible 2.7.9 (Ansible AWX 4.0.0.0), latest yedit. I found that yedit cannot parse the string if it begins from "!" sign, for example:
somerole/tasks/main.yml
- name: import kwoodson.yedit YAML editor
import_role:
name: ansible-role-yedit
- name: Update environment
yedit:
src: '{{ deploypath }}/file.yml'
separator: '|'
state: present
edits:
- { key: a|b, value: '{{ somevalue }}' }
host_vars/somehost
somevalue: '!sometext'
I receive an error:
File \"/tmp/ansible_yedit_payload_ECyASG/__main__.py\", line 969, in <module>\r\n File \"/tmp/ansible_yedit_payload_ECyASG/__main__.py\", line 961, in main\r\n File \"/tmp/ansible_yedit_payload_ECyASG/__main__.py\", line 889, in run_ansible\r\n File \"/tmp/ansible_yedit_payload_ECyASG/__main__.py\", line 784, in process_edits\r\n File \"/tmp/ansible_yedit_payload_ECyASG/__main__.py\", line 775, in parse_value\r\n__main__.YeditException: Could not determine type of incoming value. value=[<type 'str'>] vtype=[]\r\n"
Old issue but I've found that if you define value_type
as str
the error should disappear:
- name: import kwoodson.yedit YAML editor
import_role:
name: ansible-role-yedit
- name: Update environment
yedit:
src: '{{ deploypath }}/file.yml'
separator: '|'
state: present
value_type: str
edits:
- { key: a|b, value: '!sometext' }