I apologize.  I forgot to provide the following.

ansible version:  2.0.2.0

event:
skipping: [server1] => (item={u'host_aliases': u'ca-srv-01.example.com 
<http://www.google.com/url?q=http%3A%2F%2Fca-srv-01.example.com&sa=D&sntz=1&usg=AFQjCNFDFlNv7ljk8P-xrOYpfaOZ-Ztwfg>
 ca-srv-01', 
u'ip_addr': u'10.1.1.1', u'srv_loc': u'ca'})  => {"changed": false, "item": 
{"host_aliases": "a-srv-01.example.com 
<http://www.google.com/url?q=http%3A%2F%2Fca-srv-01.example.com&sa=D&sntz=1&usg=AFQjCNFDFlNv7ljk8P-xrOYpfaOZ-Ztwfg>
 ca-srv-01", 
"ip_addr": "10.1.1.1", "srv_loc": "ca"}, "skip_reason": "Conditional check 
failed", "skipped": true}

Regards,
j



On Monday, June 13, 2016 at 10:50:10 AM UTC-7, Jerome Yanga wrote:
>
> Here is what I have.
>
> vars/main.yml
> host_entries:
>  - { srv_loc:  'ca', ip_addr:  '10.1.1.1', host_aliases:  '
> ca-srv-01.example.com 
> <http://www.google.com/url?q=http%3A%2F%2Fca-srv-01.example.com&sa=D&sntz=1&usg=AFQjCNFDFlNv7ljk8P-xrOYpfaOZ-Ztwfg>
>  
> ca-srv-01' }
>  - { srv_loc:  'ny', ip_addr:  '10.2.1.1', host_aliases:  '
> ny-srv-01.example.com ny-srv-01' }
>  - { srv_loc:  'co', ip_addr:  '10.3.1.1', host_aliases:  '
> co-srv-01.example.com co-srv-01' }
>
> tasks/main.yml
> ---
>
>  - name: checking location of server
>    raw:  'echo "{{ ansible_hostname }}" | cut -f1 -d"-"'
>    register: actual_loc
>
>  - name: adding entries in the hosts file
>    lineinfile:
>       backup:  yes
>       create:  yes
>       dest:  /etc/hosts
>       group:  root
>       line:  "{{item.ip_addr}}     {{item.host_aliases}}"
>       mode:  0644
>       owner:  root
>       state:  present
>    when:  ( actual_loc.stdout_lines == item.srv_loc )
>    with_items:  "{{ hosts_entries }}"
>
> I am trying to add the correct hosts entries based on the substring of a 
> hostname.  All items are being skipped at the moment due to '"skip_reason": 
> "Conditional check failed", "skipped": true'.  
>
> Please help.  :)
>
> Regards,
> j
>

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b3078eed-74a6-4c1d-9ecd-306cd920d1b7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to