2
3

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でディレクトリ単位のバックアップを行う

Posted at

結論

synchronize モジュール × delegate_toを使いましょう。
copyモジュールでは、対象サーバ内でのディレクトリ単位でのコピーが出来ないため。

参照

Ansibleの操作対象ホスト上でファイルやディレクトリをコピーする:synchronizeモジュールの振る舞い - Qiita

copy モジュールで利用できず詰まった

copyモジュール × remote_src で出来そうだな~と思って実行すると、以下のエラーが出ます。

Remote copy does not support recursive copy of directory

えぇ~。
また、copyモジュールでのエラーメッセージで検索しても日本語のページが出てこなかったので詰みます。

GitHub上には、ちょうどよいissueがあってみてたんですが、synchronizeについての記載は目に入らずスルーしてました。
Allow copy module to work with recursive and remote_src · Issue #14131 · ansible/ansible

2
3
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
2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?