Ian Smith
Ian Smith

Reputation: 53

Ansible Ad-Hoc find file with pattern

I'm trying to run an adhoc find command in ansible to look for myFile.txt but it's giving me an unknown hosts error. What am I doing wrong?

ansible all -m file -a patterns="myFile.txt" paths="/home/user/Documents"

Upvotes: 1

Views: 977

Answers (1)

Ian Smith
Ian Smith

Reputation: 53

Combine all arguments into one parameter. Note the single quotes. If you use double quotes, you must escape them

ansible all -m find -a "patterns='myFile.txt' paths='/home/user/Documents'"

or

ansible all -m find -a "patterns=\"myFile.txt\" paths=\"/home/user/Documents\"

Upvotes: 2

Related Questions