so what i tried is , I created another playbook and inside that mentioned
serial which works fine with add_host . I am getting expected results but
when i tried to add this code in my actual role. (I first test code in
temporary playbook , so that i dont mess the role)
But when copy paste the code in my role here obviously structure is
different,
main.yml-->zookeeper.yml(task yaml )--> imported playbook(new playbook as
serial only works for plays).
code ,
this is zookeeper.yml which is a task list yaml, and not a playbook
- name: Check who is existing zokeeper leader
shell: 'echo stat | nc localhost
"{{hostvars[inventory_hostname].zk_port}}" | grep Mode'
register: zkmode
- name: Set service name as a fact
set_fact:
service_name: "{{ zookeeper_service_name }}"
- name: Restart playbook
import_playbook: Restart.yml
now when i run the role i get
ERROR! this task 'import_playbook' has extra params, which is only allowed
in the following modules: command, include, ansible.legacy.meta,
ansible.legacy.set_fact, import_tasks, ansible.legacy.import_role,
win_shell, group_by, win_command, ansible.builtin.set_fact, include_vars,
ansible.builtin.shell, ansible.builtin.meta, ansible.legacy.group_by,
ansible.legacy.win_command, set_fact, import_role, ansible.legacy.command,
ansible.legacy.include_tasks, ansible.builtin.import_role,
ansible.legacy.raw, meta, include_role, ansible.legacy.win_shell,
include_tasks, ansible.builtin.script, add_host, ansible.legacy.add_host,
ansible.builtin.include_tasks, script, ansible.builtin.include_vars,
ansible.windows.win_command, ansible.builtin.add_host,
ansible.legacy.include, ansible.legacy.include_role, ansible.legacy.shell,
ansible.builtin.include_role, shell, ansible.legacy.script,
ansible.builtin.win_shell, ansible.builtin.win_command,
ansible.builtin.command, ansible.builtin.raw, raw,
ansible.legacy.import_tasks, ansible.legacy.include_vars,
ansible.builtin.group_by, ansible.windows.win_shell,
ansible.builtin.include, ansible.builtin.import_tasks
The error appears to be in
'/Users/sameer_modak/ansibledemo/prometheus/tasks/zookeeper_prometheus.yml':
line 118, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: Imporing Restartandcheck yaml
^ here
On Saturday, November 4, 2023 at 6:34:58 AM UTC+5:30 Todd Lewis wrote:
> - name: One host at a time
> hosts: ducks_in_a_row
> serial: 1
> max_fail_percentage: 0
> tasks:
> - task1
> - task2
> - task3
>
>
>
> On 11/3/23 3:57 PM, Sameer Modak wrote:
>
>
> How to acheive this then ??
> On Friday, November 3, 2023 at 11:36:48 PM UTC+5:30 Brian Coca wrote:
>
>> serial is a PLAY level keyword and what you want to use in this case,
>> throttle will only control the forks/parallel jobs, not serialize a
>> batch (this is what serial does).
>>
>> --
>> ----------
>> Brian Coca
>>
>> --
> 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/a628eae5-14f1-4e17-9425-2643282af93dn%40googlegroups.com
>
> <https://groups.google.com/d/msgid/ansible-project/a628eae5-14f1-4e17-9425-2643282af93dn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>
> --
> Todd
>
>
--
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/6a3689e4-6441-4094-873a-e7d7d07f6ba6n%40googlegroups.com.