Worked perfectly! I appreciate your help and timely response! Thanks, Harry
On Tuesday, October 5, 2021 at 12:05:47 PM UTC-4 [email protected] wrote: > On 05/10/2021 18:53, [email protected] wrote: > > I have a fact that I'm printing out currently for debug purposes. It's > a list of user home folders. I'm trying to exclude certain folders, but > not matter what I try, the folders I want to exclude are displayed. Here's > what I'm trying: > > > > - name: Set User Home Directory fact > > set_fact: > > user_list: "{{ user_find.json.result | > json_query('result[].homedirectory[]') }}" > > > > - name: Print output > > debug: > > msg: "{{ item }}" > > with_items: "{{ user_list }}" > > when: (user_list != "/home/admin") or (user_list != > "/home/jdxadmin") or (user_list != "/home/test2") > > > > I've tried using "and" and "or" and they both print everything, > including the items I'm trying to exclude. Any ideas on where I'm going > wrong? > > 1. you compare apples (list) with pears (strings) > 2. "and" would be correct if you compare with the list element: (item != > "/home/admin") and (item != "/home/jdxadmin") and (item != "/home/test2") > 3. readable version: item not in ["/home/admin", "/home/jdxadmin", > "/home/test2"] > > Note: the condition is checked for *every* loop element. > > Regards > Racke > > > > > > Thanks, > > Harry > > > > -- > > 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 [email protected] <mailto: > [email protected]>. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/1581ab38-6f75-4629-875b-aacb81442fban%40googlegroups.com > > < > https://groups.google.com/d/msgid/ansible-project/1581ab38-6f75-4629-875b-aacb81442fban%40googlegroups.com?utm_medium=email&utm_source=footer > >. > > > -- > Ecommerce and Linux consulting + Perl and web application programming. > Debian and Sympa administration. > > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/021955a6-0eea-440f-9b02-71e8bb8a7c9dn%40googlegroups.com.
