L-P.syncthing

ansible-role-syncthing

Syncthingをインストールします。

要件

Debian系のディストリビューションが必要です。リモートホストでのrootアクセスまたは_権限昇格_が必要です。 開放すべきポートについては、Syncthingのドキュメントを確認してください。 ファイアウォールの設定はこのロールでは管理されません。

ロールの変数

すべての変数はオプションです。
Syncthingのオプションを設定する唯一の方法は、config.xmlファイルを編集することです。詳細は例のプレイブックセクションを参照してください。

# リポジトリやキーが変更される場合や独自にホストしたい場合、これらを変更します:
syncthing_apt_key_id:
syncthing_apt_key_url:
syncthing_apt_repository:

# Syncthingのユーザー名やホームディレクトリを変更する場合:
syncthing_user:
syncthing_user_home:

# ユーザーを作成および管理したくない場合はfalseに設定してください。
# syncthing_userで指定されたユーザーを手動で作成する必要があります
# このロールを使用する_前_に。
syncthing_manage_user:

# リモートホストからSyncthingの設定を取得するにはtrueに設定してください。
# 例のプレイブックセクションを参照してください。
syncthing_fetch_config:

# 取得したファイルが書き込まれる場所。
syncthing_fetch_dir:

# 設定ファイルの内容
syncthing_config_cert:
syncthing_config_key:
syncthing_config_https_cert:
syncthing_config_https_key:
syncthing_config_config:

依存関係

なし。

例のプレイブック

# Syncthing をインストール
- hosts: servers
  roles:
    - { role: l-p.syncthing }

Syncthingの設定は動的で、GUIを使って実行時に編集されます。
設定をホストから取得し、syncthing_config_*変数に書き込む必要があります。そうすれば安全に保管でき、次回このロールを実行する際にサーバーに実際にある設定が反映されます。

再度ロールを実行する前に設定を取得しないと、リモートホストからすべての新しいデバイス/フォルダ/設定が消去されます。

syncthing_config_*変数を設定しない場合、何も上書きされませんが、サーバーが障害を起こすと設定が失われてしまいます。

# 生成された設定を取得
- hosts: servers
  roles:
    - { role: l-p.syncthing, syncthing_fetch_config: true }

lookupを使ってファイルを読み取り、変数を設定できます:

syncthing_config_cert: "{{lookup('file', 'files/{{ inventory_hostname }}/home/syncthing/.config/syncthing/cert.pem')}}"
syncthing_config_key: "{{lookup('file', 'files/{{ inventory_hostname }}/home/syncthing/.config/syncthing/key.pem')}}"
syncthing_config_https_cert: "{{lookup('file', 'files/{{ inventory_hostname }}/home/syncthing/.config/syncthing/https-cert.pem')}}"
syncthing_config_https_key: "{{lookup('file', 'files/{{ inventory_hostname }}/home/syncthing/.config/syncthing/https-key.pem')}}"
syncthing_config_config: "{{lookup('file', 'files/{{ inventory_hostname }}/home/syncthing/.config/syncthing/config.xml')}}"

キーはansible-vaultを使用して暗号化することをお勧めします。lookupはそれらをリアルタイムで復号化します。

ライセンス

MIT

プロジェクトについて

Install Syncthing on Debian 11

インストール
ansible-galaxy install L-P.syncthing
ライセンス
mit
ダウンロード
114
所有者