Skip to content

Commit

Permalink
Merge pull request #982 from ansible/devel
Browse files Browse the repository at this point in the history
Oct 1, 2020 Release PR
  • Loading branch information
IPvSean authored Oct 1, 2020
2 parents 73a0cba + 6a033fe commit c2d3811
Show file tree
Hide file tree
Showing 20 changed files with 256 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ cd ansible_collections/redhat/workshop_demo_collection
mkdir plugins/modules
```
Create the `demo_hello.py` module in the the new folder. The module code is available in the `solutions/modules`
Create the `demo_hello.py` module in the new folder. The module code is available in the `solutions/modules`
folder of this exercise.
```bash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ When using Ansible Collections in your Playbook, there are no additional options
# Troubleshooting
Since Red Hat Ansible Tower does only check for updates in the the repository in which you stored your Playbook, it might not do a refresh if there was a change in the Ansible Collection used by your Playbook. This happens particularly if you also combine Roles and Collections.
Since Red Hat Ansible Tower does only check for updates in the repository in which you stored your Playbook, it might not do a refresh if there was a change in the Ansible Collection used by your Playbook. This happens particularly if you also combine Roles and Collections.
In this case you should check the option **Delete on Update** which will delete the entire local directory during a refresh.
Expand Down
11 changes: 6 additions & 5 deletions exercises/ansible_f5/1.4-add-pool-members/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,12 @@ Enter the following:
- name: Query BIG-IP facts
bigip_device_info:
server: "{{private_ip}}"
user: "{{ansible_user}}"
password: "{{ansible_ssh_pass}}"
server_port: "8443"
validate_certs: "no"
provider:
server: "{{private_ip}}"
user: "{{ansible_user}}"
password: "{{ansible_ssh_pass}}"
server_port: "8443"
validate_certs: "no"
gather_subset:
- ltm-pools
register: bigip_device_facts
Expand Down
2 changes: 1 addition & 1 deletion exercises/ansible_f5/4.2-tower-workflow/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Here is one example of templates: **Create node**:

2. Click on the green ![templates link](images/add.png) button. Select the **Workflow Template**.

3. Fill out the the form as follows:
3. Fill out the form as follows:

| Parameter | Value |
|---|---|
Expand Down
2 changes: 1 addition & 1 deletion exercises/ansible_f5/4.3-tower-workflow2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Here is one example of the templates configured:

2. Click on the green ![templates link](images/add.png) button. Select the **Workflow Template**.

3. Fill out the the form as follows:
3. Fill out the form as follows:

| Parameter | Value |
|---|---|
Expand Down
2 changes: 1 addition & 1 deletion exercises/ansible_network/9-tower-workflow/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ For this exercise we will create a time-stamped backup, if the backup job succes

3. Click on the green **+** button. Select the **Workflow Template**.

4. Fill out the the form as follows:
4. Fill out the form as follows:

| Parameter | Value |
|---|---|
Expand Down
2 changes: 1 addition & 1 deletion exercises/ansible_rhel/2.2-cred/README.es.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Workshop - Inventarios, credenciales y comandos ad hoc

**Lee esto en otros idiomas**:
<br>![uk](../../../images/uk.png) [English](README.md), ![france](../../../images/fr.png) [Française](README.fr.md),![Español](../../../images/col.png) [Español](README.es.md).
<br>![uk](../../../images/uk.png) [English](README.md),![japan](../../../images/japan.png)[日本語](README.ja.md),![france](../../../images/fr.png) [Française](README.fr.md),![Español](../../../images/col.png) [Español](README.es.md).


## Tabla de contenidos
Expand Down
2 changes: 1 addition & 1 deletion exercises/ansible_rhel/2.2-cred/README.fr.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Atelier - Les inventaires, identifications et commandes Ad-hoc

**Lisez ceci dans d'autres langues**:
<br>![uk](../../../images/uk.png) [English](README.md), ![france](../../../images/fr.png) [Française](README.fr.md),![Español](../../../images/col.png) [Español](README.es.md).
<br>![uk](../../../images/uk.png) [English](README.md),![japan](../../../images/japan.png)[日本語](README.ja.md),![france](../../../images/fr.png) [Française](README.fr.md),![Español](../../../images/col.png) [Español](README.es.md).

## Table des matières

Expand Down
197 changes: 197 additions & 0 deletions exercises/ansible_rhel/2.2-cred/README.ja.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
# 演習 - インベントリ、認証情報、Ad Hoc コマンド

**Read this in other languages**:
<br>![uk](../../../images/uk.png) [English](README.md),![japan](../../../images/japan.png)[日本語](README.ja.md),![france](../../../images/fr.png) [Française](README.fr.md),![Español](../../../images/col.png) [Español](README.es.md).

## 目次

* [目的](#目的)
* [ガイド](#ガイド)
* [インベントリを調べる](#インベントリを調べる)
* [マシンの資格情報を調べる](#マシンの資格情報を調べる)
* [Ad Hoc コマンドを実行する](#Ad-Hoc-コマンドを実行する)
* [チャレンジ Lab: Ad Hoc コマンド](#チャレンジ-Lab-Ad-Hoc-コマンド)

# 目的

この演習では、Lab 環境を探索して理解します。
- 項目と理解:
- Ansible Tower [**Inventory**](https://docs.ansible.com/ansible-tower/latest/html/userguide/inventories.html)
- Ansible Tower [**Credentials**](https://docs.ansible.com/ansible-tower/latest/html/userguide/credentials.html)
- Ansible Tower Web UIを介した Ad Hoc コマンドの実行

# ガイド

## インベントリを調べる

最初に必要なのは、管理対象ホストの一覧です。これは、Ansible Engineのインベントリファイルに相当します。動的インベントリのように、それ以外にもたくさんありますが、基本から始めましょう。

- すでに Web UI を開いているはずですが、開いていない場合は **https://student\<X\>.workshopname.rhdemo.io** ("\<X\>"を学生番号に、"workshopname" を現在のワークショップ名に置き換えてください) のように URL をブラウザで指定して、`admin` としてログインしてください。パスワードは講師が教えてくれます。

**Workshop Inventory** が1つあります。**Workshop Inventory** をクリック後、**ホスト** ボタンをクリックします。

`~/lab_inventory/hosts` のインベントリ情報は、プロビジョニングプロセスの一部として Ansible Tower Inventory に事前にロードされています。

```bash
$ cat ~/lab_inventory/hosts
[all:vars]
ansible_user=student<X>
ansible_ssh_pass=PASSWORD
ansible_port=22

[web]
node1 ansible_host=22.33.44.55
node2 ansible_host=33.44.55.66
node3 ansible_host=44.55.66.77

[control]
ansible ansible_host=11.22.33.44
```
> **警告**
>
> あなたのインベントリの IP アドレスは異なります。
## マシンの資格情報を調べる

ここでは、Tower から管理ホストにアクセスするための資格情報を調べてみましょう。 この Ansible Workshop のプロビジョニングプロセスの一部として、**Workshop Credential** はすでに設定されています。

**リソース** メニューで、**資格情報** を選択します。その後、**Workshop Credential** をクリックします。

Note the following information:

<table>
<tr>
<th>パラメータ</th>
<th>値</th>
</tr>
<tr>
<td>Credential Type</td>
<td><code>Machine</code>- マシン資格情報は、プレイブックの ssh およびユーザレベルの特権エスカレーションアクセスを定義します。これらは、リモートホスト上でプレイブックを実行するためにジョブを送信するときに使用されます</td>
</tr>
<tr>
<td>username</td>
<td><code>ec2-user</code> これは他の linux ノードのコマンドライン Ansible インベントリのユーザ名と一致します</td>
</tr>
<tr>
<td>SSH PRIVATE KEY</td>
<td><code>ENCRYPTED</code> - Ansible Tower に SSH 秘密鍵を渡すと、実際には調べられないことに注意してください</td>
</tr>
</table>

## Ad Hoc コマンドを実行する

Ansible Tower から Ad Hoc コマンドを実行することも可能です。

- Web UI で **リソース → インベントリ → Workshop Inventory** に移動します。

- **ホスト** ボタンをクリックし、ホストビューに切り替え、ホストエントリの左側にあるボックスをチェックして3つのホストを選択します。

- **コマンドの実行** をクリックします。 次の画面で、Ad Hoc コマンドを指定する必要があります:

<table>
<tr>
<th>パラメータ</th>
<th>値</th>
</tr>
<tr>
<td>MODULE</td>
<td>ping</td>
</tr>
<tr>
<td>MACHINE CREDENTIAL</td>
<td>Workshop Credentials</td>
</tr>
</table>

- **起動** をクリックし、出力を確認します。

<hr>

シンプルな **ping** モジュールはオプションを必要としません。他のモジュールでは、実行するコマンドを引数として指定する必要があります。**command** モジュールを試し、Ad Hoc コマンドを使用して実行中のユーザーの user ID を見つけます。

<table>
<tr>
<th>パラメータ</th>
<th>値</th>
</tr>
<tr>
<td>MODULE</td>
<td>command</td>
</tr>
<tr>
<td>ARGUMENTS</td>
<td>id</td>
</tr>
</table>

> **ヒント**
>
> 実行するモジュールを選択した後、"Arguments" の横にある疑問符をクリックすると、Tower はモジュールのドキュメントページへのリンクを提供します。これは便利ですので試してみてください。
<hr>

システムから秘密の情報を取得しようとするとどうでしょうか? */etc/shadow* を出力してみてください。

<table>
<tr>
<th>パラメータ</th>
<th>値</th>
</tr>
<tr>
<td>MODULE</td>
<td>command</td>
</tr>
<tr>
<td>ARGUMENTS</td>
<td>cat /etc/shadow</td>
</tr>
</table>


> **警告**
>
> **エラーが発生します!**
おっと、最後の1つはうまくいかず、すべて赤でした。

最後のアドホックコマンドを再実行しますが、今度は **ENABLE PRIVILEGE ESCALATION** チェックボックスをオンにします。

ごらんの通り、今回は実行できました。rootとして実行する必要があるタスクの場合は、特権を昇格させる必要があります。これは Ansible playbook で使用されている **become: yes** と同じです。

## チャレンジ Lab: Ad Hoc コマンド

さて、小さなチャレンジ: Ad Hoc コマンドを実行して "tmux" パッケージがすべてのホストにインストールされていることを確認します。もし不明な場合は、上記の Web UI を利用、もしくは `[ansible@tower ~]$ ansible-doc yum` コマンドを Tower コントロールホストで実行し、ドキュメントを参照してください。

> **警告**
>
> **以下は解答です!**
<table>
<tr>
<th>パラメータ</th>
<th>値</th>
</tr>
<tr>
<td>yum</td>
<td>command</td>
</tr>
<tr>
<td>ARGUMENTS</td>
<td>name=tmux</td>
</tr>
<tr>
<td>ENABLE PRIVILEGE ESCALATION</td>
<td>✓</td>
</tr>
</table>

> **ヒント**
>
> コマンドの黄色の出力は、Ansibleが実際に何かを実行したことを示しています(ここでは、パッケージをインストールする必要がありました)。アドホックコマンドをもう一度実行すると、出力が緑色になり、パッケージが既にインストールされていることが通知されます。Ansible の黄色は、「注意してください」という意味ではありません... ;-)
----
**ナビゲーション**
<br>
[前の演習](../2.1-intro/README.ja.md) - [次の演習](../2.3-projects/README.ja.md)

[ここをクリックして Ansible for Red Hat Enterprise Linux Workshop に戻ります](../README.ja.md#Section-2---Ansible-Towerの演習)
2 changes: 1 addition & 1 deletion exercises/ansible_rhel/2.2-cred/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Workshop Exercise - Inventories, credentials and ad hoc commands

**Read this in other languages**:
<br>![uk](../../../images/uk.png) [English](README.md), ![france](../../../images/fr.png) [Française](README.fr.md),![Español](../../../images/col.png) [Español](README.es.md).
<br>![uk](../../../images/uk.png) [English](README.md),![japan](../../../images/japan.png)[日本語](README.ja.md),![france](../../../images/fr.png) [Française](README.fr.md),![Español](../../../images/col.png) [Español](README.es.md).

## Table of Contents

Expand Down
4 changes: 2 additions & 2 deletions exercises/ansible_rhel/2.6-workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ Set up the workflow. Workflows are configured in the **Templates** view, you mig

![workflow add](images/workflow_add.png)

- Go to the **Templates** view and click the the green plus button. This time choose **Workflow Template**
- Go to the **Templates** view and click the green plus button. This time choose **Workflow Template**

<table>
<tr>
Expand Down Expand Up @@ -289,7 +289,7 @@ After saving the template the **Workflow Visualizer** opens to allow you to buil

Your workflow is ready to go, launch it.

- Click the blue **LAUNCH** button directly or go to the the **Templates** view and launch the **Deploy Webapp Server** workflow by clicking the rocket icon.
- Click the blue **LAUNCH** button directly or go to the **Templates** view and launch the **Deploy Webapp Server** workflow by clicking the rocket icon.

![launch](images/launch.png)

Expand Down
2 changes: 1 addition & 1 deletion exercises/ansible_rhel/README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Ansibleのベストプラクティスもあわせてご覧ください:
## Section 2 - Ansible Towerの演習

- [演習 2.1 - Tower の紹介](2.1-intro/README.ja.md)
- 演習 2.2 - インベントリー、認証情報、アドホックコマンド - not translated
- [演習 2.2 - インベントリ、認証情報、Ad Hoc コマンド](2.2-cred/README.ja.md)
- [演習 2.3 - プロジェクトとジョブテンプレート](2.3-projects/README.ja.md)
- [演習 2.4 - Survey 機能](2.4-surveys/README.ja.md)
- [演習 2.5 - ロールベースのアクセス制御](2.5-rbac/README.ja.md)
Expand Down
2 changes: 1 addition & 1 deletion exercises/ansible_security/1.3-snort/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ Next we need to add the variables required by our playbook. The role we are usin
ids_provider: snort
```
Next, we need to add the tasks. Tasks are the the components which make the actual changes on the target machines. Since we are using a role, we can simply use a single step in our tasks, `include_role`, to add it to our playbook. In order to make the role suitable for our use case, we add the following task-specific variables:
Next, we need to add the tasks. Tasks are the components which make the actual changes on the target machines. Since we are using a role, we can simply use a single step in our tasks, `include_role`, to add it to our playbook. In order to make the role suitable for our use case, we add the following task-specific variables:
- the actual rule
- the Snort rules file
Expand Down
2 changes: 1 addition & 1 deletion exercises/ansible_security/2.2-threat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ Log out of Tower, and log back in as user `analyst`. In the **Templates** sectio
- **Roll back all changes**
- **Send IDPS logs to QRadar**

Only the two **Accept...** job templates belong the the analyst, and can be modified or for example deleted as inidcated by the little garbage can icon. The job template **Send IDPS logs to QRadar** is provided by the IDPS team solely for execution rights, and thus cannot be modified or removed - only executed. That way the right to execute automation is provided across team boundaries - while the right to modify or change it stays with the team which has the domain knowledge, here the IDPS team. Also note the credentials: accessing the IDPS requires SSH keys. They are referenced in the job template, but the user analyst cannot look up their content in the **Credentials** section of Tower. This way a separation of right to execute the automation from the right to access the target machine is ensured.
Only the two **Accept...** job templates belong the analyst, and can be modified or for example deleted as indicated by the little garbage can icon. The job template **Send IDPS logs to QRadar** is provided by the IDPS team solely for execution rights, and thus cannot be modified or removed - only executed. That way the right to execute automation is provided across team boundaries - while the right to modify or change it stays with the team which has the domain knowledge, here the IDPS team. Also note the credentials: accessing the IDPS requires SSH keys. They are referenced in the job template, but the user analyst cannot look up their content in the **Credentials** section of Tower. This way a separation of right to execute the automation from the right to access the target machine is ensured.

Execute now both job templates **Accept IDPS logs in QRadar** and **Send IDPS logs to QRadar** by pressing the little rocket icon next to the job templates.

Expand Down
1 change: 1 addition & 0 deletions provisioner/group_vars/all/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ valid_security_console_types:
- splunk
- qradar
ibm_community_grid: true
create_cluster: false
16 changes: 15 additions & 1 deletion provisioner/roles/aws_check_setup/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,22 @@
region: "{{ec2_region}}"
register: az_names

- name: Remove any AZs in the aws_az_deny_list when defined
set_fact:
availability_zones: >-
{{ az_names.availability_zones | json_query(__filter_query) }}
vars:
__filter_query: >-
[?!contains(`{{ (aws_az_deny_list | default([])) | to_json }}`, zone_name)]
- name: Output AWS Availability Zones (AZs)
debug:
var: availability_zones
verbosity: 2

- name: SET AZ ZONE TO FIRST AVAILABLE
set_fact: ec2_az={{az_names.availability_zones[0].zone_name}}
set_fact:
ec2_az: "{{ availability_zones[0].zone_name }}"

- name: grab information about AWS user
aws_caller_info:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,9 @@ $("document").ready(function(){
{% if workshop_type in ['network', 'f5'] %}
<h2>Network Automation Workshops</h2>
<p>These workshops are focused on networking platforms like Arista, Cisco, Juniper and F5.</p>
{% elif create_cluster|bool and workshop_type == "rhel" %}
<h2>Ansible Tower Advanced Workshops</h2>
<p>These workshops are focused on using advanced features of Ansible Tower like clustering.</p>
{% elif workshop_type in ['rhel'] %}
<h2>Ansible Automation Workshops</h2>
<p>These workshops are focused on getting started with Ansible Engine and Ansible Tower in automating Linux platforms like RHEL (Red Hat Enterprise Linux).</p>
Expand Down Expand Up @@ -302,7 +305,12 @@ $("document").ready(function(){
<div class="col-sm-4">
<a target=_blank class="btn btn-secondary btn-block" href="https://ansible.github.io/workshops/decks/ansible_f5.pdf">Ansible F5 Deck</a>
</div>

</div>
{% elif create_cluster|bool and workshop_type == "rhel" %}
<div class="row">
<div class="col-sm-4">
<a target=_blank class="btn btn-secondary btn-block" href="https://red.ht/advanced_tower">Ansible Tower Advanced Exercises</a>
</div>
</div>
{% elif workshop_type == "rhel" %}
<div class="row">
Expand Down
Loading

0 comments on commit c2d3811

Please sign in to comment.