Virtualboxの更新後にvagrantを起動したときに発生したansibleのエラーをnotion AIが教えてくれたメモ

## 概要

## 環境
- Windows 10 Home 22H2 
  - OSビルド: 19045.2673
  - エクスペリエンス: Windows Feature Experience Pack 120.2212.4190.0
- Virtualbox VirtualBox バージョン 7.0.6 r155176 (Qt5.15.2)
- Vagrant 2.3.4
  - box: ubuntu/jammy64     (virtualbox, 20230218.0.0)

## Virtualboxの更新

chocolateyを使って管理しているが、アップデートしようとしたときに下記エラーが発生

```
You have virtualbox v7.0.6 installed. Version 7.0.6.20230201 is available based on your source(s).
virtualbox is not running
Progress: Downloading virtualbox 7.0.6.20230201... 100%

virtualbox v7.0.6.20230201 [Approved]
virtualbox package files upgrade completed. Performing other installation steps.
File appears to be downloaded already. Verifying with package checksum to determine if it needs to be redownloaded.
Hashes match.
Hashes match.
Installing virtualbox...
VirtualBox-7.0.6-155176-Win.exe: error: Installation failed! Error: インストール中に致命的なエラーが発生しました。
Microsoft.PowerShell.Commands.WriteErrorException
ERROR: Running ["C:\Users\hoge\AppData\Local\Temp\chocolatey\virtualbox\7.0.6.20230201\VirtualBox-7.0.6-155176-Win.exe" -s -l -msiparams REBOOT=ReallySuppress ALLUSERS=1 ] was not successful. Exit code was '1'. See log for possible error messages.
The upgrade of virtualbox was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\virtualbox\tools\chocolateyInstall.ps1'.
 See log for details.
vscode v1.75.1 is the latest version available based on your source(s).
vscode.install v1.75.1 is the latest version available based on your source(s).
zoom v5.13.7.12602 is the latest version available based on your source(s).

Chocolatey upgraded 0/53 packages. 1 packages failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Failures
 - virtualbox (exited 1) - Error while running 'C:\ProgramData\chocolatey\lib\virtualbox\tools\chocolateyInstall.ps1'.
 See log for details.
```

アンインストール後、再インストールで無事更新できた。

```
PS C:\WINDOWS\system32> cuninst -y virtualbox
PS C:\WINDOWS\system32> cinst -y virtualbox
```


## Vagrant 起動時

### エラーメッセージ

```
$vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Preparing master VM for linked clones...
    default: This is a one time operation. Once the master VM is prepared,   
    default: it will be used as a base for linked clones, making the creation
    default: of new VMs take milliseconds on a modern system.
==> default: Importing base box 'ubuntu/jammy64'...
==> default: Cloning VM...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/jammy64' version '20230218.0.0' is up to date...
==> default: Setting the name of the VM: develop_default_1677329111890_9191
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 9005 (guest) => 9005 (host) (adapter 1)
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["startvm", "737bab9d-f8ae-4347-8c8e-2468c77edccb", "--type", "headless"]

Stderr: VBoxManage.exe: error: Failed to open/create the internal network 'HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter #2' (VERR_INTNET_FLT_IF_NOT_FOUND).
VBoxManage.exe: error: Failed to attach the network LUN (VERR_INTNET_FLT_IF_NOT_FOUND)
VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component ConsoleWrap, interface IConsole
```

### 対処
エラーメッセージでぐぐると、[VirtualBoxでminikubeやvagrantが起動しなくなった場合の対処（VERR_INTNET_FLT_IF_NOT_FOUND）](https://qiita.com/tmiki/items/563bf3450977fcd965cc)が引っかかった。

上記記事では、プロパティにチェックをいれていたが、確認したらチェック済であった。
無効にする → 有効にする で、`VirtualBox Host-Only Ethernete Adapter`のネットワークを再起動したところ、エラーは解消した。
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/99876/7f47c21c-a4b4-c29e-c093-5811033e53a0.png)


## ansibleが古くなっていたことの修正

notion AIに見てもらったら、違うよって教えてもらえた。

```
- name: step3.1
      shell: curl -fsSL https://download.docker.com/linux/ubuntu/gpg |  sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg - warn=no
      register: res3
      ignore_errors: True

    - name: step4
      shell: apt-key fingerprint 0EBFCD88 warn=no
```

上記のコードには、noという警告を無視するための誤ったオプションが含まれています。
正しいオプションはwarnです。
次のように修正してください


```
- name: step3.1
      shell: curl -fsSL <https://download.docker.com/linux/ubuntu/gpg> |  sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg --warn
      register: res3
      ignore_errors: True

    - name: step4
      shell: apt-key fingerprint 0EBFCD88 --warn
```