Re: [ansible-project] Unable to reuse ssh connections in Ansible despite PIPELINING = True

2023-07-12 Thread davis...@gmail.com
Why would you need to check whether the connection plugin supports such a new feature? ConnectionBase already has methods for _connect, connected, reset and close, separate from exec_command, put_file and fetch_file So wouldn't this work for all connection plugins if Ansible just starts

Re: [ansible-project] is there any order by clause for hosts to execute task in certain order

2023-07-12 Thread Stephen Maher
Hi, This should help https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_strategies.html#ordering-execution-based-on-inventory Regards > On 12 Jul 2023, at 15:54, Sameer Modak wrote: > > > > Hello Team, > > We have a situation where we have to run same script on all 3

Re: [ansible-project] command/shell module warn deprecation

2023-07-12 Thread John Petro
yeah, I saw that, and I might go down that road, but wanted to see if there was a better way first. --jp On Wed, Jul 12, 2023 at 11:39 AM 'Rowe, Walter P. (Fed)' via Ansible Project wrote: > I think you can place an ansible.cfg file in the folder where your ansible > is running. We do this for

Re: [ansible-project] command/shell module warn deprecation

2023-07-12 Thread 'Rowe, Walter P. (Fed)' via Ansible Project
I think you can place an ansible.cfg file in the folder where your ansible is running. We do this for our packer image management service that also uses ansible in the provisioner stage. Walter -- Walter Rowe, Division Chief Infrastructure Services, OISM Mobile: 202.355.4123 On Jul 12, 2023,

[ansible-project] command/shell module warn deprecation

2023-07-12 Thread John Petro
Good Morning, I manage the building of some virtual machine templates using packer. I am leveraging ansible as part of this, and when I am doing some cleanup after the setup is done to prepare for the conversion to template, and a couple of the options I need in yum/dnf, etc don't exist in the

[ansible-project] is there any order by clause for hosts to execute task in certain order

2023-07-12 Thread Sameer Modak
Hello Team, We have a situation where we have to run same script on all 3 machines but in specific order like first it should be run on follower and then on leader. now to achieve this i have to repeat same task again with different condition. Can it be achieve in one ??? - name: Kill

Re: [ansible-project] Re: restart service only if its successful

2023-07-12 Thread Sameer Modak
I get it . But this is specific case where my current process is not managed by systemd so i had to use pkill anyways. Now issue is shell module with if else is not working for me correctly. Like its giving rc -9. if i copy same shell script and rung using shell module like bash /tmp/zkproc.sh

Re: [ansible-project] Unable to reuse ssh connections in Ansible despite PIPELINING = True

2023-07-12 Thread Brian Coca
Kind of, there is ansible-connection but it can be complicated. I've been toying around with the idea of a 'persistent: no|yes' keyword to allow for the use/reuse of persistent sessions. This would first look at the connection plugin for support and fallback to a connection

Re: [ansible-project] Re: restart service only if its successful

2023-07-12 Thread Todd Lewis
Maybe you should be using the systemctl action "reload-or-restart"? Killing service processes out from under systemd should not be a thing. And as Dick Visser said, we're straying from Ansible issues. To your other question: Secondly, as its impossible to explore entire tool like ansible hence

Re: [ansible-project] Re: restart service only if its successful

2023-07-12 Thread Stefan Hornburg (Racke)
On 12/07/2023 13:30, Dick Visser wrote: Hii, On Wed, 12 Jul 2023 at 12:53, Sameer Modak wrote: Hi Todd, I tried to run script with shell module but it fails with below error, [kafka-3: FAILED! => {"changed": true, "cmd": "if pkill --signal 9 -f zookeeper.properties ;

Re: [ansible-project] Re: restart service only if its successful

2023-07-12 Thread Dick Visser
Hii, On Wed, 12 Jul 2023 at 12:53, Sameer Modak wrote: > Hi Todd, > > I tried to run script with shell module but it fails with below error, > > [kafka-3: FAILED! => {"changed": true, "cmd": "if pkill --signal 9 -f > zookeeper.properties ; then\nsystemctl start >

Re: [ansible-project] Re: restart service only if its successful

2023-07-12 Thread Sameer Modak
Infact I tried code pasted by still gives same error. - name: Kill running java processes and start newly configured systemd throttle: 1 #ignore_errors: yes any_errors_fatal: true shell: | if pkill --signal 9 -f zookeeper.properties ; then sleep 6

Re: [ansible-project] Re: restart service only if its successful

2023-07-12 Thread Sameer Modak
Hi Todd, I tried to run script with shell module but it fails with below error, [kafka-3: FAILED! => {"changed": true, "cmd": "if pkill --signal 9 -f zookeeper.properties ; then\nsystemctl start confluent-zookeeper510\nelse\nexit 1\nfi\nsystemctl status confluent-zookeeper510\n", "delta":

Re: [ansible-project] Unable to reuse ssh connections in Ansible despite PIPELINING = True

2023-07-12 Thread davis...@gmail.com
> - for ssh connection plugin, the control persist settings are what reuse connections/authentication, but not sessions Is there a mechanism to re-use sessions? Or a mechanism to re-use connections for non-ssh connection plugins? Thanks, Matt Le jeudi 6 juillet 2023 à 03:24:03 UTC+10, Mark

Re: [ansible-project] Re: restart service only if its successful

2023-07-12 Thread Sameer Modak
First of all Thanks a lot for introducing me pkill way otherwise i would have written one more task to register the process id. Many thanks Todd. Secondly, as its impossible to explore entire tool like ansible hence just asking you the question, Does it even possible to do above things