[ansible-project] local_action. Current working directory

2023-06-20 Thread Алексей Глушков
I'm executing the same script at two different hosts. Script just returns current working directory: tasks: - name: Get exec_path localaction local_action: command pwd register: res - debug: var=res.stdout_lines At both hosts script is locted in /opt/test In one host I'm ge

[ansible-project] RHEL8-packages-CIS_Benchmark-playbook

2023-06-20 Thread Himanshu Kaushik
Hi, Greetings! Can anyone please help me if my playbook is correct or not. Also, please help it correct and it should run / execute correctly and it should make the necessary changes in the RHEL8 slave VM and make the required changes and do the required updates as mentioned in the tasks 1.1,

Re: [ansible-project] RHEL8-packages-CIS_Benchmark-playbook

2023-06-20 Thread Evan Hisey
Looks like you are missing the entire start of a playbook. Is this a role or an include? If not need to set up the header section (hosts, connection, gather_facts, etc) and tasks section. On Tue, Jun 20, 2023, 8:44 AM Himanshu Kaushik wrote: > Hi, > > Greetings! > > Can anyone please help me if

[ansible-project] New release: ansible-core 2.14.7

2023-06-20 Thread Matt Martz
Hi all- we're happy to announce the general release of: ansible-core 2.14.7 How to get it - $ python3 -m pip install --user ansible-core==2.14.7 The release artifacts can be found here: # Built Distribution: 2207501 bytes # SHA256: a909b8cbdd8652796aa3e161d60d65bb18f210bdde27664f3

[ansible-project] New release: ansible-core 2.15.1

2023-06-20 Thread Matt Martz
Hi all- we're happy to announce the general release of: ansible-core 2.15.1 How to get it - $ python3 -m pip install --user ansible-core==2.15.1 The release artifacts can be found here: # Built Distribution: 2236122 bytes # SHA256: 2926b1dc96ef69272195c91a1fedfe30b9aacd674cb04628b

Re: [ansible-project] local_action. Current working directory

2023-06-20 Thread Dick Visser
On Tue, 20 Jun 2023 at 15:44, Алексей Глушков wrote: > I'm executing the same script at two different hosts. Script just returns > current working directory: > > tasks: > - name: Get exec_path localaction > local_action: command pwd > register: res > - debug: var=res.stdout_

Re: [ansible-project] local_action. Current working directory

2023-06-20 Thread Brian Coca
The 'script' action would copy a script from the controller to the target, run it and remove it, that way you can store it in a predictable spot adjacent to playbook or in role. Also you only need to ever update 1 copy of it. -- -- Brian Coca -- You received this message because you ar

Re: [ansible-project] RHEL8-packages-CIS_Benchmark-playbook

2023-06-20 Thread Dick Visser
On Tue, 20 Jun 2023 at 15:44, Himanshu Kaushik wrote: > > Can anyone please help me if my playbook is correct or not. > That totally depends on what your interpretation is of "correct". I doubt posting a 2000 line playbook and asking if it "is correct" is going to get a useful response. I'm defi

[ansible-project] Ansible task execution until it completes

2023-06-20 Thread Aharonu
Dear All, Could you please help with the below query. I have *variable_data *which contains 3 records. I want to keep run *debug *task continuously every 1 minute until *percent_complete* == 100 and then complete task execution. Please help to achieve my requirement. Thank you in advance. TASK

Re: [ansible-project] Ansible task execution until it completes

2023-06-20 Thread Dick Visser
This is not possible, because percent_complete is only 20, 60, or 80. 100 is not there. So whatever this means, it won't finish. On Tue, 20 Jun 2023 at 18:48, Aharonu wrote: > Dear All, > > Could you please help with the below query. > > I have *variable_data *which contains 3 records. I want to

Re: [ansible-project] Ansible task execution until it completes

2023-06-20 Thread Aharonu
I have another task (which will run long time) top of it where based on that this *percent_complete* will be changed and that date stored in *variable_data*. I want to run *debug* task every 1 min to check percent_complete and if records shows percent_complete is 100 and then exit the play. On Tu

[ansible-project] Re: Ansible task execution until it completes

2023-06-20 Thread Aharonu
The play *(debug)* should execute every 1min and *percent_complete* will get changed every time till 100. When *percent_complete* is reached 100 for every record in the *variable_data*, the play should exit. Please help to achieve. Thank You. On Tue, 20 Jun 2023, 22:18 Aharonu, wrote: > Dear

Re: [ansible-project] Re: Ansible task execution until it completes

2023-06-20 Thread Kosala Atapattu
Have you tried something like following? - name: wait for a url to work ansible.builtin.get_url: url: "https://myservice/"; dest: "/tmp/" register: result retries: 10 delay: 6 until: result.rc == 0 SInce your record is a json you should be able to pull that off easily. Cheers, *Kosala* On We

[ansible-project] Need help with executing a python script automation

2023-06-20 Thread Prady A
Hi all I want to execute a python script which is available in control node. And the python script uses the ansible_hostname variable and update in an excel template available in the control node. My role is very simple: - name: execute python script script: ./roles/writetoexcel.py {{ ansible

[ansible-project] Re: Need help with executing a python script automation

2023-06-20 Thread Prady A
I found one solution to with delegate_to option to run on the task on particular server. Regards On Wed, Jun 21, 2023 at 10:23, Prady A wrote: > Hi all > > I want to execute a python script which is available in control node. And > the python script uses the ansible_hostname variable and update

[ansible-project]Collect hostnames in an array

2023-06-20 Thread Prady A
Hi all Pls help.. need to collect all the hostnames in an array and pass that are art finally to an python script as an argument..so that I can process that python file with all hostname in a loop. If any other way to doing it that would be certainly great.. Regards.. Prady -- You received thi

Re: [ansible-project]Collect hostnames in an array

2023-06-20 Thread Dick Visser
https://docs.ansible.com/ansible/latest/cli/ansible-inventory.html On Wed, 21 Jun 2023 at 04:49, Prady A wrote: > Hi all > > Pls help.. need to collect all the hostnames in an array and pass that are > art finally to an python script as an argument..so that I can process that > python file with

Re: [ansible-project]Collect hostnames in an array

2023-06-20 Thread Prady A
Thank Dick..Thank you for your kindness.. Sorry if I confused. My intention is to run the playbook and get all the hostnames in a variable . Like : var=hostvars[ansible_hostname][‘ansible_hostname’] With the above command I can fetch the hostname but how to append all the hostnames in an array so

Re: [ansible-project]Collect hostnames in an array

2023-06-20 Thread Abhijeet Kasurde
I would write an Ansible module from the Python script and do the rest in Ansible. Anyways, check https://docs.ansible.com/ansible/latest/reference_appendices/special_variables.html#magic-variables for ansible_play_hosts and ansible_play_hosts_all On Tue, Jun 20, 2023 at 8:25 PM Prady A wrote: >

Re: [ansible-project]Collect hostnames in an array

2023-06-20 Thread Prady A
Thank you Abhijeet.. Actually I ve to add one role which can create an excel to automate with the hostnames in it.. so what I thought to gather all the hostnames and process them using a python script to update the excel and send the excel in mail. Regards On Wed, Jun 21, 2023 at 12:35, Abhijeet

[ansible-project] Re: Ansible task execution until it completes

2023-06-20 Thread Vladimir Botka
On Tue, 20 Jun 2023 22:18:22 +0530 Aharonu wrote: > I have *variable_data *which contains 3 records. I want to keep run > *debug *task > continuously every 1 minute until *percent_complete* == 100 and then > complete task execution. Given the list for testing variable_data: - {percent_com