Using Ansible, how can I take actions on each file in a specific location?How can I implement ansible with...

What happened to Hermione’s clothing and other possessions after she wiped her parents’ memories of her?

How do I fight with Heavy Armor as a Wizard with Tenser's Transformation?

Running away from a conflict

Using Ansible, how can I take actions on each file in a specific location?

How to write Muḥammad ibn Mūsā al-Khwārizmī?

How to wrap a figure in exam document?

How do I avoid the "chosen hero" feeling?

Was there a pre-determined arrangment for division of Germany in case it surrendered before any Soviet forces entered its territory?

What is an explicit bijection in combinatorics?

Is practicing on a digital piano harmful to an experienced piano player?

What's the reason that we have different quantities of days each month?

Tikz: Perpendicular FROM a line

Was Opportunity's last message to Earth "My battery is low and it's getting dark"?

How can I give a Ranger advantage on a check due to Favored Enemy without spoiling the story for the player?

How does a mid-19 century military combat a modernized one?

Linearity Assumption

Renting a 2CV in France

Minimum Viable Product for RTS game?

Probability X1 ≥ X2

Would water spill from a bowl in a Bag of Holding?

Why is Shelob considered evil?

Taking an academic pseudonym?

Quick Way to Extrude Line to Make Ledges?

Dealing with an internal ScriptKiddie



Using Ansible, how can I take actions on each file in a specific location?


How can I implement ansible with per-host passwords, securely?How to manage hosts with multiple sites using Ansible?How to notify a remote service using Ansible?ansible: using host_vars in template filehow can i terminate ec2 instances using ansible dynamic inventory?Creating an instance service file using an ansible templateHow can I log inventory_hostname to a file on the remote using a Playbook?Ansible | Access multi dimensional variable for when conditional in nested loop taskHow to copy a 1 GB file using ansible to remote machine as different remote user and passwordHow can I abstract away Ansible roles?













1















I'm building playbooks to deploy a Windows application that requires some prerequisites (Visual C++ runtimes and dotNet framework) to be installed before the application itself.
These prerequisites are .EXE files and are all contained in a specific folder.



I want to build an Ansible playbook that would (amongst other things) execute each of the .EXE files in the preriquisites folder with the parameters "/install /passive"



I don't want to have to specify each filename in my playbook.



My idea was to first find the prerequisites setup files using the "win_file" module, assign the result to a variable and them iterate over the variable and run the "win_command" module for each file it contains.



Unfortunately, I cannot assign the win_find result to a variable using the register statement, it simply doesn't do anything.



Here is what I tried:



- hosts: "{{ target }}"

tasks:

- name: Find files in path
win_find:
register: myvar
paths: E:TempPrognosis_11.2Prerequisites

- name: debug
debug:
msg: "{{ myvar }}"


And the playbook's output when ran with -v (verbose mode):




TASK [Find files in path] **********************************************************************************************************************************************************



ok: [SMN001] => {"changed": false, "examined": 5, "files": [{"attributes": "Archive", "checksum": "3049a85843eaf65e89e2336d5fe6e85e416797be", "creationtime": 1550942958.6690862, "extension": ".exe", "filename": "NDP46-KB3045557-x86-x64-AllOS-ENU.exe", "isarchive": true, "isdir": false, "ishidden": false, "islnk": false, "isreadonly": false, "isshared": false, "lastaccesstime": 1550942958.6690862, "lastwritetime": 1459427148, "owner": "BUILTINAdministrators", "path": "E:TempPrognosis_11.2PrerequisitesNDP46-KB3045557-x86-x64-AllOS-ENU.exe", "size": 65444688}, {"attributes": "Archive", "checksum": "8bf41ba9eef02d30635a10433817dbb6886da5a2", "creationtime": 1550942958.7627323, "extension": ".exe", "filename": "vcredist2013_x64.exe", "isarchive": true, "isdir": false, "ishidden": false, "islnk": false, "isreadonly": false, "isshared": false, "lastaccesstime": 1550942958.7627323, "lastwritetime": 1489501866, "owner": "BUILTINAdministrators", "path": "E:TempPrognosis_11.2Prerequisitesvcredist2013_x64.exe", "size": 7194312}, {"attributes": "Archive", "checksum": "df7f0a73bfa077e483e51bfb97f5e2eceedfb6a3", "creationtime": 1550942958.7779777, "extension": ".exe", "filename": "vcredist2013_x86.exe", "isarchive": true, "isdir": false, "ishidden": false, "islnk": false, "isreadonly": false, "isshared": false, "lastaccesstime": 1550942958.7779777, "lastwritetime": 1489501866, "owner": "BUILTINAdministrators", "path": "E:TempPrognosis_11.2Prerequisitesvcredist2013_x86.exe", "size": 6503984}, {"attributes": "Archive", "checksum": "007064d974a55940838f19cd0b0e3aaf27ca06a7", "creationtime": 1550942958.7939014, "extension": ".exe", "filename": "vcredist2017_x64.exe", "isarchive": true, "isdir": false, "ishidden": false, "islnk": false, "isreadonly": false, "isshared": false, "lastaccesstime": 1550942958.7939014, "lastwritetime": 1488965662, "owner": "BUILTINAdministrators", "path": "E:TempPrognosis_11.2Prerequisitesvcredist2017_x64.exe", "size": 15261400}, {"attributes": "Archive", "checksum": "ba1f7e7cace62f7c55ab948cd3b29acc4e8e2329", "creationtime": 1550942958.8406758, "extension": ".exe", "filename": "vcredist2017_x86.exe", "isarchive": true, "isdir": false, "ishidden": false, "islnk": false, "isreadonly": false, "isshared": false, "lastaccesstime": 1550942958.8406758, "lastwritetime": 1488965662, "owner": "BUILTINAdministrators", "path": "E:TempPrognosis_11.2Prerequisitesvcredist2017_x86.exe", "size": 14401656}], "matched": 5}



TASK [debug] ***********************************************************************************************************************************************************************



fatal: [SMN001]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'myvar' is undefinednnThe error appears to have been in '/etc/ansible/playbooks/test_find_files.yaml': line 18, column 5, but maynbe elsewhere in the file depending on the exact syntax problem.nnThe offending line appears to be:nnn - name: debugn ^ heren"}




As you can see, the files are properly found, but the "myvar" variable doesn't exist even though it should have been assigned.



According to this page, this logic does seem to work on Linux hosts: http://www.mydailytutorials.com/using-ansible-find-module-search-filesfolder/ (ref "Storing the file names in a register" at the bottom of the page).



Could it be an issue with the win_find module itself?
Any thoughts?



Thanks!










share|improve this question







New contributor




GuillaumeN is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • I forgot to mention I'm using Ansible 2.7.7

    – GuillaumeN
    3 hours ago
















1















I'm building playbooks to deploy a Windows application that requires some prerequisites (Visual C++ runtimes and dotNet framework) to be installed before the application itself.
These prerequisites are .EXE files and are all contained in a specific folder.



I want to build an Ansible playbook that would (amongst other things) execute each of the .EXE files in the preriquisites folder with the parameters "/install /passive"



I don't want to have to specify each filename in my playbook.



My idea was to first find the prerequisites setup files using the "win_file" module, assign the result to a variable and them iterate over the variable and run the "win_command" module for each file it contains.



Unfortunately, I cannot assign the win_find result to a variable using the register statement, it simply doesn't do anything.



Here is what I tried:



- hosts: "{{ target }}"

tasks:

- name: Find files in path
win_find:
register: myvar
paths: E:TempPrognosis_11.2Prerequisites

- name: debug
debug:
msg: "{{ myvar }}"


And the playbook's output when ran with -v (verbose mode):




TASK [Find files in path] **********************************************************************************************************************************************************



ok: [SMN001] => {"changed": false, "examined": 5, "files": [{"attributes": "Archive", "checksum": "3049a85843eaf65e89e2336d5fe6e85e416797be", "creationtime": 1550942958.6690862, "extension": ".exe", "filename": "NDP46-KB3045557-x86-x64-AllOS-ENU.exe", "isarchive": true, "isdir": false, "ishidden": false, "islnk": false, "isreadonly": false, "isshared": false, "lastaccesstime": 1550942958.6690862, "lastwritetime": 1459427148, "owner": "BUILTINAdministrators", "path": "E:TempPrognosis_11.2PrerequisitesNDP46-KB3045557-x86-x64-AllOS-ENU.exe", "size": 65444688}, {"attributes": "Archive", "checksum": "8bf41ba9eef02d30635a10433817dbb6886da5a2", "creationtime": 1550942958.7627323, "extension": ".exe", "filename": "vcredist2013_x64.exe", "isarchive": true, "isdir": false, "ishidden": false, "islnk": false, "isreadonly": false, "isshared": false, "lastaccesstime": 1550942958.7627323, "lastwritetime": 1489501866, "owner": "BUILTINAdministrators", "path": "E:TempPrognosis_11.2Prerequisitesvcredist2013_x64.exe", "size": 7194312}, {"attributes": "Archive", "checksum": "df7f0a73bfa077e483e51bfb97f5e2eceedfb6a3", "creationtime": 1550942958.7779777, "extension": ".exe", "filename": "vcredist2013_x86.exe", "isarchive": true, "isdir": false, "ishidden": false, "islnk": false, "isreadonly": false, "isshared": false, "lastaccesstime": 1550942958.7779777, "lastwritetime": 1489501866, "owner": "BUILTINAdministrators", "path": "E:TempPrognosis_11.2Prerequisitesvcredist2013_x86.exe", "size": 6503984}, {"attributes": "Archive", "checksum": "007064d974a55940838f19cd0b0e3aaf27ca06a7", "creationtime": 1550942958.7939014, "extension": ".exe", "filename": "vcredist2017_x64.exe", "isarchive": true, "isdir": false, "ishidden": false, "islnk": false, "isreadonly": false, "isshared": false, "lastaccesstime": 1550942958.7939014, "lastwritetime": 1488965662, "owner": "BUILTINAdministrators", "path": "E:TempPrognosis_11.2Prerequisitesvcredist2017_x64.exe", "size": 15261400}, {"attributes": "Archive", "checksum": "ba1f7e7cace62f7c55ab948cd3b29acc4e8e2329", "creationtime": 1550942958.8406758, "extension": ".exe", "filename": "vcredist2017_x86.exe", "isarchive": true, "isdir": false, "ishidden": false, "islnk": false, "isreadonly": false, "isshared": false, "lastaccesstime": 1550942958.8406758, "lastwritetime": 1488965662, "owner": "BUILTINAdministrators", "path": "E:TempPrognosis_11.2Prerequisitesvcredist2017_x86.exe", "size": 14401656}], "matched": 5}



TASK [debug] ***********************************************************************************************************************************************************************



fatal: [SMN001]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'myvar' is undefinednnThe error appears to have been in '/etc/ansible/playbooks/test_find_files.yaml': line 18, column 5, but maynbe elsewhere in the file depending on the exact syntax problem.nnThe offending line appears to be:nnn - name: debugn ^ heren"}




As you can see, the files are properly found, but the "myvar" variable doesn't exist even though it should have been assigned.



According to this page, this logic does seem to work on Linux hosts: http://www.mydailytutorials.com/using-ansible-find-module-search-filesfolder/ (ref "Storing the file names in a register" at the bottom of the page).



Could it be an issue with the win_find module itself?
Any thoughts?



Thanks!










share|improve this question







New contributor




GuillaumeN is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • I forgot to mention I'm using Ansible 2.7.7

    – GuillaumeN
    3 hours ago














1












1








1








I'm building playbooks to deploy a Windows application that requires some prerequisites (Visual C++ runtimes and dotNet framework) to be installed before the application itself.
These prerequisites are .EXE files and are all contained in a specific folder.



I want to build an Ansible playbook that would (amongst other things) execute each of the .EXE files in the preriquisites folder with the parameters "/install /passive"



I don't want to have to specify each filename in my playbook.



My idea was to first find the prerequisites setup files using the "win_file" module, assign the result to a variable and them iterate over the variable and run the "win_command" module for each file it contains.



Unfortunately, I cannot assign the win_find result to a variable using the register statement, it simply doesn't do anything.



Here is what I tried:



- hosts: "{{ target }}"

tasks:

- name: Find files in path
win_find:
register: myvar
paths: E:TempPrognosis_11.2Prerequisites

- name: debug
debug:
msg: "{{ myvar }}"


And the playbook's output when ran with -v (verbose mode):




TASK [Find files in path] **********************************************************************************************************************************************************



ok: [SMN001] => {"changed": false, "examined": 5, "files": [{"attributes": "Archive", "checksum": "3049a85843eaf65e89e2336d5fe6e85e416797be", "creationtime": 1550942958.6690862, "extension": ".exe", "filename": "NDP46-KB3045557-x86-x64-AllOS-ENU.exe", "isarchive": true, "isdir": false, "ishidden": false, "islnk": false, "isreadonly": false, "isshared": false, "lastaccesstime": 1550942958.6690862, "lastwritetime": 1459427148, "owner": "BUILTINAdministrators", "path": "E:TempPrognosis_11.2PrerequisitesNDP46-KB3045557-x86-x64-AllOS-ENU.exe", "size": 65444688}, {"attributes": "Archive", "checksum": "8bf41ba9eef02d30635a10433817dbb6886da5a2", "creationtime": 1550942958.7627323, "extension": ".exe", "filename": "vcredist2013_x64.exe", "isarchive": true, "isdir": false, "ishidden": false, "islnk": false, "isreadonly": false, "isshared": false, "lastaccesstime": 1550942958.7627323, "lastwritetime": 1489501866, "owner": "BUILTINAdministrators", "path": "E:TempPrognosis_11.2Prerequisitesvcredist2013_x64.exe", "size": 7194312}, {"attributes": "Archive", "checksum": "df7f0a73bfa077e483e51bfb97f5e2eceedfb6a3", "creationtime": 1550942958.7779777, "extension": ".exe", "filename": "vcredist2013_x86.exe", "isarchive": true, "isdir": false, "ishidden": false, "islnk": false, "isreadonly": false, "isshared": false, "lastaccesstime": 1550942958.7779777, "lastwritetime": 1489501866, "owner": "BUILTINAdministrators", "path": "E:TempPrognosis_11.2Prerequisitesvcredist2013_x86.exe", "size": 6503984}, {"attributes": "Archive", "checksum": "007064d974a55940838f19cd0b0e3aaf27ca06a7", "creationtime": 1550942958.7939014, "extension": ".exe", "filename": "vcredist2017_x64.exe", "isarchive": true, "isdir": false, "ishidden": false, "islnk": false, "isreadonly": false, "isshared": false, "lastaccesstime": 1550942958.7939014, "lastwritetime": 1488965662, "owner": "BUILTINAdministrators", "path": "E:TempPrognosis_11.2Prerequisitesvcredist2017_x64.exe", "size": 15261400}, {"attributes": "Archive", "checksum": "ba1f7e7cace62f7c55ab948cd3b29acc4e8e2329", "creationtime": 1550942958.8406758, "extension": ".exe", "filename": "vcredist2017_x86.exe", "isarchive": true, "isdir": false, "ishidden": false, "islnk": false, "isreadonly": false, "isshared": false, "lastaccesstime": 1550942958.8406758, "lastwritetime": 1488965662, "owner": "BUILTINAdministrators", "path": "E:TempPrognosis_11.2Prerequisitesvcredist2017_x86.exe", "size": 14401656}], "matched": 5}



TASK [debug] ***********************************************************************************************************************************************************************



fatal: [SMN001]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'myvar' is undefinednnThe error appears to have been in '/etc/ansible/playbooks/test_find_files.yaml': line 18, column 5, but maynbe elsewhere in the file depending on the exact syntax problem.nnThe offending line appears to be:nnn - name: debugn ^ heren"}




As you can see, the files are properly found, but the "myvar" variable doesn't exist even though it should have been assigned.



According to this page, this logic does seem to work on Linux hosts: http://www.mydailytutorials.com/using-ansible-find-module-search-filesfolder/ (ref "Storing the file names in a register" at the bottom of the page).



Could it be an issue with the win_find module itself?
Any thoughts?



Thanks!










share|improve this question







New contributor




GuillaumeN is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I'm building playbooks to deploy a Windows application that requires some prerequisites (Visual C++ runtimes and dotNet framework) to be installed before the application itself.
These prerequisites are .EXE files and are all contained in a specific folder.



I want to build an Ansible playbook that would (amongst other things) execute each of the .EXE files in the preriquisites folder with the parameters "/install /passive"



I don't want to have to specify each filename in my playbook.



My idea was to first find the prerequisites setup files using the "win_file" module, assign the result to a variable and them iterate over the variable and run the "win_command" module for each file it contains.



Unfortunately, I cannot assign the win_find result to a variable using the register statement, it simply doesn't do anything.



Here is what I tried:



- hosts: "{{ target }}"

tasks:

- name: Find files in path
win_find:
register: myvar
paths: E:TempPrognosis_11.2Prerequisites

- name: debug
debug:
msg: "{{ myvar }}"


And the playbook's output when ran with -v (verbose mode):




TASK [Find files in path] **********************************************************************************************************************************************************



ok: [SMN001] => {"changed": false, "examined": 5, "files": [{"attributes": "Archive", "checksum": "3049a85843eaf65e89e2336d5fe6e85e416797be", "creationtime": 1550942958.6690862, "extension": ".exe", "filename": "NDP46-KB3045557-x86-x64-AllOS-ENU.exe", "isarchive": true, "isdir": false, "ishidden": false, "islnk": false, "isreadonly": false, "isshared": false, "lastaccesstime": 1550942958.6690862, "lastwritetime": 1459427148, "owner": "BUILTINAdministrators", "path": "E:TempPrognosis_11.2PrerequisitesNDP46-KB3045557-x86-x64-AllOS-ENU.exe", "size": 65444688}, {"attributes": "Archive", "checksum": "8bf41ba9eef02d30635a10433817dbb6886da5a2", "creationtime": 1550942958.7627323, "extension": ".exe", "filename": "vcredist2013_x64.exe", "isarchive": true, "isdir": false, "ishidden": false, "islnk": false, "isreadonly": false, "isshared": false, "lastaccesstime": 1550942958.7627323, "lastwritetime": 1489501866, "owner": "BUILTINAdministrators", "path": "E:TempPrognosis_11.2Prerequisitesvcredist2013_x64.exe", "size": 7194312}, {"attributes": "Archive", "checksum": "df7f0a73bfa077e483e51bfb97f5e2eceedfb6a3", "creationtime": 1550942958.7779777, "extension": ".exe", "filename": "vcredist2013_x86.exe", "isarchive": true, "isdir": false, "ishidden": false, "islnk": false, "isreadonly": false, "isshared": false, "lastaccesstime": 1550942958.7779777, "lastwritetime": 1489501866, "owner": "BUILTINAdministrators", "path": "E:TempPrognosis_11.2Prerequisitesvcredist2013_x86.exe", "size": 6503984}, {"attributes": "Archive", "checksum": "007064d974a55940838f19cd0b0e3aaf27ca06a7", "creationtime": 1550942958.7939014, "extension": ".exe", "filename": "vcredist2017_x64.exe", "isarchive": true, "isdir": false, "ishidden": false, "islnk": false, "isreadonly": false, "isshared": false, "lastaccesstime": 1550942958.7939014, "lastwritetime": 1488965662, "owner": "BUILTINAdministrators", "path": "E:TempPrognosis_11.2Prerequisitesvcredist2017_x64.exe", "size": 15261400}, {"attributes": "Archive", "checksum": "ba1f7e7cace62f7c55ab948cd3b29acc4e8e2329", "creationtime": 1550942958.8406758, "extension": ".exe", "filename": "vcredist2017_x86.exe", "isarchive": true, "isdir": false, "ishidden": false, "islnk": false, "isreadonly": false, "isshared": false, "lastaccesstime": 1550942958.8406758, "lastwritetime": 1488965662, "owner": "BUILTINAdministrators", "path": "E:TempPrognosis_11.2Prerequisitesvcredist2017_x86.exe", "size": 14401656}], "matched": 5}



TASK [debug] ***********************************************************************************************************************************************************************



fatal: [SMN001]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'myvar' is undefinednnThe error appears to have been in '/etc/ansible/playbooks/test_find_files.yaml': line 18, column 5, but maynbe elsewhere in the file depending on the exact syntax problem.nnThe offending line appears to be:nnn - name: debugn ^ heren"}




As you can see, the files are properly found, but the "myvar" variable doesn't exist even though it should have been assigned.



According to this page, this logic does seem to work on Linux hosts: http://www.mydailytutorials.com/using-ansible-find-module-search-filesfolder/ (ref "Storing the file names in a register" at the bottom of the page).



Could it be an issue with the win_find module itself?
Any thoughts?



Thanks!







windows ansible ansible-playbook






share|improve this question







New contributor




GuillaumeN is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




GuillaumeN is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




GuillaumeN is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 3 hours ago









GuillaumeNGuillaumeN

84




84




New contributor




GuillaumeN is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





GuillaumeN is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






GuillaumeN is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.













  • I forgot to mention I'm using Ansible 2.7.7

    – GuillaumeN
    3 hours ago



















  • I forgot to mention I'm using Ansible 2.7.7

    – GuillaumeN
    3 hours ago

















I forgot to mention I'm using Ansible 2.7.7

– GuillaumeN
3 hours ago





I forgot to mention I'm using Ansible 2.7.7

– GuillaumeN
3 hours ago










1 Answer
1






active

oldest

votes


















3














It's just a typo, your register: is too far indented.



It should appear as:



  - name: Find files in path
win_find:
paths: E:TempPrognosis_11.2Prerequisites
register: myvar





share|improve this answer
























  • Argh, I just saw that too, gave it a try and it worked like a charm! Thank you @MichaelHampton :)

    – GuillaumeN
    3 hours ago













Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "2"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






GuillaumeN is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f955466%2fusing-ansible-how-can-i-take-actions-on-each-file-in-a-specific-location%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









3














It's just a typo, your register: is too far indented.



It should appear as:



  - name: Find files in path
win_find:
paths: E:TempPrognosis_11.2Prerequisites
register: myvar





share|improve this answer
























  • Argh, I just saw that too, gave it a try and it worked like a charm! Thank you @MichaelHampton :)

    – GuillaumeN
    3 hours ago


















3














It's just a typo, your register: is too far indented.



It should appear as:



  - name: Find files in path
win_find:
paths: E:TempPrognosis_11.2Prerequisites
register: myvar





share|improve this answer
























  • Argh, I just saw that too, gave it a try and it worked like a charm! Thank you @MichaelHampton :)

    – GuillaumeN
    3 hours ago
















3












3








3







It's just a typo, your register: is too far indented.



It should appear as:



  - name: Find files in path
win_find:
paths: E:TempPrognosis_11.2Prerequisites
register: myvar





share|improve this answer













It's just a typo, your register: is too far indented.



It should appear as:



  - name: Find files in path
win_find:
paths: E:TempPrognosis_11.2Prerequisites
register: myvar






share|improve this answer












share|improve this answer



share|improve this answer










answered 3 hours ago









Michael HamptonMichael Hampton

170k27309633




170k27309633













  • Argh, I just saw that too, gave it a try and it worked like a charm! Thank you @MichaelHampton :)

    – GuillaumeN
    3 hours ago





















  • Argh, I just saw that too, gave it a try and it worked like a charm! Thank you @MichaelHampton :)

    – GuillaumeN
    3 hours ago



















Argh, I just saw that too, gave it a try and it worked like a charm! Thank you @MichaelHampton :)

– GuillaumeN
3 hours ago







Argh, I just saw that too, gave it a try and it worked like a charm! Thank you @MichaelHampton :)

– GuillaumeN
3 hours ago












GuillaumeN is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















GuillaumeN is a new contributor. Be nice, and check out our Code of Conduct.













GuillaumeN is a new contributor. Be nice, and check out our Code of Conduct.












GuillaumeN is a new contributor. Be nice, and check out our Code of Conduct.
















Thanks for contributing an answer to Server Fault!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f955466%2fusing-ansible-how-can-i-take-actions-on-each-file-in-a-specific-location%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Щит и меч (фильм) Содержание Названия серий | Сюжет |...

Венесуэла на летних Олимпийских играх 2000 Содержание Состав...

Meter-Bus Содержание Параметры шины | Стандартизация |...