首页 > 解决方案 > Ansible 任务错误:{“msg”:“目标目录 /opt/connectdirect/ndm/cfg/CD.STK 不存在”}

问题描述

我正在修改 ansible 任务以在 EC2 实例中直接安装 IBM connect。但是,它在下一阶段失败了

# Add config files
- block:
  - name: Add netmap.cfg
    template:
      src: "cfg/netmap.cfg"
      dest: "{{ install_dir }}/ndm/cfg/{{ node_name }}/netmap.cfg"
  - name: Add userfile.cfg
    template:
      src: "cfg/userfile.cfg"
      dest: "{{ install_dir }}/ndm/cfg/{{ node_name }}/userfile.cfg"
Note: value of install_dir in variable file
# Target location of the install, owned by `cd_user_name`
install_dir: '/opt/connectdirect'

# The node name of this box. This must be shared with the team.
node_name: CD.STK

# The user name running C:D. This must be shared with the team.
cd_user_name: abc

错误

TASK [connect-direct : Add netmap.cfg] ************************************************************************************************************
fatal: [10.245.124.252]: FAILED! => {"changed": false, "checksum": "e369f94df4be277b71a62946a899e0246362ea4c", "msg": "Destination directory /opt/connectdirect/ndm/cfg/CD.STK does not exist"}

我做了什么来验证

我 sshed 进入 EC2 实例并转到/opt/connectdirect/ndm/cfg/路径,发现它CD.STK不存在,因此错误在那里。

我不确定

由于我从未安装过用于文件传输的 connect_direct 软件实用程序,因此我不确定是否应该在安装过程中创建CD.STK (value of node_name variable)目录。/opt/connectdirect/ndm/cfg/当我检查代码时,我看到它有以下部分{{ node_name }}在安装任务期间被传递

- name: Run the Connect:Direct installer
  expect:
    echo: yes
    chdir: "{{ install_work_dir }}"
    command: "./cdinstall"
    timeout: 300
    responses:
      #there's other responses before/after below-mentioned responses here which I've not posted 
      # here to keep the post as small as possible. Fyi, Installation task ran successfully.
      
      # Choose node name
      (.*)Please enter name of Connect:Direct node you want to customize(.*): "{{ node_name }}"
      # Configure server network settings
      (.*)Enter TCP\/IP port to listen for a remote connection request:\[1234\](.*): "\n"
      (.*)Enter TCP\/IP hostname to listen for a remote connection request:\[0.0.0.0\](.*): "\n"
      (.*)Enter TCP\/IP port to listen for a Client connection request:\[1233\](.*): "\n"
      (.*)Enter TCP\/IP hostname to listen for a Client connection request:\[.+\](.*): "localhost\n"

你能建议我做什么吗?

我应该/opt/connectdirect/ndm/cfg/CD.STK使用单独的任务创建然后*.cfg在其中传输文件吗?我在这里询问是否可以使用单独的任务创建目录。由于我不确定但猜测应该在安装过程中创建了这个目录(或路径),所以我在这里要求查看它正在运行的创建任务CD.STK不会破坏任何功能,因为其他一些团队将使用此信息(username/node name)来传输数据.

标签: ansiblefile-transferconnect-direct

解决方案


推荐阅读