Not a ansible hero here, but i think you can do something with the when: 
command in your playbook. 

So somewhere in de the task where you check the version you will do a
register: dotnet_version

And in the taks where you execute it: 
when: "'4.8' in {{ dotnet_version }}"

Op woensdag 29 december 2021 om 17:57:20 UTC+1 schreef Nitrous:

> anyone with ideas?
>
> On Tuesday, December 21, 2021 at 3:25:23 PM UTC-6 Nitrous wrote:
>
>> any suggestions?
>>
>> On Monday, December 20, 2021 at 9:09:51 AM UTC-6 Nitrous wrote:
>>
>>> How can I incorporate this registry check before my playbook runs to 
>>> install .net 4.8:
>>>
>>> (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\NET Framework 
>>> Setup\NDP\v4\Full").version -lt 4.8
>>>
>>> The above should only run my playbook, if 4.8 isnt installed. If version 
>>> is less than 4.8 run the below playbook, else skip
>>>
>>> My playbook to install .net 4.8:
>>> - name: Copy .net 4.8 Files
>>>   ansible.windows.win_copy:
>>>     src: /etc/ansible/roles/net481/files/ndp48-x86-x64-allos-enu.exe
>>>     dest: C:\Scripts\
>>>     state: present
>>>
>>> - name: Install .net 4.8
>>>
>>>   ansible.builtin.script: /etc/ansible/roles/onprembaseline/files/net48.ps1
>>>   register: script_run
>>>
>>> - name: Reboot after .NET 4.8 Install
>>>   ansible.windows.win_reboot:
>>>
>>> Thanks.
>>>
>>

-- 
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/df88f98a-e25e-4ac7-9288-1abf873ae65fn%40googlegroups.com.

Reply via email to