0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

[Ansible] Inventoryのipアドレスを書き換えたのに、実行時に反映されない場合の対処法。

Last updated at Posted at 2022-03-08

状況

ansibleの実行対象を変更するべく、inventoryファイルのipアドレスをベタ書きで変更。

- XX.XXX.XXX.XXX
+ YY.YYY.YYY.YYY

いざansibleを実行すると、以下のエラーが発生。

TASK [Gathering Facts] *********************************************************
fatal: [XX.XXX.XXX.XXX]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: ssh: connect to host XX.XXX.XXX.XXX port 22: Connection timed out", "unreachable": true}

SSH接続ができないと言っているが、ipアドレスの変更が反映されていないのでそちらの問題だと思われる。

対応

色々試してみたところ、ホストにグループ名をつけることで解決した。

[hogehoge]
YY.YYY.YYY.YYY

playbookのhostの指定は、allでもグループ名でもどちらでも良い。

今度は無事に、ipアドレスの変更が反映された。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?