As per my understanding roles will not require and specific tags
- hosts: "{{ groups['all'][0] }}"
gather_facts: no
become: true
vars_files:
-
roles:
- abc
Or
- "{{ and role name }}"
On Tue, Sep 1, 2020, 9:02 PM 'Ramu Mathi' via Ansible Project <
[email protected]> wrote:
> Hi Singh, This is my configuration and it invokes the below tasks. - hosts:
> "{{ groups['all'][0] }}"
> gather_facts: no
> become: true
> vars_files:
> -
> roles:
> - { role: *****/*, tags: ['******'] }
> ---------------------------------------------------
> - name: add vhosts
> shell: "docker exec rmq-ha rabbitmqctl add_vhost {{ item.name }}"
> with_items: "{{ ******* }}"
> ignore_errors: true
> - name: add users
> shell: "docker exec rmq-ha rabbitmqctl add_user {{ item.name }} {{
> item.password }}"
> with_items: "{{ ******* }}"
> ignore_errors: true
> tags:
> - *******
> - name: change users passwords
> shell: "docker exec rmq-ha rabbitmqctl change_password {{ item.name }} {{
> item.password }}"
> with_items: "{{ ******* }}"
> ignore_errors: true
> tags:
> - *******
> - name: add user tags
> shell: "docker exec rmq-ha rabbitmqctl set_user_tags {{ item.name }} {{
> item.tags }}"
> with_items: "{{ ******* }}"
> ignore_errors: true
> tags:
> - ******* Now I am getting that error, where we need to add that double
> quote? Thanks, Ramu.
>
> On Tue, Sep 1, 2020 at 7:53 PM Kundan Singh <[email protected]>
> wrote:
>
>> Hi ,
>>
>> There is a syntax issue in the jinja2 template
>> When you are defining hosts there should be space in variable mention in
>> the line
>>
>> Synatx should appear like below
>>
>> hosts: "{{ abc }}"
>>
>>
>> Regards
>> Kundan singh
>>
>> On Tue, Sep 1, 2020, 3:13 PM 'Ramu Mathi' via Ansible Project <
>> [email protected]> wrote:
>>
>>> I am getting the following the error with my config
>>>
>>>
>>> ERROR! The field 'hosts' has an invalid value, which includes an
>>> undefined variable. The error was: list object has no element 0
>>>
>>>
>>> The error appears to be in
>>> '/Users/ramumathi/Desktop/workspace/RMQ/ansible-rmq-ha/playbook.yml': line
>>> 91, column 3, but may
>>>
>>> be elsewhere in the file depending on the exact syntax problem.
>>>
>>>
>>> The offending line appears to be:
>>>
>>>
>>>
>>> - hosts: "{{ groups['all'][0] }}"
>>>
>>> ^ here
>>>
>>> We could be wrong, but this one looks like it might be an issue with
>>>
>>> missing quotes. Always quote template expression brackets when they
>>>
>>> start a value. For instance:
>>>
>>>
>>> with_items:
>>>
>>> - {{ foo }}
>>>
>>>
>>> Should be written as:
>>>
>>>
>>> with_items:
>>>
>>> - "{{ foo }}"
>>>
>>>
>>> ansible-playbook --version
>>>
>>> ansible-playbook 2.8.1
>>>
>>> python version = 2.7.16 (default, Dec 13 2019, 18:00:32) [GCC 4.2.1
>>> Compatible Apple LLVM 11.0.0 (clang-1100.0.32.4) (-macos10.15-objc-s
>>>
>>> Can you please let me know why I am getting this error.
>>>
>>> Thanks,
>>>
>>> Ramu.
>>>
>>> --
>>> 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/37056e7f-6ece-4f17-b633-23efebb8b80fn%40googlegroups.com
>>> <https://groups.google.com/d/msgid/ansible-project/37056e7f-6ece-4f17-b633-23efebb8b80fn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Ansible Project" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/ansible-project/r-WAba-9WI0/unsubscribe
>> .
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/CADGcVU2SfQO%3D-7g8K_k-zARf%3DkgEUMfhHWywu%3DcrHFRtCPhJHA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/ansible-project/CADGcVU2SfQO%3D-7g8K_k-zARf%3DkgEUMfhHWywu%3DcrHFRtCPhJHA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> 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/CANE_N8ENpS%3DTV4oFb6EfL6Mcz1pMsUzknRSx-d1CCqfduF78yg%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CANE_N8ENpS%3DTV4oFb6EfL6Mcz1pMsUzknRSx-d1CCqfduF78yg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
--
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/CADGcVU3YyTyoOaXw9PCsKa8WRT4c%2BZsEQONBkLmu175WNtDz0Q%40mail.gmail.com.