1
0

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 1 year has passed since last update.

Ansibleのmountモジュールを使ってEFSをマウントしてみた

Last updated at Posted at 2023-06-21

検証環境

コントロールノード・・・RHバージョン8.6にインストールしたansible 2.9.25を使っています
ターゲットノード ・・・RHバージョン8.6

検証内容

マウントポイントを作成し、以下内容でEFSをマウントする

マウントポイント マウントデバイス fsの種類 マウントオプション
/home/ec2-user/efs_mount EFS nfs4 4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport,_netdev

playbook

オプション 説明
*path マウントポイントのパス
src pathにマウントするデバイス
fstype fsの種類
opts マウントオプション
*state mounted・・・デバイスをマウントし、fstabを変更する
unmounted ・・・fstabを変更せずにデバイスをアンマウントする

※は必須項目

- name: create efs mount point
  file: 
   dest: "/home/ec2-user/efs_mount"
   state: directory

- name: mount efs volume
  mount:
   path: "/home/ec2-user/efs_mount"
   src: "fs-xxxxx.efs.ap-northeast-1.amazonaws.com:/"
   fstype: "nfs4"
   opts: "4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport,_netdev"
   state: mounted

実行結果

image.png

◇ポイント
/etc/fstabに定義が追加される
image.png

参考サイト

1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?