Re: [ansible-project] restart service, check if port is ready to accept and then move to next host

2023-11-27 Thread Zdenek Pyszko
Regarding interference topic, this is how looping over the role without loop_var could look like. We all see its gonna be KABOOM :) * main.yml --- - name: Loop over hypervisors include_role: name: vm_action loop: "{{ hypervisors | dict2items }}" * roles/vm_action/tasks/main.yml --- - na

Re: [ansible-project] restart service, check if port is ready to accept and then move to next host

2023-11-27 Thread Zdenek Pyszko
Hi Evan, The loop_control part already came from Sameer, i just kept this part as i didnt want to bring another level of complexity. But in general, i use loop_control pretty often, especially in some deeper structures and to enforce readability, i.e.: * input vars structure --- hypervisors: hy

Re: [ansible-project] restart service, check if port is ready to accept and then move to next host

2023-11-25 Thread Evan Hisey
Zdenek- Quick question on your pull request, possibly missing the obvious. I see you use loop_control to set the outer loop variable on the roles. My understanding is the the roles would be a different namespace for the loops, so not interfere with the {{ item }} for the control loop, so was thi

Re: [ansible-project] restart service, check if port is ready to accept and then move to next host

2023-11-24 Thread Zdenek Pyszko
yea, getting better :) Have a look to diff of my fork, what could work: https://github.com/sameergithub5/prometheusrole/pull/1 It is still pretty raw, but it contains the idea. Dne neděle 19. listopadu 2023 v 8:54:59 UTC+1 uživatel Sameer Modak napsal: > Thanks a lot Zdenek. > > I got it now i h

Re: [ansible-project] restart service, check if port is ready to accept and then move to next host

2023-11-18 Thread Sameer Modak
Thanks a lot Zdenek. I got it now i have heard your comments and converted this to something closer . https://github.com/sameergithub5/prometheusrole/tree/main/node_exporter_and_prometheus_jmx_exporter Can you plz spot if there is a room for an improvement . On Thursday, November 16, 2023 at

Re: [ansible-project] restart service, check if port is ready to accept and then move to next host

2023-11-16 Thread Zdenek Pyszko
Hello Sameer, my two cents here as i made a quick lookup to your repo. I would suggest to refactor your repo to use roles. You have three different playbooks referenced in main.yml, which are doing more or less the same job. Create a role 'enable prometheus' which will be dynamic enough to make d

Re: [ansible-project] restart service, check if port is ready to accept and then move to next host

2023-11-09 Thread Sameer Modak
Hello Todd, I tried serial and it works but my problem is, serial works in playbook so when i write import_playbook inside include_task: zookeeper.yaml it fails saying u cant import playbook inside task. Now, How do i do it then?? ok so let me give you how i am running basically i have created

Re: [ansible-project] restart service, check if port is ready to accept and then move to next host

2023-11-03 Thread Todd Lewis
That's correct; serial is not a task or block key word. It's a playbook key word. - name: One host at a time   hosts: ducks_in_a_row   serial: 1   max_fail_percentage: 0 tasks: - task1 - task2 - task3 Read up on serial

Re: [ansible-project] restart service, check if port is ready to accept and then move to next host

2023-11-03 Thread Sameer Modak
Ok my requirement is exactly the same. https://stackoverflow.com/questions/64048208/run-ansible-tasks-on-hosts-one-by-one EXactly the same. list of taks needs to be run one by one on single host at a time On Friday, November 3, 2023 at 7:20:43 PM UTC+5:30 Will McDonald wrote: > I think you've

Re: [ansible-project] restart service, check if port is ready to accept and then move to next host

2023-11-03 Thread Will McDonald
I think you've misunderstood what I suggested. (Or I've explained it poorly.) If you use serial, you wouldn't need a block necessarily as you'd be executing over the inventory hosts one-at-a-time. If you insist on sticking with throttle, try it with a block in order to group your service restart

Re: [ansible-project] restart service, check if port is ready to accept and then move to next host

2023-11-03 Thread Sameer Modak
Hello will, i tried to do it with block and serial no it does not work say's block cant have serial tasks: - name: block check block: - name: run this shell shell: 'systemctl restart "{{zookeeper_service_name}}"' - name: debug debug: msg: "r

Re: [ansible-project] restart service, check if port is ready to accept and then move to next host

2023-11-01 Thread Sameer Modak
Let me try with block and serial and get back to you On Wednesday, November 1, 2023 at 5:33:14 AM UTC+5:30 Will McDonald wrote: > Edit: s/along with a failed_when/along with wait_for/ > > On Tue, 31 Oct 2023 at 23:58, Will McDonald wrote: > >> I don't entirely understand your approach, constrai

Re: [ansible-project] restart service, check if port is ready to accept and then move to next host

2023-10-31 Thread Will McDonald
Edit: s/along with a failed_when/along with wait_for/ On Tue, 31 Oct 2023 at 23:58, Will McDonald wrote: > I don't entirely understand your approach, constraints or end-to-end > requirements here, but trying to read between the lines... > > 1. You have a cluster of zookeeper nodes (presumably 2n

Re: [ansible-project] restart service, check if port is ready to accept and then move to next host

2023-10-31 Thread Will McDonald
I don't entirely understand your approach, constraints or end-to-end requirements here, but trying to read between the lines... 1. You have a cluster of zookeeper nodes (presumably 2n+1 so 3, 5 or more nodes) 2. You want to do a rolling restart of these nodes 1 at a time, wait for the node to come

Re: [ansible-project] restart service, check if port is ready to accept and then move to next host

2023-10-31 Thread Sameer Modak
Hello Will, I have used throttle so that part is sorted. But i dont think wait_for works here for example. task 1 restart. <--- now in this task already he has restarted all hosts one by one task 2 wait_for <-- this will fail if port does not come up but no use because restart is triggered. w

Re: [ansible-project] restart service, check if port is ready to accept and then move to next host

2023-10-31 Thread Will McDonald
I'd suggest reading up on rolling updates using serial: https://docs.ansible.com/ansible/latest/playbook_guide/guide_rolling_upgrade.html#the-rolling-upgrade https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_strategies.html#setting-the-batch-size-with-serial You can use wait_for or

[ansible-project] restart service, check if port is ready to accept and then move to next host

2023-10-31 Thread Sameer Modak
restart service, check if service is ready to accept connection because it takes time to come up. Once we sure its listening on port then only move to next host. unless dont move because we can only afford to have one service down at a time. is there any to short hand or ansible native way to h