ansible - Ansible - 子目录上的 chdir 作为变量
问题描述
我是 Ansible 的新手。我想在以下方面提供圆顶帮助
我正在尝试将 chdir args ia playbok 用于我不知道名称的子目录。父目录是 /tmp/opatch 我需要找到的子目录的名称并将其用作变量
- name: Ansible find files in subdirectory examples
find:
path: /tmp/opatch
file_type: directory
register: files_matched
- set_fact:
opathdir:
- path: "{{ files_matched.files[0].path }}"
- name: Apply de psu
shell: $ORACLE_HOME/OPatch/opatch apply -silent -ocmrf /app/stage/bb/ocm.rsp
args:
chdir: "{{opathdir}}"
environment:
ORACLE_HOME: "{{ oracle_home }}"
PATH: "{{ oracle_home }}/bin"
register: applypsu
似乎只有硬编码 chdir 有效,但不能通过变量。
任何帮助表示赞赏
问候,
乔普
解决方案
推荐阅读
- php - 未捕获的错误:找不到类“Google_Client”
- webpack - 如何使用 CSS 文件修复 Storybook Webpack 错误
- python - 如何在不需要 *any* __init__.py 的情况下指定 setup.py 并使用查找包?
- javascript - 使用 window.scrollTo({top: 50}) 与 window.scrollTo(0, 50) 有区别吗?
- c# - 在 C# 中使用相同的数据返回上一个表单
- visual-studio-2019 - NuGet System.Windows.Forms.DataVisualization 包之间的差异
- amazon-web-services - AWS 负载均衡器无法正确路由流量
- shopify - Shopify 使用特定模板获取所有集合
- php - 从 XML 提要中的文本元素中提取 img src
- javascript - 重新加载页面时如何保持灯箱图像打开?