ansible – Regex is stripping spaces


I need help fixing regex expression. Its stripping the preceding white spaces after writing to output file.
here is the code

hosts: serv1
tasks:
– name: Rename VM hostname
block:
– command: hostname -f
register: result
– lineinfile:
path: /home/home/setup.yml
state: present
regexp: ‘URL: (.*)$’
line: “URL: ‘https://{{ result.stdout }}/key/auth'”

the expected output is

    KEY_USER: ‘KEY_ADMIN'
    KEY_PASS: “KEY_PASS"
    URL: 'https://serv1/key/auth'
    KEY_CLIENT: “CLIENT_KEY"
    LDAP_URL: ‘LDAP_URL'

but I get

    KEY_USER: ‘KEY_ADMIN'
    KEY_PASS: “KEY_PASS"
URL: 'https://serv1/key/auth'
    KEY_CLIENT: “CLIENT_KEY"
    LDAP_URL: ‘LDAP_URL'

Any idea on how to fix it?
Thanks