Re: [ansible-devel] Environment variables

2023-10-16 Thread Mark Chappell
On Mon, 16 Oct 2023 at 09:09, Y.G Kumar wrote: > This is not working either: > Attempting to read between the lines, you've misunderstood what the "environment" parameter does. The "environment" parameter sets the shell environment variables for a specific *task*[1]. It doesn't affect later

Re: [ansible-devel] Environment variables

2023-10-16 Thread Y.G Kumar
Just to reiterate my requirement. I just want to create a remote environment variable by assigning to it the value contained in a registered variable while executing the shell command as shown below --- - hosts: localhost tasks: - name: "subtask" shell: lsblk --nodeps | grep

Re: [ansible-devel] Environment variables

2023-10-16 Thread Y.G Kumar
This is not working either: --- --- - hosts: localhost tasks: - name: "subtask" shell: lsblk --nodeps | grep disk | wc -l register: disk_count_result - name: "set fact" set_fact: disk_count: "{{ disk_count_result.stdout | int }}" environment:

Re: [ansible-devel] Environment variables

2023-10-15 Thread Avinash Jadhav
Please try this one --- hosts: localhost tasks: - name: "subtask" command: lsblk --nodeps | grep disk | wc -l register: disk_count_result - name: "set fact" set_fact: disk_count: "{{ disk_count_result.stdout | int }}" - name: "print disk count" debug: msg:

[ansible-devel] Environment variables

2023-10-15 Thread Y.G Kumar
Hi All, Please don't yell at me for posting in this group. I have already written to the ansible project group. They are saying it is not possible to achieve the following result. I have written the below code and it is not working. hosts: localhost tasks: - name: "subtask"