30
27

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 5 years have passed since last update.

ansible 実行時に ControlPath too long エラーが出るのを回避する

Posted at

AWS の public DNS に対して ansible を実行すると、us-east-1リージョンでは成功するのに、ap-southeast-1リージョンでは、ControlPath too long というエラーが発生するという現象に悩んでいた。

よくよく調べてみると、デフォルトが %(directory)s/ansible-ssh-%%h-%%p-%%r という設定になっていて、ap-southeast-1リージョン(*.ap-southeast-1.compute.amazonaws.com)のように長いホスト名だと108文字の限界を越えてしまうせいだった。

The path to use for the ControlPath sockets. This defaults to
"%(directory)s/ansible-ssh-%%h-%%p-%%r", however on some systems with
very long hostnames or very long path names (caused by long user names > or
deeply nested home directories) this can exceed the character limit on
file socket names (108 characters for most platforms). In that case, you
may wish to shorten the string below.

Example:
control_path = %(directory)s/%%h-%%r

参考: https://github.com/zimbatm/home-deploy/blob/master/ansible.cfg

ということで、~/.ansible.cfg あたりに以下を追加して解決した。

[ssh_connection]
control_path = %(directory)s/as-%%h-%%r
30
27
1

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
30
27

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?