我正在尝试将服务器的主机名写入配置文件,但它给了我问题。你能帮忙看一下代码吗?
---
- name: Update host.
hosts: all
connection: local
# Default Value
domain: '{{ default_domain }}'
hostname: “serv1.{{ '{{' }} domain {{ '}}' }}"
tasks:
- name: Update hostname config file
block:
- lineinfile:
path: /home/test/conf.yml
state: present
regexp: 'authorization-uri:(.*)$'
line: "authorization-uri: https://{{ serv1.{{ '{{' }} domain {{ '}}' }}/key/auth/mvn/vars/lenz/svc/chk”
Domain = serv1
Hostname = app2
Output should be:
https://serv1.app2/key/auth/mvn/vars/lenz/svc/chk”