by shigemk2

当面は技術的なことしか書かない

s3_sync

ansible下のファイルとディレクトリをS3に同期させるAnsibleモジュール。 file_root で指定したところから下のディレクトリとパスを、そっくりそのままS3に同期させることが出来る。

なお、そのまま同期させることはできてもgroup_varsとtemplateのコンボでファイルの中身を場合分けしながら同期させることは現行のs3_syncじゃできないようだ。

- name: basic upload
  s3_sync:
    bucket: tedder
    file_root: roles/s3/files/

- name: all the options
  s3_sync:
    bucket: tedder
    file_root: roles/s3/files
    mime_map:
      .yml: application/text
      .json: application/text
    key_prefix: config_files/web
    file_change_strategy: force
    permission: public-read
    cache_control: "public, max-age=31536000"
    include: "*"
    exclude: "*.txt,.*"

s3_sync - Efficiently upload multiple files to S3 — Ansible Documentation