ansible - 我需要更换这个https://localhost:${my.port}${my.context}services/ 使用 ansible
问题描述
嗨,我需要在 ansible 中替换下面的字符串
' https://localhost :${mgt.transport.https.port}${carbon.context}services/'
使用“本地主机:2222/服务”
我已经使用了一个使用 ansible 的命令。但它不起作用。
name: set ServerURL of the AuthManager [HUB_HOME]/repository/conf/api-manager.xml
replace:
dest: "{{packFolderNameAM}}/repository/conf/api-manager.xml"
regexp: '<ServerURL>https://localhost:${my.port}${my.context}services/</ServerURL>'- name: set ServerURL of the AuthManager [HUB_HOME]/repository/conf/api-manager.xml
replace: 'localhost/9444/services'
before: 'Admin username for the Authentication manager'
backup: yes
请帮我解决一下这个。谢谢!!
解决方案
因为 api-manager.xml 是一个文件。我们可以保留侧模板:作为不同的文件,并使用标签动态复制文件:在任务中:
这将阻止脚本编写。
或者
保留带有提到的变量的模板,并在剧本 var: 或基于角色的 var /main.yml 文件https://localhost :${my.port}${my.context}services/ 中定义变量然后变量将被填充
推荐阅读
- html - 修复了带有响应式垂直文本的侧边栏
- angular - 如何在 Angular 表单字段的选择选项中显示默认值
- php - saber文件管理器文件路径定义值php
- unity3d - 如何创建带有“噪声”的 2D 背景?统一
- java - NTP 时间戳到 UTC;32 位无符号秒 + 32 位小数字段
- ios - 制作一个 tableView 显示以前的用户输入(在其他视图中)
- three.js - 在three.js中渲染具有部分透明纹理的平面阴影
- jquery - jquery检测已被触摸的子菜单项的id
- rpmbuild - 如何在 rpm 规范文件中检查 RedHat (RHEL) 次要版本?
- sql - 关于构建巨大对象的巨大查询的问题?