Bonjour. je suis nouveau dans l'utilisation de ansible. Besoin d'aide
Comment pointer sur la nouvelle version de ansible puisqu'on me dit
que ansible2.7.10 est dépassé.
voici le message d'erreur. Je vous remercie.
/home/user-ansible/ansible2.7.10/local/lib/python2.7/site-packages/ansible/parsing/vault/__init__.py:41:
CryptographyDeprecationWarning: Python 2 is no longer supported by the
Python core team. Support for it is now deprecated in cryptography, and
will be removed in the next release.
  from cryptography.exceptions import InvalidSignature
ERROR! - the directory ./apache already exists.you can use --force to
re-initialize this directory,
however it will reset any main.yml files that may have
been modified there already.

Le ven. 25 févr. 2022 à 17:27, Nitrous <[email protected]> a écrit :

> Thanks, mind showing me an example, on how to use the  win_reg_stat with
> register variable?
>
> On Saturday, February 12, 2022 at 10:01:55 PM UTC-6 Oleg Galushko wrote:
>
>> hm. try to use win_reg_stat with register variable to determine what
>> version your need is installed/not installed
>> https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed#use-registry-editor
>> and wrap all other installation tasks with block and when condition
>>
>> пятница, 4 февраля 2022 г. в 01:09:06 UTC+3, Nitrous:
>>
>>>
>>> Thanks.
>>>
>>> I have a pretask before installing, where it copies files to the target
>>> server, and then run your idempotent way.
>>>
>>> How can I do a check, before copying the .net 4.8 exe, if 4.8 exists,
>>> and only run the copy/install if .net 4.8 isnt installed/exists.
>>>
>>> If it exists, then skip.
>>>
>>> Thanks
>>> On Friday, January 21, 2022 at 2:51:09 PM UTC-6 [email protected]
>>> wrote:
>>>
>>>> Use idempotent way. It will be installed if it has not already been
>>>> installed
>>>>
>>>>         -   ansible.windows.win_package:
>>>>             path: 'c:\path\to\ndp48-x86-x64-allos-enu.exe'
>>>>             product_id: "{BAAF5851-0759-422D-A1E9-90061B597188}"
>>>>             arguments: "/q /norestart"
>>>>
>>>> среда, 19 января 2022 г. в 21:33:41 UTC+3, Nitrous:
>>>>
>>>>> This is what I get:
>>>>>
>>>>> TASK [net481 : Check if .net 4.8 is installed]
>>>>> **************************************************************************************************************************************************************************
>>>>> task path: /etc/ansible/roles/net481/tasks/main.yml:1
>>>>> [WARNING]: conditional statements should not include jinja2 templating
>>>>> delimiters such as {{ }} or {% %}. Found: '4.8' in {{ script_run }}
>>>>> fatal: [xxxxx]: FAILED! => {
>>>>>     "msg": "The conditional check ''4.8' in {{ script_run }}' failed.
>>>>> The error was: error while evaluating conditional ('4.8' in {{ script_run
>>>>> }}): 'script_run' is undefined\n\nThe error appears to be in
>>>>> '/etc/ansible/roles/net481/tasks/main.yml': line 1, column 3, but may\nbe
>>>>> elsewhere in the file depending on the exact syntax problem.\n\nThe
>>>>> offending line appears to be:\n\n\n- name: Check if .net 4.8 is 
>>>>> installed\n
>>>>>  ^ here\n"
>>>>> }
>>>>>
>>>>> Role is this:
>>>>>
>>>>> - import_role:
>>>>>       name: net481
>>>>>     when: "'4.8' in {{ script_run }}"
>>>>>
>>>>> Task Ran:
>>>>>
>>>>> - name: Check if .net 4.8 is installed
>>>>>   ansible.windows.win_shell:
>>>>>     (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\NET Framework
>>>>> Setup\NDP\v4\Full").version -lt 4.8
>>>>>   register: script_run  - name: Install .net 4.8, if not installed
>>>>>   ansible.builtin.script:
>>>>> /etc/ansible/roles/onprembaseline/files/net48.ps1
>>>>>   register: script_run
>>>>>
>>>>> On Thursday, December 30, 2021 at 12:25:32 PM UTC-6 Niek wrote:
>>>>>
>>>>>> Probably check:
>>>>>> https://docs.ansible.com/ansible/latest/user_guide/playbooks_conditionals.html
>>>>>>
>>>>>> Op donderdag 30 december 2021 om 19:24:36 UTC+1 schreef Niek:
>>>>>>
>>>>>>> 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/86401a66-10cf-42eb-af8b-4e897594bdden%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/86401a66-10cf-42eb-af8b-4e897594bdden%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAHKXhSSCj1%2BfZQXLQ_%2B1oUbiFjNXPVuSPnyR62VUu4eMv%3DO8-g%40mail.gmail.com.

Reply via email to