Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devel #390

Merged
merged 41 commits into from
Aug 20, 2019
Merged

Devel #390

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
577c57c
Update disable-pool-member.yml
payalsin Aug 13, 2019
3e82673
Merge pull request #377 from payalsin/patch-3
IPvSean Aug 13, 2019
b32dc9a
Update README.ja.md
coral-reaf Aug 14, 2019
73fb2da
Update README.ja.md
coral-reaf Aug 14, 2019
a8c4f96
Update README.ja.md
coral-reaf Aug 14, 2019
edc7e10
Update README.ja.md
coral-reaf Aug 14, 2019
79060fc
Update README.ja.md
coral-reaf Aug 14, 2019
21d3855
Update README.ja.md
coral-reaf Aug 14, 2019
0c37d91
Update README.ja.md
coral-reaf Aug 14, 2019
bba8719
Update README.ja.md
coral-reaf Aug 14, 2019
5a4db43
Update README.ja.md
coral-reaf Aug 14, 2019
3f250d7
Create README.ja.md
coral-reaf Aug 14, 2019
986803e
Add files via upload
coral-reaf Aug 14, 2019
b679d8d
Update README.ja.md
coral-reaf Aug 14, 2019
170d339
Delete dashboard-jp.png
coral-reaf Aug 14, 2019
3651b99
Add files via upload
coral-reaf Aug 14, 2019
0eb624c
Create README.ja.md
coral-reaf Aug 14, 2019
deb4d58
Create README.ja.md
coral-reaf Aug 14, 2019
c06a71a
Create README.ja.md
coral-reaf Aug 14, 2019
40491c3
Create README.ja.md
coral-reaf Aug 14, 2019
399b285
Create README.ja.md
coral-reaf Aug 14, 2019
5ab630b
Create README.ja.md
coral-reaf Aug 14, 2019
7ccfe21
Update README.ja.md
coral-reaf Aug 14, 2019
2ba9a7a
Update README.ja.md
coral-reaf Aug 14, 2019
f70e562
Update README.ja.md
coral-reaf Aug 14, 2019
59436ca
Update README.ja.md
coral-reaf Aug 14, 2019
4725f58
Update README.ja.md
coral-reaf Aug 14, 2019
9a40669
Update README.ja.md
coral-reaf Aug 14, 2019
8ba4a9a
Update README.ja.md
coral-reaf Aug 14, 2019
c0f3eca
Update README.ja.md
coral-reaf Aug 14, 2019
4acdb10
Update README.ja.md
coral-reaf Aug 14, 2019
1abf867
Update README.ja.md
coral-reaf Aug 14, 2019
8f1839c
Update README.ja.md
coral-reaf Aug 14, 2019
2555b2b
Update README.ja.md
coral-reaf Aug 14, 2019
27bd9f7
Merge pull request #379 from coral-reaf/devel
IPvSean Aug 14, 2019
6189c5e
adding error checking for when route53 has issues
IPvSean Aug 14, 2019
53354c9
Tower: Bump to version 3.5.2
Spredzy Aug 15, 2019
a52461e
pipeline.groovy: Ensure ANSIBLE_FORCE_COLOR to improve readability
Spredzy Aug 19, 2019
be89c9f
Fixes #375
liquidat Aug 19, 2019
29bd30a
Merge pull request #385 from IPvSean/gh-pages
IPvSean Aug 20, 2019
52f2fbd
Merge pull request #389 from liquidat/fix_375
IPvSean Aug 20, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
name: "{{item.split(':')[0]}}"
pool: "{{pool_name}}"
port: "{{item.split(':')[1]}}"
host: "{{hostvars[item.split(':')[0]].ansible_host}}"
loop: "{{bigip_facts.ltm_pools | json_query(query_string)}}"
vars:
query_string: "[?name=='{{pool_name}}'].members[*].name[]"
Expand All @@ -62,4 +63,5 @@
name: "{{member_name.user_input.split(':')[0]}}"
pool: "{{pool_name}}"
port: "{{member_name.user_input.split(':')[1]}}"
host: "{{hostvars[member_name.user_input.split(':')[0]].ansible_host}}
when: '"all" not in member_name.user_input'
16 changes: 7 additions & 9 deletions exercises/ansible_rhel/1.1-setup/README.ja.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Exercise 1.1 - 要件を確認してみよう

**Read this in other languages**: ![uk](../../../images/uk.png) [English](README.md), ![japan](../../../images/japan.png) [日本語](README.ja.md).

## ラボ環境について

このラボでは、事前設定されたラボ環境で作業します。 以下のホストにアクセスできます。
Expand All @@ -18,13 +16,13 @@
SSHでログインできます。:

> **Warning**
>
>
> **11.22.33.44** のような文字列を、個々に提供されているStudent情報に記載の **IP** などへ読み替えてください。 **X** は student**X** といった具合です.

ssh studentX@11.22.33.44

> **Tip**
>
>
> パスワードは **ansible** です。

rootになるには以下のように実行してください。:
Expand All @@ -46,7 +44,7 @@ Ansibleが適切にInstallされているかを確認しましょう。
[...]

> **Note**
>
>
> Ansibleは構成管理を単純にしてくれます。 Ansibleはデータベースや実行用のデーモンを必要とせず、ラップトップでも簡単に実行できます。 管理対象ホストでは、実行用の常駐エージェントなども不要です。

rootアカウントからログアウトします。
Expand All @@ -55,7 +53,7 @@ rootアカウントからログアウトします。
logout

> **Note**
>
>
> 以降のすべての演習では、明示的な指示がない限り、コントロールノードのstudent\<X\> ユーザーとして作業してください。

## Step 1.2 - Working the Labs
Expand All @@ -65,15 +63,15 @@ rootアカウントからログアウトします。
- すべて手で入力するのではなく、必要に応じてブラウザからコピー&ペーストしてください。しかし、考えたり理解したりするのをやめたりしないでください。

- すべてのラボは **Vim** を使って準備しましたが、みんながそれを愛しているわけではないことを理解しています。 **Midnight Commander** などを利用することができます。(**mc**を 実行すると実行できます。ファンクションキーはEsc-\<n\>でアクセスするかマウスでクリックすることでアクセスできます。)。または **Nano**(**nano**を実行)なども利用できます。 簡単な[editor intro]も用意してあります。(../ 0.0-support-docs / editor_intro.md)



## Step 1.3 - チャレンジLabs

このラボガイドの様々な章で「チャレンジラボ」セクションがあります。
このラボガイドの様々な章で「チャレンジラボ」セクションがあります。
これらのラボは、これまでに学んだことを使って解決するための様々なタスクを用意しています。
それぞれのラボの解答案は、`Warning`サインより下に記述されています。

----

[Click here to return to the Ansible for Red Hat Enterprise Linux Workshop](../README.ja.md#section-1---ansible-engine-exercises)
[Ansible Engine ワークショップ表紙に戻る](../README.ja.md#section-1---ansible-engineの演習)
6 changes: 3 additions & 3 deletions exercises/ansible_rhel/1.2-adhoc/README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,11 @@ node1 | CHANGED => {
node1 | CHANGED | rc=0 >>
Managed by Ansible
```
`ansible node1 -m copy …`コマンドを再実行してみてください。以下の点に着目してみてください:
`ansible node1 -m copy …?`コマンドを再実行してみてください。以下の点に着目してみてください:

- 出力結果は、異なる色だったはずです。(適切な端末の設定がされている場合)
- `"changed": true,` から `"changed": false,`へ変更されたはずです。
- 最初の行が、`SUCCESS` から `CHANGED`に変わったはずです。
- 最初の行が、`CHANGED` から `SUCCESS`に変わったはずです。

> **Tip**
>
Expand Down Expand Up @@ -311,4 +311,4 @@ Managed by Ansible

----

[Ansible ワークショップ表紙に戻る](../README.ja.md)
[Ansible Engine ワークショップ表紙に戻る](../README.ja.md#section-1---ansible-engineの演習)
6 changes: 3 additions & 3 deletions exercises/ansible_rhel/1.3-playbook/README.ja.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Exercise 1.3 - 初めてのplaybookを書いてみよう
# Exercise 1.3 - 初めての Playbook 作成

**Read this in other languages**: ![uk](../../../images/uk.png) [English](README.md), ![japan](../../../images/japan.png) [日本語](README.ja.md).

Expand Down Expand Up @@ -201,7 +201,7 @@ Playbookの次のパートでは、確かにApache Webserverが`node1`上で有

出力された結果をみてみてください。
いくつかのタスクは緑色で"OK"と記載され、1つだけ黄色で"changed"と表示されているはずです。
- もう一度、AnsibleのAd-Hocコマンドw用いてApacheが有効になっておりかつ起動していることを確認します。例えば、`systemctl status httpd`などを実行しましょう。
- もう一度、AnsibleのAd-Hocコマンドを用いてApacheが有効になっておりかつ起動していることを確認します。例えば、`systemctl status httpd`などを実行しましょう。

- Playbookをもう一度実行して、出力結果が変わる様に慣れてみましょう。

Expand Down Expand Up @@ -325,4 +325,4 @@ Playbookを実行してみましょう:

----

[Ansible ワークショップ表紙に戻る](../README.ja.md#section-1---ansible-engine-exercises)
[Ansible Engine ワークショップ表紙に戻る](../README.ja.md#section-1---ansible-engineの演習)
30 changes: 14 additions & 16 deletions exercises/ansible_rhel/1.4-variables/README.ja.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# 演習1.4 - 変数を使ってみよう

**Read this in other languages**: ![uk](../../../images/uk.png) [English](README.md), ![japan](../../../images/japan.png) [日本語](README.ja.md).

前回までは Ansible Engine の基礎部分を学習してきました。この演習では Playbook をより柔軟かつパワフルに使用できる、より高度なスキルを学びます。

Ansible では task をよりシンプル、かつ再利用可能にできます。システムの設定にはユニークな設定が含まれる場合があり、
Expand All @@ -27,7 +25,7 @@ Playbook では、変数名を二重中括弧で囲むことで変数を表現


> **ヒント**
>
>
> ホスト変数には優先順位があります。上記 Host 変数は、 Group 変数より優先されます。詳しくは製品マニュアルをご確認ください。

## ステップ 1.4.1 - 変数ファイルの作成
Expand Down Expand Up @@ -61,7 +59,7 @@ stage: prod

- `web` group のすべてのサーバーに対して、変数 `stage` に値 `dev` が定義されます。そして dev (開発)をデフォルト値として定義します。

- `node2` に関しては、上記で定義された変数 stage = dev が、prod で上書きされます。本番環境として定義されます。
- `node2` に関しては、上記で定義された変数 stage = dev が、prod で上書きされます。本番環境として定義されます。

## ステップ 1.4.2 - index.html ファイルの作成

Expand Down Expand Up @@ -90,7 +88,7 @@ stage: prod
`deploy_index_html.yml` という名前の Playbook を `~/ansible-files/` ディレクトリ内に作成します。

> **ヒント**
>
>
> コピーするファイル名の中に指定された変数 "stage" がホストごとに取る値に注意してください。

<!-- {% raw %} -->
Expand Down Expand Up @@ -118,7 +116,7 @@ stage: prod
各ホストには、変数 stage の値に従って異なるファイルがコピーされているはずです。デフォルトが dev で、node2 のみ、prod となっているはず。それぞれのweb server に curl コマンド(もしくはブラウザ)で接続して確認してみましょう。

```bash
[student<X>@ansible ansible-files]$ grep node /home/student<X>/lightbulb/lessons/lab_inventory/student<X>-instances.txt
[student<X>@ansible ansible-files]$ grep node ~/lab_inventory/hosts
node1 ansible_host=11.22.33.44
node2 ansible_host=22.33.44.55
node3 ansible_host=33.44.55.66
Expand All @@ -137,7 +135,7 @@ node3 ansible_host=33.44.55.66
```

> **ヒント**
>
>
> 鋭い人はちょっと思うかもしれません、”もっと柔軟にファイルの中身を変更出来たら・・・、と”。こちらについては次の章(template モジュール)で学びます!

## ステップ 1.4.5 - Ansible ファクト
Expand Down Expand Up @@ -166,10 +164,10 @@ Ansibleがデフォルトでどのような事実を収集しているのか、
- 管理対象ホストのディストリビューション(Red Hat)を表示してください。ただし、結果は一行で出力してください。

> **ヒント**
>
>
> grep を使ってファクトの中から必要な情報を探してみます。次に、 filter を使ってこのファクトのみの情報を抽出してみましょう。一行での表示の方法は ansible コマンドの -h (help) を使って調べてみましょう!


> **答えは下記の通り\!**

```bash
Expand All @@ -194,13 +192,13 @@ Ansibleがデフォルトでどのような事実を収集しているのか、
<!-- {% endraw %} -->

> **ヒント**
>
>
> "debug" モジュールは変数や式を確認するのに有用です。

取得されたファクトがどのような形で表示されるか Playbook を実行してみてください。

```bash
[student<X>@ansible ansible-files]$ ansible-playbook facts.yml
[student<X>@ansible ansible-files]$ ansible-playbook facts.yml

PLAY [Output facts within a playbook] ******************************************

Expand All @@ -211,13 +209,13 @@ ok: [node1]
ok: [ansible]

TASK [Prints Ansible facts] ****************************************************
ok: [node1] =>
ok: [node1] =>
msg: The default IPv4 address of node1 is 172.16.190.143
ok: [node2] =>
ok: [node2] =>
msg: The default IPv4 address of node2 is 172.16.30.170
ok: [node3] =>
ok: [node3] =>
msg: The default IPv4 address of node3 is 172.16.140.196
ok: [ansible] =>
ok: [ansible] =>
msg: The default IPv4 address of ansible is 172.16.2.10

PLAY RECAP *********************************************************************
Expand All @@ -229,4 +227,4 @@ node3 : ok=2 changed=0 unreachable=0 failed=0

----

[Ansible ワークショップ表紙に戻る](../README.ja.md)
[Ansible Engine ワークショップ表紙に戻る](../README.ja.md#section-1---ansible-engineの演習)
29 changes: 14 additions & 15 deletions exercises/ansible_rhel/1.5-handlers/README.ja.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# 演習 1.5 - 条件分岐, ハンドラー、ループ実行

**Read this in other languages**: ![uk](../../../images/uk.png) [English](README.md), ![japan](../../../images/japan.png) [日本語](README.ja.md).
# 演習 1.5 - 条件分岐, ハンドラー、ループを使う

## ステップ 1.5.1 - 条件分岐

Expand All @@ -26,8 +24,8 @@ Ansible は特定の条件が満たされたときにタスクを実行したり

では早速やってみましょう。まず、デフォルトで指定されたインベントリファイル編集し、`ftpserver` グループに `node2` を入れます。
デフォルトのインベントリファイルは、
`/home/student<X>/lightbulb/lessons/lab_inventory/student<X>-instances.txt` でしたね。♪

`~/lab_inventory/hosts` でしたね。♪
編集後は以下の様になります。node2 のIPアドレスはご自身ものを入力してください!

```ini
Expand Down Expand Up @@ -64,7 +62,7 @@ ansible ansible_host=44.55.66.77
```

> **ヒント**
>
>
> 作成完了したら playbook を実行してみてください。やり方は・・・、もう分かってますね (^^♪

実行した結果を確認してみてください。 `ftpserver` グループに記載された node2 以外のホストはタスクがスキップされ、node2 のみタスクの実行が行われていることが確認できます。
Expand Down Expand Up @@ -93,13 +91,13 @@ changed: [node2]
まずはコピー元として利用する httpd.conf を node1 から取得します。

> **ヒント**
>
>
>このファイルは既に node1 node2 node3 に配置されています。


```bash
[student<X>@ansible ansible-files]$ scp <node1>:/etc/httpd/conf/httpd.conf ~/ansible-files/.
student<X>@<node1>'s password:
student<X>@<node1>'s password:
httpd.conf
```

Expand Down Expand Up @@ -140,9 +138,9 @@ Listen 8080
```

- Playbookをもう一度実行してください。興味深い結果が得られます。

- httpd.conf が上書きコピーされた

- ハンドラーが呼び出され、 Apache サービスをリスタートした

Apacheはポート8080でリッスンしているはずです。試してみてください。
Expand All @@ -158,17 +156,17 @@ curl: (7) Failed connect to <node1>:80; Connection refused
httpd.conf ファイルを再度 "80" に変更し、どうなるか試してみてください。

> **注意**
>
>
> 演習1.7で、ポート8080を使います。この時点で 80ポートをリッスンするよう設定を戻しておいてください。


> **ヒント**
>
>
> よく聞かれる質問として、notify セクションが実行されたらすぐにハンドラーが呼び出されるのか?ということがありますが、これは違います。今回の場合、notify 直下にハンドラーが定義されているのですぐの実行となりますが、notiry とハンドラーが離れていた場合は、あくまで上から順に実行され、ハンドラーの順番になったところで実行されます。 notify でハンドラー実行のフラグを立てておく感じです。

## ステップ 1.5.3 - 単純な繰り返し(ループ実行)

ループを使用すると、同じタスクを繰り返し実行することができます。たとえば、複数のユーザーを作成したいとしましょう。Ansible ループを使用すると、単一のタスクでそれを実行できます。ループは、単なるリスト以外にも反復することができます。たとえば、対応するグループを持つユーザーのリストがある場合、ループはそれらに対しても反復することができます。 詳しくはマニュアルをご確認ください [Ansible Loops](https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html)
ループを使用すると、同じタスクを繰り返し実行することができます。たとえば、複数のユーザーを作成したいとしましょう。Ansible ループを使用すると、単一のタスクでそれを実行できます。ループは、単なるリスト以外にも反復することができます。たとえば、対応するグループを持つユーザーのリストがある場合、ループはそれらに対しても反復することができます。 詳しくはマニュアルをご確認ください [Ansible Loops](https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html)

ループの機能を確認してみましょう。 node1 に3人の新しいユーザーを作成します。 `~/ansible-files` ディレクトリの中に、 `loop_users.yml` という名前の playbook を作成します。使用するのは `user` モジュールで、playbook の中身は以下の通りです。

Expand Down Expand Up @@ -240,7 +238,7 @@ httpd.conf ファイルを再度 "80" に変更し、どうなるか試してみ

- 再度タスクが一覧表示されます。ただし、3つの変更が表示されます。その内容を含む各ループが表示されます。

node1 内に `prod_user` がグループ `ftp` で作成されていることを確認します。
node1 内に `dev_user` がグループ `ftp` で作成されていることを確認します。

```bash
[student<X>@ansible ansible-files]$ ansible node1 -m command -a "id dev_user"
Expand All @@ -250,4 +248,5 @@ uid=1002(dev_user) gid=1002(dev_user) Gruppen=1002(dev_user),50(ftp)

----

[Ansible ワークショップ表紙に戻る](../README.ja.md)
[Ansible Engine ワークショップ表紙に戻る](../README.ja.md#section-1---ansible-engineの演習)

2 changes: 2 additions & 0 deletions exercises/ansible_rhel/1.5-handlers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,13 @@ To show the loops feature we will generate three new users on `node1`. For that,

Understand the playbook and the output:

<!-- {% raw %} -->
- The names are not provided to the user module directly. Instead, there is only a variable called `{{ item }}` for the parameter `name`.

- The `loop` keyword lists the actual user names. Those replace the `{{ item }}` during the actual execution of the playbook.

- During execution the task is only listed once, but there are three changes listed underneath it.
<!-- {% endraw %} -->

## Step 5.4 - Loops over hashes

Expand Down
11 changes: 5 additions & 6 deletions exercises/ansible_rhel/1.6-templates/README.ja.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# 演習 1.6 - テンプレート

**Read this in other languages**: ![uk](../../../images/uk.png) [English](README.md), ![japan](../../../images/japan.png) [日本語](README.ja.md).
# 演習 1.6 - テンプレートを使う

Ansibleは、管理対象ホストにファイルをコピーする際、固定の内容ではなく変数に値を入力しながらコピーを行う様な事も可能です。例えば対象ホストユニークなホスト名などを含んだファイルのコピーを行うことが可能です。これを実現するのが Jinja2 テンプレートです。 Jinja2 は、Python で最も使用されているテンプレートエンジンの1つです。 (<http://jinja.pocoo.org/>)

Expand Down Expand Up @@ -57,15 +55,15 @@ Ansibleが変数をシステムから収取したファクト情報で変数を
- 「Ansible ファクト」の章で学んだコマンドを使用して、カーネルバージョンを含むファクトを見つけます。

> **ヒント**
>
>
> モジュールは `setup` ですね? `grep` 使って探してみましょう。

- 見つかったらその変数を表示するよう、テンプレートファイルに追記しましょう

- 再度 playbook を実行します

- 再度 node1 にログインし、表示をチェックしてみてください


> **答えは以下の通り**

Expand Down Expand Up @@ -94,4 +92,5 @@ running kernel {{ ansible_kernel }}.

----

[Ansible ワークショップ表紙に戻る](../README.ja.md)
[Ansible Engine ワークショップ表紙に戻る](../README.ja.md#section-1---ansible-engineの演習)

Loading