I keep getting error with the following ansible command.
...
- name: create policy
   rabbitmq_policy:
     name={{ item.name }}
     vhost={{ item.vhost | default('/', false) }}
     pattern={{ item.pattern }}
     priority={{ item.priority }}
     tags={{ item.tags }}
   with_items: rabbitmq_policy_configuration
...
where 'rabbitmq_policy_configuration' is
rabbitmq_policy_configuration
-name: GLOBAL
   vhost: /
   pattern: .*
   priority: 0
   tags: ha-mode=all,ha-sync-mode=automatic,max-length=1000000,expires=
1296000000

When the module processes this configuration, the value of 'tags' is
converted strictly to a *string*.
But in fact, the values of 'max-length' and 'expires' must be *ints* for
rabbitmqctl(assuming people understand what rabbitmqctl does) to work
properly.

This is the error message
failed: [10.*.*.*] => (item={'priority': 0, 'vhost': '/', 'tags':
'ha-mode=all,ha-sync-mode=automatic,max-length=1000000,expires=1296000000',
'name': 'GLOBAL', 'pattern': '.*'}) => {"cmd": "/usr/sbin/rabbitmqctl -q -n
rabbit set_policy -p / GLOBAL '.*' '{\"ha-sync-mode\": \"automatic\",
\"expires\": \"1296000000\", \"ha-mode\": \"all\", \"max-length\":
\"1000000\"}' --priority 0", "failed": true, "item": {"name": "GLOBAL",
"pattern": ".*", "priority": 0, "tags":
"ha-mode=all,ha-sync-mode=automatic,max-length=1000000,expires=1296000000",
"vhost": "/"}, "rc": 2}
stderr: Error: Validation failed

<<"1296000000">> is not a valid queue expiry

msg: Error: Validation failed

According to ansible docs, 'tags' can be a dictionary so I tried with this
rabbitmq_policy_configuration:
- name: GLOBAL
   vhost: /
   pattern: .*
   priority: 0
   tags:
      ha-mode: all
      ha-sync-mode: automatic
      max-length: 1000000
      expires: 1296000000
But it did not prevail.

failed: [10.*.*.*] => (item={'priority': 0, 'vhost': '/', 'tags': {
'ha-sync-mode': 'automatic', 'expires': 1296000000, 'ha-mode': 'all',
'max-length': 1000000}, 'name': 'GLOBAL', 'pattern': '.*'}) => {"failed":
true, "item": {"name": "GLOBAL", "pattern": ".*", "priority": 0, "tags": {
"expires": 1296000000, "ha-mode": "all", "ha-sync-mode": "automatic",
"max-length": 1000000}, "vhost": "/"}}
msg: this module requires key=value arguments (['name=GLOBAL', 'vhost=/',
'pattern=.*', 'priority=0', 'tags={ha-sync-mode:', 'automatic,', 'expires:',
'1296000000,', 'ha-mode:', 'all,', 'max-length:', '1000000}'])


FATAL: all hosts have already failed -- aborting


Could anyone please help pointing out what I have done wrong? I read the
source of rabbitmq_policy on github and did not spot any type conversions
of individual parameter values belong to the argument of 'tags'. I am
starting to doubt there is a bug.

FYI these are the environment information
Ansible version: 1.7.2-1ppa~precise
PC environment: Ubuntu 12.04

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/147323c3-d91e-4a89-83d9-9978866ac315%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • James Cammarata at Feb 5, 2015 at 9:13 am
    Hi Huaxing,

    This appears to be a simple formatting error. In your first example, you
    are mixing up the "complex argument" form (where everything is formatted as
    a dictionary in the YAML) but are specifying the tags as a comma separated
    list. You should be using the dictionary format for YAML for this instead:

       tags:
         ha-mode: all
         ha-sync-mode: automatic
         max-length: 1000000
         expires: 1296000000

    And rather than using the k=v format for your task, you should be using the
    complex form:

    - name: create policy
       rabbitmq_policy:
         name: "{{ item.name }}"
         vhost: "{{ item.vhost | default('/', false) }}"
         pattern: "{{ item.pattern }}"
         priority: "{{ item.priority }}"
         tags: "{{ item.tags }}"
       with_items: rabbitmq_policy_configuration

    Let us know if this doesn't get you past the error.

    Thanks!
    On Thu, Feb 5, 2015 at 8:29 AM, Huaxing Sun wrote:

    I keep getting error with the following ansible command.
    ...
    - name: create policy
    rabbitmq_policy:
    name={{ item.name }}
    vhost={{ item.vhost | default('/', false) }}
    pattern={{ item.pattern }}
    priority={{ item.priority }}
    tags={{ item.tags }}
    with_items: rabbitmq_policy_configuration
    ...
    where 'rabbitmq_policy_configuration' is
    rabbitmq_policy_configuration
    -name: GLOBAL
    vhost: /
    pattern: .*
    priority: 0
    tags: ha-mode=all,ha-sync-mode=automatic,max-length=1000000,expires=
    1296000000

    When the module processes this configuration, the value of 'tags' is
    converted strictly to a *string*.
    But in fact, the values of 'max-length' and 'expires' must be *ints* for
    rabbitmqctl(assuming people understand what rabbitmqctl does) to work
    properly.

    This is the error message
    failed: [10.*.*.*] => (item={'priority': 0, 'vhost': '/', 'tags':
    'ha-mode=all,ha-sync-mode=automatic,max-length=1000000,expires=1296000000',
    'name': 'GLOBAL', 'pattern': '.*'}) => {"cmd": "/usr/sbin/rabbitmqctl -q -n
    rabbit set_policy -p / GLOBAL '.*' '{\"ha-sync-mode\": \"automatic\",
    \"expires\": \"1296000000\", \"ha-mode\": \"all\", \"max-length\":
    \"1000000\"}' --priority 0", "failed": true, "item": {"name": "GLOBAL",
    "pattern": ".*", "priority": 0, "tags":
    "ha-mode=all,ha-sync-mode=automatic,max-length=1000000,expires=1296000000",
    "vhost": "/"}, "rc": 2}
    stderr: Error: Validation failed

    <<"1296000000">> is not a valid queue expiry

    msg: Error: Validation failed

    According to ansible docs, 'tags' can be a dictionary so I tried with this
    rabbitmq_policy_configuration:
    - name: GLOBAL
    vhost: /
    pattern: .*
    priority: 0
    tags:
    ha-mode: all
    ha-sync-mode: automatic
    max-length: 1000000
    expires: 1296000000
    But it did not prevail.

    failed: [10.*.*.*] => (item={'priority': 0, 'vhost': '/', 'tags': {
    'ha-sync-mode': 'automatic', 'expires': 1296000000, 'ha-mode': 'all',
    'max-length': 1000000}, 'name': 'GLOBAL', 'pattern': '.*'}) => {"failed":
    true, "item": {"name": "GLOBAL", "pattern": ".*", "priority": 0, "tags": {
    "expires": 1296000000, "ha-mode": "all", "ha-sync-mode": "automatic",
    "max-length": 1000000}, "vhost": "/"}}
    msg: this module requires key=value arguments (['name=GLOBAL', 'vhost=/',
    'pattern=.*', 'priority=0', 'tags={ha-sync-mode:', 'automatic,',
    'expires:', '1296000000,', 'ha-mode:', 'all,', 'max-length:', '1000000}'])


    FATAL: all hosts have already failed -- aborting


    Could anyone please help pointing out what I have done wrong? I read the
    source of rabbitmq_policy on github and did not spot any type conversions
    of individual parameter values belong to the argument of 'tags'. I am
    starting to doubt there is a bug.

    FYI these are the environment information
    Ansible version: 1.7.2-1ppa~precise
    PC environment: Ubuntu 12.04

    --
    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+unsubscribe@googlegroups.com.
    To post to this group, send email to ansible-project@googlegroups.com.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/ansible-project/147323c3-d91e-4a89-83d9-9978866ac315%40googlegroups.com
    <https://groups.google.com/d/msgid/ansible-project/147323c3-d91e-4a89-83d9-9978866ac315%40googlegroups.com?utm_medium=email&utm_source=footer>
    .
    For more options, visit https://groups.google.com/d/optout.
    --
    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+unsubscribe@googlegroups.com.
    To post to this group, send email to ansible-project@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAMFyvFi1JL-W7EPeQzUn254SXO9faxQaGVNOw0fxK9A1rfjyZQ%40mail.gmail.com.
    For more options, visit https://groups.google.com/d/optout.
  • Huaxing Sun at Feb 5, 2015 at 9:56 am
    James, thank you for the quick reply. Your advice fixed my problem. Complex
    form it is!!!
    On Thursday, February 5, 2015 at 5:29:41 PM UTC+9, Huaxing Sun wrote:

    I keep getting error with the following ansible command.
    ...
    - name: create policy
    rabbitmq_policy:
    name={{ item.name }}
    vhost={{ item.vhost | default('/', false) }}
    pattern={{ item.pattern }}
    priority={{ item.priority }}
    tags={{ item.tags }}
    with_items: rabbitmq_policy_configuration
    ...
    where 'rabbitmq_policy_configuration' is
    rabbitmq_policy_configuration
    -name: GLOBAL
    vhost: /
    pattern: .*
    priority: 0
    tags: ha-mode=all,ha-sync-mode=automatic,max-length=1000000,expires=
    1296000000

    When the module processes this configuration, the value of 'tags' is
    converted strictly to a *string*.
    But in fact, the values of 'max-length' and 'expires' must be *ints* for
    rabbitmqctl(assuming people understand what rabbitmqctl does) to work
    properly.

    This is the error message
    failed: [10.*.*.*] => (item={'priority': 0, 'vhost': '/', 'tags':
    'ha-mode=all,ha-sync-mode=automatic,max-length=1000000,expires=1296000000',
    'name': 'GLOBAL', 'pattern': '.*'}) => {"cmd": "/usr/sbin/rabbitmqctl -q -n
    rabbit set_policy -p / GLOBAL '.*' '{\"ha-sync-mode\": \"automatic\",
    \"expires\": \"1296000000\", \"ha-mode\": \"all\", \"max-length\":
    \"1000000\"}' --priority 0", "failed": true, "item": {"name": "GLOBAL",
    "pattern": ".*", "priority": 0, "tags":
    "ha-mode=all,ha-sync-mode=automatic,max-length=1000000,expires=1296000000",
    "vhost": "/"}, "rc": 2}
    stderr: Error: Validation failed

    <<"1296000000">> is not a valid queue expiry

    msg: Error: Validation failed

    According to ansible docs, 'tags' can be a dictionary so I tried with this
    rabbitmq_policy_configuration:
    - name: GLOBAL
    vhost: /
    pattern: .*
    priority: 0
    tags:
    ha-mode: all
    ha-sync-mode: automatic
    max-length: 1000000
    expires: 1296000000
    But it did not prevail.

    failed: [10.*.*.*] => (item={'priority': 0, 'vhost': '/', 'tags': {
    'ha-sync-mode': 'automatic', 'expires': 1296000000, 'ha-mode': 'all',
    'max-length': 1000000}, 'name': 'GLOBAL', 'pattern': '.*'}) => {"failed":
    true, "item": {"name": "GLOBAL", "pattern": ".*", "priority": 0, "tags": {
    "expires": 1296000000, "ha-mode": "all", "ha-sync-mode": "automatic",
    "max-length": 1000000}, "vhost": "/"}}
    msg: this module requires key=value arguments (['name=GLOBAL', 'vhost=/',
    'pattern=.*', 'priority=0', 'tags={ha-sync-mode:', 'automatic,',
    'expires:', '1296000000,', 'ha-mode:', 'all,', 'max-length:', '1000000}'])


    FATAL: all hosts have already failed -- aborting


    Could anyone please help pointing out what I have done wrong? I read the
    source of rabbitmq_policy on github and did not spot any type conversions
    of individual parameter values belong to the argument of 'tags'. I am
    starting to doubt there is a bug.

    FYI these are the environment information
    Ansible version: 1.7.2-1ppa~precise
    PC environment: Ubuntu 12.04
    --
    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+unsubscribe@googlegroups.com.
    To post to this group, send email to ansible-project@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/4dbdba70-3dbb-465a-a12e-73083896c3c1%40googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupansible-project @
postedFeb 5, '15 at 8:59a
activeFeb 5, '15 at 9:56a
posts3
users2

2 users in discussion

Huaxing Sun: 2 posts James Cammarata: 1 post

People

Translate

site design / logo © 2022 Grokbase