【问题标题】:Ansible : unsupported parameter for module: path"Ansible:模块不支持的参数:路径”
【发布时间】:2020-03-19 09:17:14
【问题描述】:

我是 Ansible 的新手,目前正在编写使用 Ansiblepath module 替换给定单词的小剧本文本文件。

剧本:test.yml

-  name: Update the provided system to the next version
   hosts: localhost
   run_once: true
   vars:
    prev_version: "{{ PREVIOUS_VERSION }}"
    next_version: "{{ NEXT_VERSION }}"
   tasks:      

   - name: Update the software version
     replace:
       path: /home/hamza/TrainingWorkspace/Ansible/application_config.txt
       regexp: prev_version|string
       replace: next_version|string

文本文件:application_config.txt

version_info: "2020.2.2"

资源目录如下:

hamza@hamza-XX:~/TrainingWorkspace/Ansible$ ls
application_config.txt  test.yml


hamza@hamza-XX:~/TrainingWorkspace/Ansible$ pwd
/home/hamza/TrainingWorkspace/Ansible

如果我运行剧本:

ansible-playbook --connection=local --inventory 127.0.0.11, test.yml --extra-vars ' {"PREVIOUS_VERSION":"2020.2.2", "NEXT_VERSION": "2020.99.99"}'

我会收到以下错误:

    PLAY [Update the provided system to the next version] **************************

TASK [setup] *******************************************************************
ok: [localhost]

TASK [Update the software version] *********************************************
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "unsupported parameter for module: path"}

PLAY RECAP *********************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=1   

注意:ansible-playbook 2.0.0.2

任何帮助将不胜感激?

【问题讨论】:

    标签: ansible


    【解决方案1】:

    replace module's doc 中所述:

    在 Ansible 2.3 之前,此选项只能用作 dest、destfile 和 name。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-03-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-16
      • 1970-01-01
      相关资源
      最近更新 更多