EX294日本語 無料問題集「RedHat Red Hat Certified Engineer (RHCE) exam for Red Hat Enterprise Linux 8 Exam (EX294日本語版)」
制御ノード control.realmX.example.com に Ansible をインストールして構成します。
次のとおりです。
-------------------------------------------------- ----------------------------------------------
--> 必要なパッケージをインストールします
--> 次のように、/home/admin/ansible/inventory という名前の静的インベントリ ファイルを作成します。
node1.realmX.example.com は dev ホスト グループのメンバーです
node2.realmX.example.com は、テスト ホスト グループのメンバーです。
node3.realmX.example.com & node4.realmX.example.com は prod のメンバーです
ホスト グループ
node5.realmX.example.com は、バランサー ホスト グループのメンバーです。
prod グループは webservers ホスト グループのメンバーです
--> 次のように ansible.cfg という構成ファイルを作成します。
--> ホスト インベントリ ファイル /home/admin/ansible/inventory が定義されています
--> Playbook で使用されるロールの場所は /home/admin/ansible/ roles として定義されます
次のとおりです。
-------------------------------------------------- ----------------------------------------------
--> 必要なパッケージをインストールします
--> 次のように、/home/admin/ansible/inventory という名前の静的インベントリ ファイルを作成します。
node1.realmX.example.com は dev ホスト グループのメンバーです
node2.realmX.example.com は、テスト ホスト グループのメンバーです。
node3.realmX.example.com & node4.realmX.example.com は prod のメンバーです
ホスト グループ
node5.realmX.example.com は、バランサー ホスト グループのメンバーです。
prod グループは webservers ホスト グループのメンバーです
--> 次のように ansible.cfg という構成ファイルを作成します。
--> ホスト インベントリ ファイル /home/admin/ansible/inventory が定義されています
--> Playbook で使用されるロールの場所は /home/admin/ansible/ roles として定義されます
正解:
解決策:
物理ホストを介して、workstation.lab.example.com に root ユーザーでログインします。
# ssh [email protected]
# ホスト名
workstation.lab.example.com
# yum install platform-python*
# su - 管理者
# pwd
/ホーム/管理者/
# vim .vimrc
# mkdir -p ansible/roles
# cd アンシブル
# vimインベントリ
[開発]
servera.lab.example.com
[テスト]
serverb.example.com
[製品]
serverc.example.com
serverd.example.com
【バランサー】
serverd.lab.example.com
[ウェブサーバー:子]
製品
:!wq
# vim ansible.cfg
[デフォルト]
在庫 = ./在庫
role_path = ./役割
remote_user = 管理者
ask_pass = false
[権限エスカレーション]
なる=真
become_method = sudo
become_user = ルート
become_ask_pass = false
:!wq
# ansible all --list-hosts
物理ホストを介して、workstation.lab.example.com に root ユーザーでログインします。
# ssh [email protected]
# ホスト名
workstation.lab.example.com
# yum install platform-python*
# su - 管理者
# pwd
/ホーム/管理者/
# vim .vimrc
# mkdir -p ansible/roles
# cd アンシブル
# vimインベントリ
[開発]
servera.lab.example.com
[テスト]
serverb.example.com
[製品]
serverc.example.com
serverd.example.com
【バランサー】
serverd.lab.example.com
[ウェブサーバー:子]
製品
:!wq
# vim ansible.cfg
[デフォルト]
在庫 = ./在庫
role_path = ./役割
remote_user = 管理者
ask_pass = false
[権限エスカレーション]
なる=真
become_method = sudo
become_user = ルート
become_ask_pass = false
:!wq
# ansible all --list-hosts
以下に従って、すべてのノードで lvm.yml を使用して論理ボリュームを作成します。
要件。
-------------------------------------------------- --------------------------------------
* 「data」という名前の新しい論理ボリュームを作成します
* LV は「研究」ボリューム グループのメンバーである必要があります
※LVサイズは1500Mでお願いします
* ext4 ファイルシステムでフォーマットされている必要があります。
--> ボリューム グループが存在しない場合は、「VG Not found」というメッセージが出力されます。
--> VG が 1500M サイズに対応できない場合は、「LV Can't be
で作成
次のサイズ」の場合、LV は 800M のサイズで作成する必要があります。
--> この LV のマウントは行わないでください。
要件。
-------------------------------------------------- --------------------------------------
* 「data」という名前の新しい論理ボリュームを作成します
* LV は「研究」ボリューム グループのメンバーである必要があります
※LVサイズは1500Mでお願いします
* ext4 ファイルシステムでフォーマットされている必要があります。
--> ボリューム グループが存在しない場合は、「VG Not found」というメッセージが出力されます。
--> VG が 1500M サイズに対応できない場合は、「LV Can't be
で作成
次のサイズ」の場合、LV は 800M のサイズで作成する必要があります。
--> この LV のマウントは行わないでください。
正解:
解決策:
# pwd
/ホーム/管理者/アンシブル
# vim lvm.yml
---
- 名前:
ホスト: すべて
ignore_errors: はい
タスク:
- 名前:
lvol:
lv: データ
vg: 研究
サイズ: "1500"
- デバッグ:
msg: "VG が見つかりません"
場合: ansible_lvm.vgs.research が定義されていません
- デバッグ:
msg: "LV は次のサイズでは作成できません"
いつ: ansible_lvm.vgs.research.size_g < "1.5"
- 名前:
lvol:
lv: データ
vg: 研究
サイズ: "800"
いつ: ansible_lvm.vgs.research.size_g < "1.5"
- 名前:
ファイルシステム:
fstype: ext4
開発者: /dev/research/data
:wq!
# ansible-playbook lvm.yml --syntax-check
# ansible-playbook lvm.yml
# pwd
/ホーム/管理者/アンシブル
# vim lvm.yml
---
- 名前:
ホスト: すべて
ignore_errors: はい
タスク:
- 名前:
lvol:
lv: データ
vg: 研究
サイズ: "1500"
- デバッグ:
msg: "VG が見つかりません"
場合: ansible_lvm.vgs.research が定義されていません
- デバッグ:
msg: "LV は次のサイズでは作成できません"
いつ: ansible_lvm.vgs.research.size_g < "1.5"
- 名前:
lvol:
lv: データ
vg: 研究
サイズ: "800"
いつ: ansible_lvm.vgs.research.size_g < "1.5"
- 名前:
ファイルシステム:
fstype: ext4
開発者: /dev/research/data
:wq!
# ansible-playbook lvm.yml --syntax-check
# ansible-playbook lvm.yml
ansible のインストールと構成
制御ノード上にユーザー sandy が作成されており、適切な権限が既に付与されています。ssh キーを変更または修正しないでください。コントロール ノードで ansible を実行するために必要なパッケージをインストールします。ansible.cfg をフォルダー /home/sandy/ansible/ansible.cfg に配置するように構成し、sandy ユーザーを介してリモート マシンにアクセスするように構成します。すべてのロールはパス /home/sandy/ansible/roles にある必要があります。インベントリ パスは /home/sandy/ansible/invenlory にある必要があります。
5 つのノードにアクセスできます。
node1.example.com
node2.example.com
node3.example.com
node4.example.com
node5.example.com
これらのノードを、ノード I がグループ dev のメンバーであるインベントリ ファイルに配置するように構成します。nodc2 はグループ test のメンバー、node3 はグループ proxy のメンバー、nodc4 とノード 5 はグループ prod のメンバーです。また、prod はグループ webservers のメンバーです。
制御ノード上にユーザー sandy が作成されており、適切な権限が既に付与されています。ssh キーを変更または修正しないでください。コントロール ノードで ansible を実行するために必要なパッケージをインストールします。ansible.cfg をフォルダー /home/sandy/ansible/ansible.cfg に配置するように構成し、sandy ユーザーを介してリモート マシンにアクセスするように構成します。すべてのロールはパス /home/sandy/ansible/roles にある必要があります。インベントリ パスは /home/sandy/ansible/invenlory にある必要があります。
5 つのノードにアクセスできます。
node1.example.com
node2.example.com
node3.example.com
node4.example.com
node5.example.com
これらのノードを、ノード I がグループ dev のメンバーであるインベントリ ファイルに配置するように構成します。nodc2 はグループ test のメンバー、node3 はグループ proxy のメンバー、nodc4 とノード 5 はグループ prod のメンバーです。また、prod はグループ webservers のメンバーです。
正解:
/home/sandy/ansible/ansible.cfg 内
[デフォルト]
inventory=/home/sandy/ansible/inventory
roles_path=/home/sandy/ansible/roles
remote_user=砂
host_key_checking=false
【特典】
なる=真
become_user=ルート
become_method=sudo
become_ask_pass=false
/home/sandy/ansible/inventory 内
[開発]
ノード 1 .example.com
[テスト]
node2.example.com
[プロキシー]
node3 .example.com
[製品]
node4.example.com
node5 .example.com
[ウェブサーバー:子]
製品
[デフォルト]
inventory=/home/sandy/ansible/inventory
roles_path=/home/sandy/ansible/roles
remote_user=砂
host_key_checking=false
【特典】
なる=真
become_user=ルート
become_method=sudo
become_ask_pass=false
/home/sandy/ansible/inventory 内
[開発]
ノード 1 .example.com
[テスト]
node2.example.com
[プロキシー]
node3 .example.com
[製品]
node4.example.com
node5 .example.com
[ウェブサーバー:子]
製品
adhoc コマンドを使用して新しいリポジトリを設定する adhoc.sh というファイルを /home/sandy/ansible に作成します。
リポジトリの名前は「EPEL」、説明は「RHEL8」、ベース URL は「https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rmp」、gpgcheck はありません。ただし、リポジトリを有効にする必要があります。
* アドホック コマンドを使用して bash スクリプトを使用して、リポジトリを有効にできるはずです。
ラボのセットアップによっては、このタスクを完了した後で、このリポジトリを "state=absent" にする必要がある場合があります。
リポジトリの名前は「EPEL」、説明は「RHEL8」、ベース URL は「https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rmp」、gpgcheck はありません。ただし、リポジトリを有効にする必要があります。
* アドホック コマンドを使用して bash スクリプトを使用して、リポジトリを有効にできるはずです。
ラボのセットアップによっては、このタスクを完了した後で、このリポジトリを "state=absent" にする必要がある場合があります。
正解:
chmod 0777 adhoc.sh
vim adhoc.sh
#I/ビン/バッシュ
ansible all -m yum_repository -a 'name=EPEL description=RHEL8
baseurl=https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rmp
gpgcheck=いいえ有効=はい'
vim adhoc.sh
#I/ビン/バッシュ
ansible all -m yum_repository -a 'name=EPEL description=RHEL8
baseurl=https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rmp
gpgcheck=いいえ有効=はい'