siw36.ansible_hcloud_vm
ansible-hcloud-vm
このロールは、Hetzner Cloudに追加ディスクを持つ1つ以上の仮想マシンをデプロイします。
起こること:
- 指定されたSSH公開鍵があなたのアカウントに作成されます
- サーバーのリストが作成され、指定されたSSH鍵がルートとしてアクセスできるようになります(Hetznerのイメージを使用している限り)
- 各サーバーのボリュームのリストが作成され、ボリュームが一致するサーバーに接続されます
現在のモジュール/APIの問題:
サーバーを削除した直後に、そのサーバーに接続されていたボリュームを削除すると、APIはこれらのボリュームがまだサーバーに接続されていると報告し、削除できなくなります。
このロールを実行し、サーバーの状態をabsent
に設定し、サーバーに接続されているボリュームの状態もabsent
に設定すると、こうした問題が発生します。
このロールを取得する
ansible-galaxy install --roles-path ./roles/ siw36.ansible_hcloud_vm
要件
- Pythonモジュール:
hcloud
(このロールは、ユーザーのPythonモジュールディレクトリに自動的にインストールします)
ロール変数
名前 | 説明 | デフォルト値 |
---|---|---|
getInfoOnly | サーバータイプ、イメージ、ロケーションの可能な値を取得します。この変数がtrueに設定されている場合、情報のみが表示されます。 | false |
hcloudBearer | あなたのHetzner Cloud APIキー。SSHキーのタブでプロジェクト内にあります。 | <none - __設定が必要__> |
sshKey | ルートSSHキーに関する情報を含む辞書 | <none - __設定が必要__> |
deployments | デプロイメントとそのディスクのリスト | <none - __設定が必要__> |
変数の指定方法の詳細については、以下の例をご覧ください。
例プレイブック
playbook.yml:
- hosts: localhost
become: false
gather_facts: false
roles:
- siw36.ansible_hcloud_vm
roles/siw36.ansible_hcloud_vm/vars/main.yml
#getInfoOnly: false
hcloudBearer: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
sshKey:
name: root
value: ssh-rsa xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx root
state: present
deployments:
- name: test0.nodes.replicas.io
state: absent # (present|started|stopped|restarted|absent|rebuild)
size: cx11
location: hel1
image: centos-7
backup: false
sshKeys:
- siw
labels:
project: replicas.io
stage: prod
location: helsinki
volumes:
- name: test0.nodes.replicas.io-data0
state: absent # (present|absent)
size: 10
automount: true
format: xfs # (xfs|ext4)
ライセンス
GNU一般公衆ライセンス v3.0
作者情報
作成者: Robin 'siw36' Klussmann (2019年07月)
プロジェクトについて
Role to deploy servers on Hetzner Cloud
インストール
ansible-galaxy install siw36.ansible_hcloud_vm
ライセンス
gpl-3.0
ダウンロード
166
所有者
Platform & DevOps Engineer