ansible - 变量可以引用 vars 文件中的另一个变量吗?
问题描述
我想在 vars 文件本身中构建一个路径(我知道我可以从任务文件中做到这一点)。那将如何运作?
这就是我现在所拥有的:
backup-location: /mnt/cassandra-backup/
schemas-location: schemas/
tokens-location: tokens/
我正在从任务文件构建路径:
- name: Create schemas location
file:
path: "{{ backup-location }}{{ schemas-location }}"
state: directory
我想要这样的东西:
backup-location: /mnt/cassandra-backup/
schemas-location: "{{ backup-location }}"schemas/
tokens-location: "{{ backup-location }}"tokens/
任务文件将包含以下内容:
- name: Create schemas location
file:
path: "{{ schemas-location }}"
state: directory
解决方案
它会这样工作:
schemas-location: "{{ backup-location }}schemas/"
tokens-location: "{{ backup-location }}tokens/"
推荐阅读
- html - 中心牌但有左对齐?
- jqgrid - jqGrid,为动态下拉内联编辑设置初始值
- c# - 无法加载类型“IdentityModel.Client.DiscoveryClient”
- javascript - ReactJS 组件不显示
- android - 如何更改和保存切换首选项摘要
- java - 如何将 Spring Cloud Stream 功能 Bean 连接到 Kafka Binder?
- bash - 如何在 Github 工作流程中逃避多行秘密?
- squarespace - 使用自定义链接结构在 squarespace 中上传文件
- php - PHP XML 读取多节点
- r - 如何使用 r 知道两条线是否相交?是否有一个方程可以在不查看图表的情况下轻松检查?