Discussion:
[ansible-project] Re: Does the file module handle wildcards?
Craig Moynes
2015-07-29 19:00:05 UTC
Permalink
Could you use the find module to get the list of matching files? It is
only available in v2.0, I have previously used the command module to
execute a find on a remote system to get a list of files, then used the
file module to check the state.
Hi all,
Trying to write a task that ensures no files matching a wildcard are
present in a given directory (and if so, delete them.)
- name: Ensure that any default 'Wired connection' entry is deleted
file: path=/etc/NetworkManager/system-connections/Wired* state=absent
- name: Ensure that any default 'Wired connection' entry is deleted
file: path=/etc/NetworkManager/system-connections/{{ item }} state=
absent
with_fileglob: Wired*
The first does nothing (always reports 'ok'), but the second appears to
TASK: [laptop_netcfg | Ensure there is an NM connection entry for DHCP LAN
] ***
ok: [dhcp-client]
TASK: [laptop_netcfg | Ensure that any default 'Wired connection' entry is
deleted] ***
PLAY [next_play]
*****************************************************************
skipping: no hosts matched
Notice no task status code under the task... I take it "with_fileglob" is
deprecated or something? (picked it up off an old M.DeHaan post off this
mailing list...)
Anyways, how would I go about doing something like this?
Thanks,
Will
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/a487b511-9e70-4742-a4f2-3fd2a2a2922d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Willard Dennis
2015-07-30 01:13:23 UTC
Permalink
Thanks for the tip, but not running 2.0 yet... No way to do this on 1.9?
Post by Craig Moynes
Could you use the find module to get the list of matching files? It is
only available in v2.0, I have previously used the command module to
execute a find on a remote system to get a list of files, then used the
file module to check the state.
Hi all,
Trying to write a task that ensures no files matching a wildcard are
present in a given directory (and if so, delete them.)
- name: Ensure that any default 'Wired connection' entry is deleted
file: path=/etc/NetworkManager/system-connections/Wired* state=absent
- name: Ensure that any default 'Wired connection' entry is deleted
file: path=/etc/NetworkManager/system-connections/{{ item }} state=
absent
with_fileglob: Wired*
The first does nothing (always reports 'ok'), but the second appears to
TASK: [laptop_netcfg | Ensure there is an NM connection entry for DHCP
LAN] ***
ok: [dhcp-client]
TASK: [laptop_netcfg | Ensure that any default 'Wired connection' entry
is deleted] ***
PLAY [next_play]
*****************************************************************
skipping: no hosts matched
Notice no task status code under the task... I take it "with_fileglob" is
deprecated or something? (picked it up off an old M.DeHaan post off this
mailing list...)
Anyways, how would I go about doing something like this?
Thanks,
Will
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAFJCWMT28umDG1K8v3y3jindsnk%3DjEx_9q2guZC7WU-36nUYsQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Brian Coca
2015-07-30 01:17:36 UTC
Permalink
if no find module just use:
shell: find ...


On Wed, Jul 29, 2015 at 9:13 PM, Willard Dennis
Post by Willard Dennis
Thanks for the tip, but not running 2.0 yet... No way to do this on 1.9?
Post by Craig Moynes
Could you use the find module to get the list of matching files? It is
only available in v2.0, I have previously used the command module to execute
a find on a remote system to get a list of files, then used the file module
to check the state.
Hi all,
Trying to write a task that ensures no files matching a wildcard are
present in a given directory (and if so, delete them.)
- name: Ensure that any default 'Wired connection' entry is deleted
file: path=/etc/NetworkManager/system-connections/Wired* state=absent
- name: Ensure that any default 'Wired connection' entry is deleted
file: path=/etc/NetworkManager/system-connections/{{ item }}
state=absent
with_fileglob: Wired*
The first does nothing (always reports 'ok'), but the second appears to
TASK: [laptop_netcfg | Ensure there is an NM connection entry for DHCP
LAN] ***
ok: [dhcp-client]
TASK: [laptop_netcfg | Ensure that any default 'Wired connection' entry
is deleted] ***
PLAY [next_play]
*****************************************************************
skipping: no hosts matched
Notice no task status code under the task... I take it "with_fileglob" is
deprecated or something? (picked it up off an old M.DeHaan post off this
mailing list...)
Anyways, how would I go about doing something like this?
Thanks,
Will
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CAFJCWMT28umDG1K8v3y3jindsnk%3DjEx_9q2guZC7WU-36nUYsQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
Brian Coca
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAJ5XC8kdjXYF2vGxUz%2BEN-KCGPbV0wsHhsWUkpEJvepyYnbJhg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Craig Moynes
2015-07-30 11:05:46 UTC
Permalink
Sorry if I wasn't clear. I am running 1.9.2 and I use command module to
execute a find on a remote system to get a list of files, then used the
file module to check the state.

Is that clearer?
Post by Willard Dennis
Thanks for the tip, but not running 2.0 yet... No way to do this on 1.9?
Post by Craig Moynes
Could you use the find module to get the list of matching files? It is
only available in v2.0, I have previously used the command module to
execute a find on a remote system to get a list of files, then used the
file module to check the state.
Hi all,
Trying to write a task that ensures no files matching a wildcard are
present in a given directory (and if so, delete them.)
- name: Ensure that any default 'Wired connection' entry is deleted
file: path=/etc/NetworkManager/system-connections/Wired* state=absent
- name: Ensure that any default 'Wired connection' entry is deleted
file: path=/etc/NetworkManager/system-connections/{{ item }} state=
absent
with_fileglob: Wired*
The first does nothing (always reports 'ok'), but the second appears to
TASK: [laptop_netcfg | Ensure there is an NM connection entry for DHCP
LAN] ***
ok: [dhcp-client]
TASK: [laptop_netcfg | Ensure that any default 'Wired connection' entry
is deleted] ***
PLAY [next_play]
*****************************************************************
skipping: no hosts matched
Notice no task status code under the task... I take it "with_fileglob"
is deprecated or something? (picked it up off an old M.DeHaan post off this
mailing list...)
Anyways, how would I go about doing something like this?
Thanks,
Will
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CACFyRmmdKz7WewOc_TT7DcrXdYQ23%2BGUTb8-RvUU%2B%3DkfN00S-Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Loading...