*I changed the variable name from 404_error_page to error_404_page which 
starts with letter. But it cannot resolve the issue.*

*I wrote:*
with_items:
- error_404_page

*The error still occur. *
failed: [192.168.126.143] => (item=error_404_page) => {"failed": true, 
"item": "error_404_page"}
msg: could not find 
src=/home/dev/playbooks/harden/repositories/custom_error_pages/error_404_page

*We can see that the system didn't take it as a variable.*

*If I write:*
with_items:
- {{ error_404_page }}

Syntax Error

On Friday, December 6, 2013 8:53:49 PM UTC+8, Michael DeHaan wrote:
>
> Hmm, it sounds like you want to use the names of the variables, and the 
> system is trying to evaluate them for you.
>
> You can solve this by renaming the variables.
>
>
> On Fri, Dec 6, 2013 at 2:21 AM, <[email protected] <javascript:>> wrote:
>
>> I tried, but it is failed.
>>
>> My task is:
>>   - name: Transfer custom error pages and restart httpd service
>>     action: copy src={{ local_custom_error_pages_loc }}/{{ item }} 
>> dest={{ custom_error_page_dir }}/{{ item }} owner=root group=root mode=0644
>>     with_items:
>>     - 404_error_page
>>     - 503_error_page
>>     - 403_error_page
>> Note: 404_error_page, 503_error_page and 403_error_page are variable 
>> names which are defined in vars.yml.
>> 404_error_page: 404_ErrorPage.html
>> 503_error_page: MaintenancePage.html
>> 403_error_page: 403_ErrorPage.html
>>
>>
>> The error message is:
>> failed: [192.168.126.143] => (item=404_error_page) => {"failed": true, 
>> "item": "404_error_page"}
>> msg: could not find 
>> src=/home/agilairedev/playbooks/jboss_deploy_harden/repositories/custom_error_pages/
>> *404_error_page*
>> failed: [192.168.126.143] => (item=503_error_page) => {"failed": true, 
>> "item": "503_error_page"}
>> msg: could not find 
>> src=/home/agilairedev/playbooks/jboss_deploy_harden/repositories/custom_error_pages/503_error_page
>> failed: [192.168.126.143] => (item=403_error_page) => {"failed": true, 
>> "item": "403_error_page"}
>> msg: could not find 
>> src=/home/agilairedev/playbooks/jboss_deploy_harden/repositories/custom_error_pages/403_error_page
>>
>> FATAL: all hosts have already failed -- aborting
>>
>> We can see, variable 404_error_page is not replaced with its value, 
>> 404_ErrorPage.html.
>> If I use $foo, it works well.
>>  
>>     with_items:
>>     - $404_error_page
>>     - $503_error_page
>>     - $403_error_page
>>
>>
>> On Thursday, December 5, 2013 9:18:26 PM UTC+8, Michael DeHaan wrote:
>>
>>> with_items:
>>>    - bar
>>>    - baz
>>>
>>> Is all you need now
>>>
>>> -- Michael
>>>
>>> On Dec 4, 2013, at 11:47 PM, "[email protected]" <[email protected]> 
>>> wrote:
>>>
>>> In ansible 1.0, I can use $foo in with_items. For example,
>>>    with_items:
>>>     - $404_error_page
>>>     - $503_error_page
>>>     - $403_error_page
>>> Ansible 1.0 works well. It can find the variable and replace the value.
>>>
>>> In Ansible 1.4, I try to use {{ foo }} or "{{ foo }}", but both are 
>>> wrong.
>>>
>>> Case1, Syntax Error.
>>>    with_items:
>>>     - {{ 404_error_page }}
>>>     - {{ 503_error_page }}
>>>     - {{ 403_error_page }}
>>>
>>> Case2, ansible would not find the variable.
>>>    with_items:
>>>     - "{{ 404_error_page }}"
>>>     - "{{ 503_error_page }}"
>>>     - "{{ 403_error_page }}"
>>>
>>> Who knows how to define with_items by variables in ansible 1.4?
>>>
>>> -- 
>>> 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].
>>>
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>  -- 
>> 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] <javascript:>.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>
>
> -- 
> Michael DeHaan <[email protected] <javascript:>>
> CTO, AnsibleWorks, Inc.
> http://www.ansibleworks.com/
>
>  

-- 
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].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to