Friday, September 30, 2016

Ansible Move File/Folder in Idempotent Manner

Solution is to use conditionals:

       - name: stat the dest path
         stat: path=/path/dest
         register: statdest
       - name: move file
         command: mv /path/src /path/dest
         when: statdest.stat.exists == false

Reference: http://stackoverflow.com/a/24165405/548272

No comments:

Post a Comment