地方エンジニアの学習日記

興味ある技術の雑なメモだったりを書いてくブログ。たまに日記とガジェット紹介。

【Ansible】grusterfsのブリックの設定をansibleでやる。

シェルスクリプトでゴリ押ししてたけど公式が良さげなモジュールを作ってくれていることに気づいた。ブリック関連の作成削除はこっちでやっても良さげかもしれない。

docs.ansible.com

- name: create gluster volume with multiple bricks
  gluster.gluster.gluster_volume:
    state: present
    name: test2
    bricks: /bricks/brick1/g2,/bricks/brick2/g2
    cluster:
      - 192.0.2.10
      - 192.0.2.11
  run_once: true

- name: Remove the bricks from gluster volume
  gluster.gluster.gluster_volume:
    state: present
    name: testvol
    bricks: /bricks/brick1/b1,/bricks/brick2/b2
    cluster:
      - 10.70.42.85
    force: true
  run_once: true

- name: Reduce cluster configuration
  gluster.gluster.gluster_volume:
    state: present
    name: testvol
    bricks: /bricks/brick3/b1,/bricks/brick4/b2
    replicas: 2
    cluster:
      - 10.70.42.85
    force: true
  run_once: true

rebalanceとかプロダクションで使う機会がない限りはやらなそうだけどそこのスケールまでansible一本でやれるのはやっぱ便利そう。(我が家のおもちゃクラスタレベルだったら正直ansibleいらないんだけどねぇ。。)