senjoux
senjoux

Reputation: 314

Ansible : unsupported parameter for module: path"

I am new to Ansible and am currently working on little playbook which uses Ansible's path module to replace a word in a given text file.

Playbook : 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

Text file : application_config.txt

version_info: "2020.2.2"

The resources directory is as follows :

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


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

If I run the playbook :

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

I would get the following error :

    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   

NOTE : ansible-playbook 2.0.0.2

any help would be appreciated ?

Upvotes: 0

Views: 3807

Answers (1)

rolf82
rolf82

Reputation: 1581

As stated in the replace module's doc :

Before Ansible 2.3 this option was only usable as dest, destfile and name.

Upvotes: 1

Related Questions