Opensourcetechブログ

OpensourcetechによるNGINX/Kubernetes/Zabbix/Neo4j/Linuxなどオープンソース技術に関するブログです。

Ansible で "command timeout triggered, timeout value is 10 secs." と出力された時の対応方法

こんにちは、LinuCエバンジェリストこと、鯨井貴博@opensourcetechです。

 

今回は Ansibleで Playbookを実行した時に、

 "command timeout triggered, timeout value is 10 secs."と表示され FAILEDとなった時への対応方法を紹介します。

 

 

事象内容

以下は、JuniperのJunosに対してPlaybookで設定を投入しているものですが、

実施時に以下のように実行失敗(FAILED)となっています。

XYZ:ansible_test Xjapan$ ansible-playbook -i inventory5 junos_test11.yaml

PLAY [junos] *******************************************************************

TASK [delete services] *********************************************************
fatal: [192.168.111.1]: FAILED! => {"changed": false, "msg": "command timeout triggered, timeout value is 10 secs.\nSee the timeout setting options in the Network Debug and Troubleshooting Guide."}

PLAY RECAP *********************************************************************
192.168.111.1 : ok=0 changed=0 unreachable=0 failed=1

 

発生する状況としては、以下のように設定の反映に10秒以上の時間を要するなどのケースとなります。

以下では、Junosの設定ファイルへ追加設定を反映させる commitコマンドに13秒程度かかっています。

www.youtube.com

 

 

事象の原因

原因は、コマンドを実行した際にデバイスからのレスポンスを待つタイムアウト値があるのですが、それがデフォルトで10秒に設定されていることにあります。

f:id:opensourcetech:20181005182020p:plain

Ansible Configuration Settings — Ansible Documentation

 

 

 

事象への対応方法

ansible.cfgに以下の設定を追加します。

[persistent_connection]
command_timeout = 30

 

その他、

以下にあるパラメータのtimeoutをPlaybookに書くなどすれば対応できそうです。

 ※未検証

junos_config - Manage configuration on devices running Juniper JUNOS — Ansible Documentation

Example: Using Ansible to Configure Devices - TechLibrary - Juniper Networks

 

 

 

 

 

www.slideshare.net

github.com

www.facebook.com

twitter.com

www.instagram.com

 

 

にほんブログ村 IT技術ブログ Linuxへ
Linux

にほんブログ村 IT技術ブログ オープンソースへ
オープンソース

 

 

Opensourcetech by Takahiro Kujirai