Surprisingly simple and powerful.
It works like a charm. Thanks Michael and everyone.

On Wednesday, October 9, 2013 at 8:07:58 AM UTC-7, Michael DeHaan wrote:
>
> Yep, as this says, this is a YAML syntax error.
>
> Since you started the line with a quote, YAML was expecting the whole line 
> to be quoted.
>
> This can be fixed by changing
>
>   when: 'dbslave' in group_names
>
> To:
>
>   when: "'dbslave' in group_names"
>
>
>
>
> On Wed, Oct 9, 2013 at 11:02 AM, Marcin Prączko <[email protected] 
> <javascript:>> wrote:
>
>> Hi,
>>
>> Are you sure that this is working - just tested on ansible 1.3 and I have 
>> error:
>>
>> ERROR: Syntax Error while loading YAML script, 
>> /src/ansible/roles/mysql-munin/tasks/main.yml
>> Note: The error may actually appear before this position: line 34, column 
>> 27
>>
>>     - mysql_seconds_behind_master
>>   when: 'dbslave' in group_names
>>                   ^
>>
>> I created special role: mysql-munin
>> There are 3 tasks which should be run - 2 of them on DB master - 1 on DB 
>> slave. 
>> But so far I am struggeling to run task only on server which belongs to 
>> specific group. 
>>
>> Tasks list:
>>   play #3 (Database | Configurtion for database servers):
>>     MySQL-munin | Create Munin configuration - Template    # Should run 
>> on DB servers
>>     MySQL-munin | Link Official munin plugins    # Should run on DB 
>> servers
>>     MySQL-munin | Link Custom munin plugins  # Should run ONLY on Slave 
>> DB server
>>
>> Task: #3
>> - name: MySQL-munin | Link Custom munin plugins
>>   file: src=/opt/munin/lib/plugins/{{ item }}
>>         dest=/etc/munin/plugins/{{ item }}
>>         state=link
>>   with_items:
>>     - mysql_seconds_behind_master
>>   notify:
>>     - restart munin-node
>>   tags:
>>     - munin_conf_plugin_mysql
>> # Adding this line 
>>   when: 'dbslave' in group_names
>> - breaks formating for yaml
>> - Displaying error which I've described above.
>>
>> Best regards,
>> Marcin Praczko
>>
>>
>>
>>
>>
>>
>> On Thursday, 26 September 2013 12:41:27 UTC+1, benno joy wrote:
>>>
>>> Hi Marcin,
>>>
>>> You could do 
>>>
>>> when: 'webserver' in group_names
>>>
>>> This would make the task run if the current host belongs to webserver 
>>> group.
>>>
>>> when: 'webserver' not in group_names
>>>
>>> would run the task if the current host is not on the webserver group.
>>>
>>>
>>> Hope this helps.
>>>
>>> Regards,
>>> Benno
>>>
>>>
>>>
>>>  -- 
>> 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].
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/8a362128-5b48-4929-a18c-84ceb944a650%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to