ansible-collections / community.windows

Windows community collection for Ansible
https://galaxy.ansible.com/community/windows
GNU General Public License v3.0
199 stars 153 forks source link

Disks not initialized (Windows 2022) #459

Open musklor opened 1 year ago

musklor commented 1 year ago

Hi, I have some issues with windows 2022.

Sometimes, with the windows modules, my disks are online, formated and mounted. Sometimes, not at all. (Offline)

Configuration : Vmtools 12.1 Os : windows 2022

No issue with windows 2019

Ansible 5.8.0

musklor commented 1 year ago

Test :

latest ISO windows 2022 (october) VRA manage ansible tls 1.3 disabled -> No more chance

musklor commented 1 year ago

https://pastebin.com/GJgY3smp

musklor commented 1 year ago

image

samuelMG1 commented 1 year ago

Okay nice

On Fri, Dec 23, 2022, 12:31 AM musklor @.***> wrote:

I'll send tomorrow the full and real code

— Reply to this email directly, view it on GitHub https://github.com/ansible-collections/community.windows/issues/459#issuecomment-1363367425, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2TD65KP6UH6GJGE2B7Z6NDWOTCD3ANCNFSM6AAAAAARVP6FEQ . You are receiving this because you are subscribed to this thread.Message ID: @.*** com>

samuelMG1 commented 1 year ago

Aah that is good am proud

On Fri, Dec 23, 2022, 2:41 PM musklor @.***> wrote:

Very funny, I tried to connect with local administor account just before the disk preparation. And it works!!!

— Reply to this email directly, view it on GitHub https://github.com/ansible-collections/community.windows/issues/459#issuecomment-1363881288, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2TD65ONILCQ5CRVKYHPEM3WOWFWTANCNFSM6AAAAAARVP6FEQ . You are receiving this because you are subscribed to this thread.Message ID: @.*** com>

samuelMG1 commented 1 year ago

Are you a software developer or app developer

On Fri, Dec 23, 2022, 2:41 PM musklor @.***> wrote:

Very funny, I tried to connect with local administor account just before the disk preparation. And it works!!!

— Reply to this email directly, view it on GitHub https://github.com/ansible-collections/community.windows/issues/459#issuecomment-1363881288, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2TD65ONILCQ5CRVKYHPEM3WOWFWTANCNFSM6AAAAAARVP6FEQ . You are receiving this because you are subscribed to this thread.Message ID: @.*** com>

musklor commented 1 year ago

Are you a software developer or app developer On Fri, Dec 23, 2022, 2:41 PM musklor @.> wrote: Very funny, I tried to connect with local administor account just before the disk preparation. And it works!!! — Reply to this email directly, view it on GitHub <#459 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2TD65ONILCQ5CRVKYHPEM3WOWFWTANCNFSM6AAAAAARVP6FEQ . You are receiving this because you are subscribed to this thread.Message ID: @. com>

I'm an IT engineer, I make the template and another team make the development. We use 5.8.0 version, and we cannot upgrade for the moment

samuelMG1 commented 1 year ago

Aah nice am a cyber security profession we troubleshoot

On Fri, Dec 23, 2022, 3:09 PM musklor @.***> wrote:

Are you a software developer or app developer … <#m-6407796974237649349> On Fri, Dec 23, 2022, 2:41 PM musklor @.> wrote: Very funny, I tried to connect with local administor account just before the disk preparation. And it works!!! — Reply to this email directly, view it on GitHub <#459 (comment) https://github.com/ansible-collections/community.windows/issues/459#issuecomment-1363881288>, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2TD65ONILCQ5CRVKYHPEM3WOWFWTANCNFSM6AAAAAARVP6FEQ https://github.com/notifications/unsubscribe-auth/A2TD65ONILCQ5CRVKYHPEM3WOWFWTANCNFSM6AAAAAARVP6FEQ . You are receiving this because you are subscribed to this thread.Message ID: @. com>

I'm an IT engineer, I make the template and another team make the development. We use 5.8.0 version, and we cannot upgrade for the moment

— Reply to this email directly, view it on GitHub https://github.com/ansible-collections/community.windows/issues/459#issuecomment-1363900631, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2TD65IZICARAGRJVI64ELDWOWI7XANCNFSM6AAAAAARVP6FEQ . You are receiving this because you are subscribed to this thread.Message ID: @.*** com>

musklor commented 1 year ago

In fact we use pur powershell code with win_shell.

samuelMG1 commented 1 year ago

Does it pay well can give a try ... You have wastsapp can talk more text me +254743984999

On Sat, Dec 24, 2022, 1:35 AM musklor @.***> wrote:

In fact we use pur powershell code with win_shell.

-

block:

  name: Initialize disk, create and format partition

  win_shell: |

  $Disk = Get-Disk {{item.number}}

  $Disk | Initialize-Disk -PartitionStyle MBR

  $Disk | New-Partition -UseMaximumSize -MbrType IFS

  $Partition = Get-Partition -DiskNumber $Disk.Number

  $Partition | Format-Volume -FileSystem NTFS -AllocationUnitSize
  "{{asset_disks['allocation_unit_size']|default(4096)}}" -Confirm:$false
  -

  name: Print return information from Initialize disk, create and
  format partition

  ansible.builtin.debug:

  var: result

  verbosity: 4
  -

  name: Mount partition on a new folder

  win_shell: |

  New-Item -ItemType Directory -Path
  "{{asset_disks[item.number|string]['path']}}"

  Get-Partition -DiskNumber {{item.number}} | Add-PartitionAccessPath
  -AccessPath "{{asset_disks[item.number|string]['path']}}"
  -

  name: Print return information from Mount partition on a new folder

  ansible.builtin.debug:

  var: result

  verbosity: 4

when: asset_disks[item.number|string]['type'] == 'path'

— Reply to this email directly, view it on GitHub https://github.com/ansible-collections/community.windows/issues/459#issuecomment-1364368902, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2TD65PIENE4WHNVGVTQKPDWOYSKHANCNFSM6AAAAAARVP6FEQ . You are receiving this because you are subscribed to this thread.Message ID: @.*** com>

musklor commented 1 year ago

I've found a solution :

-name: Initialize a disk with an MBR partition style community.windows.win_initialize_disk: disk_number: 1 style: mbr force: yes

I don't know why but with windows 2022 I need the force option.....

Strange isn't it ? @jborean93

samuelMG1 commented 1 year ago

Ok, I'll check it out.

On Wed, Dec 28, 2022, 8:41 PM musklor @.***> wrote:

I've found a solution :

-

delete line $Disk | Initialize-Disk -PartitionStyle MBR

use module win_initialise_disk with force option

name: Initialize a disk with an MBR partition style community.windows.win_initialize_disk: disk_number: 1 style: mbr force: yes

I don't know why but with windows 2022 I need the force option.....

— Reply to this email directly, view it on GitHub https://github.com/ansible-collections/community.windows/issues/459#issuecomment-1366817280, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2TD65JEITS6SWVESJBRUNDWPR3VZANCNFSM6AAAAAARVP6FEQ . You are receiving this because you are subscribed to this thread.Message ID: @.*** com>