Skip to content

Commit

Permalink
sync aap for containers to sean dev
Browse files Browse the repository at this point in the history
  • Loading branch information
IPvSean committed Oct 12, 2023
1 parent 7ab3ce5 commit eda5fcd
Show file tree
Hide file tree
Showing 25 changed files with 528 additions and 126 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ provisioner/workshop_specific/roles/geerlingguy.repo-epel/
provisioner/roles/ansible_security.ids_config/
provisioner/roles/ansible_security.ids_install/
provisioner/roles/geerlingguy.repo-epel/
provisioner/ansible-automation-platform*
.pyc
.swp
Gemfile.lock
Expand Down
31 changes: 16 additions & 15 deletions exercises/ansible_network/1-explore/README.es.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@

## Índice

* [Objetivo](#objetivo)
* [Diagrama](#diagrama)
* [Guía](#guía)
* [Paso 1 - Connectar vía VS Code](#paso-1---connectar-vía-vs-code)
* [Paso 2 - Usando la Terminal](#paso-2---usando-la-terminal)
* [Paso 3 - Examinando los Entornos de Ejecución](#paso-3---examinando-los-entornos-de-ejecución)
* [Paso 4 - Examinando la configuración de ansible-navigator](#paso-4---examinando-la-configuración-de-ansible-navigator)
* [Paso 5 - Examinando el inventario](#paso-5---examinando-el-inventario)
* [Paso 6 - Comprendiendo el inventario](#paso-6---comprendiendo-el-inventario)
* [Paso 7 - Usando ansible-navigator para explorar el inventario](#paso-7---usando-ansible-navigator-para-explorar-el-inventario)
* [Paso 8 - Connectándose a dispositivos de red](#paso-8---connectándose-a-dispositivos-de-red)
* [Completado](#complete)
- [Ejercicio 1 - Explorando el entorno de laboratorio](#ejercicio-1---explorando-el-entorno-de-laboratorio)
- [Índice](#índice)
- [Objetivo](#objetivo)
- [Diagrama](#diagrama)
- [Guía](#guía)
- [Paso 1 - Connectar vía VS Code](#paso-1---connectar-vía-vs-code)
- [Paso 2 - Usando la Terminal](#paso-2---usando-la-terminal)
- [Paso 3 - Examinando los Entornos de Ejecución](#paso-3---examinando-los-entornos-de-ejecución)
- [Paso 4 - Examinando la configuración de ansible-navigator](#paso-4---examinando-la-configuración-de-ansible-navigator)
- [Paso 5 - Examinando el inventario](#paso-5---examinando-el-inventario)
- [Paso 6 - Comprendiendo el inventario](#paso-6---comprendiendo-el-inventario)
- [Paso 7 - Usando ansible-navigator para explorar el inventario](#paso-7---usando-ansible-navigator-para-explorar-el-inventario)
- [Paso 8 - Connectándose a dispositivos de red](#paso-8---connectándose-a-dispositivos-de-red)
- [Completado](#completado)

## Objetivo

Expand All @@ -31,10 +33,9 @@ Esto incluye:

Si necesitaás más informacion sobre los nuevos componentes de Ansible Automation Platform, añáde esta página [https://red.ht/AAP-20](https://red.ht/AAP-20) a tus marcadores.

> Chatea con nosotros
> Join our community forum!
>
> Antes de comenzar, por favor, únete a nosotros en slack <a href="https://join.slack.com/t/ansiblenetwork/shared_invite/zt-3zeqmhhx-zuID9uJqbbpZ2KdVeTwvzw">Haz click aquí para unirte al canal de slack ansiblenetwork</a>. Esto te permitirá chatear con otros ingeniero de automatización de redes y obtener ayuda una vez concluídos los talleres. Si el enlace no funcionase, por favor envíanos un email a <a href="mailto:[email protected]">Ansible Technical Marketing</a></th>
> Before you get started, please join us on <a target="_new" href="https://forum.ansible.com/">https://forum.ansible.com/</a>. This will allow you to get Ansible help after the workshops concludes.
## Diagrama

Expand Down
32 changes: 16 additions & 16 deletions exercises/ansible_network/1-explore/README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@

## 目次

* [目的](#objective)
* [](#diagram)
* [ガイド](#guide)
* [ステップ 1 - VS Code を使用した接続](#step-1---connecting-via-vs-code)
* [ステップ 2 - ターミナルの使用](#step-2---using-the-terminal)
* [ステップ 3 - 実行環境の検証](#step-3---examining-execution-environments)
* [ステップ 4 - ansible-navigator
設定の検証](#step-4---examining-the-ansible-navigator-configuration)
* [ステップ 5 - インベントリーの検証](#step-5---examining-inventory)
* [ステップ 6 - インベントリーについて](#step-6---understanding-inventory)
* [ステップ 7 - ansible-navigator
を使用したインベントリーの探索](#step-7---using-ansible-navigator-to-explore-inventory)
* [ステップ 8 - ネットワークデバイスへの接続](#step-8---connecting-to-network-devices)
* [完了](#complete)
- [演習 1 - ラボ環境の探索](#演習-1---ラボ環境の探索)
- [目次](#目次)
- [目的](#目的)
- [](#)
- [ガイド](#ガイド)
- [ステップ 1 - VS Code を使用した接続](#ステップ-1---vs-code-を使用した接続)
- [ステップ 2 - ターミナルの使用](#ステップ-2---ターミナルの使用)
- [ステップ 3 - 実行環境の検証](#ステップ-3---実行環境の検証)
- [ステップ 4 - ansible-navigator 設定の検証](#ステップ-4---ansible-navigator-設定の検証)
- [ステップ 5 - インベントリーの検証](#ステップ-5---インベントリーの検証)
- [ステップ 6 - インベントリーについて](#ステップ-6---インベントリーについて)
- [ステップ 7 - ansible-navigator を使用したインベントリーの探索](#ステップ-7---ansible-navigator-を使用したインベントリーの探索)
- [ステップ 8 - ネットワークデバイスへの接続](#ステップ-8---ネットワークデバイスへの接続)
- [完了](#完了)

## 目的

Expand All @@ -45,9 +45,9 @@ Hatがサポートするすべてのコレクションがすでに含まれて
Ansible Automation Platformの新しいコンポーネントに関する情報が必要な場合は、このランディングページをブックマークしてください
[https://red.ht/AAP-20](https://red.ht/AAP-20)

> チャットでコミュニケーションしましょう
> Join our community forum!
>
> 始める前に、slack にご参加ください! <a href="https://join.slack.com/t/ansiblenetwork/shared_invite/zt-3zeqmhhx-zuID9uJqbbpZ2KdVeTwvzw">ansiblenetwork slack に参加するには、こちらをクリック</a>。これにより、他のネットワーク自動化エンジニアとチャットしたり、ワークショップの終了後にサポートを受けたりすることができます。リンクが古くなっている場合は、<a href="mailto:ansible-network@redhat.com">Ansible テクニカルマーケティング</a></th> にメールでご連絡ください。
> Before you get started, please join us on <a target="_new" href="https://forum.ansible.com/">https://forum.ansible.com/</a>. This will allow you to get Ansible help after the workshops concludes.

##
Expand Down
4 changes: 2 additions & 2 deletions exercises/ansible_network/1-explore/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ These first few lab exercises will be exploring the command-line utilities of th

If you need more information on new Ansible Automation Platform components bookmark this landing page [https://red.ht/AAP-20](https://red.ht/AAP-20)

> Chat with us
> Join our community forum!
>
> Before you get started, please join us on slack! <a href="https://join.slack.com/t/ansiblenetwork/shared_invite/zt-3zeqmhhx-zuID9uJqbbpZ2KdVeTwvzw">Click here to join the ansiblenetwork slack</a>. This will allow you to chat with other network automation engineers and get help after the workshops concludes. If the link goes stale please email <a href="mailto:[email protected]">Ansible Technical Marketing</a></th>
> Before you get started, please join us on <a target="_new" href="https://forum.ansible.com/">https://forum.ansible.com/</a>. This will allow you to get Ansible help after the workshops concludes.

## Diagram
Expand Down
4 changes: 4 additions & 0 deletions provisioner/packer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ Work In Progress (WIP)
```bash
packer build --force automation-controller.pkr.hcl
```

```bash
packer build --force automation-controller9.pkr.hcl
```
4 changes: 2 additions & 2 deletions provisioner/packer/pre_build_controller.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@
- name: Configure control node
ansible.builtin.include_role:
name: ../../roles/control_node
- include_role:
name: ../../roles/code_server
# - include_role:
# name: ../../roles/code_server
16 changes: 8 additions & 8 deletions provisioner/provision_lab.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,14 @@
ansible.builtin.include_role:
name: ../roles/control_node_always

- name: Install and configure code server using code_server role
ansible.builtin.include_role:
name: ../roles/code_server
when:
- code_server is defined
- code_server
- controllerinstall is defined
- controllerinstall
# - name: Install and configure code server using code_server role
# ansible.builtin.include_role:
# name: ../roles/code_server
# when:
# - code_server is defined
# - code_server
# - controllerinstall is defined
# - controllerinstall

- name: Add dns entries for all student control nodes using aws_dns role
ansible.builtin.include_role:
Expand Down
11 changes: 11 additions & 0 deletions provisioner/workshop_specific/network.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
---
- name: configure control node for rhel 90
hosts: "control_nodes"
become: true
gather_facts: false
tasks:
- name: Configure crypto policies
include_role:
name: rhel-system-roles.crypto_policies
vars:
- crypto_policies_policy: LEGACY

- name: wait for routers to have ssh reachability
hosts: "routers"
gather_facts: false
Expand Down
24 changes: 23 additions & 1 deletion roles/aap_download/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
---
- name: check if aap.tar.gz exists
stat:
debug:
msg: "{{ playbook_dir }}/aap.tar.gz"

- name: Check if aap.tar.gz exists with stat module
ansible.builtin.stat:
path: "{{ playbook_dir }}/aap.tar.gz"
checksum_algorithm: sha256
register: stat_var

- name: Print out stat_var
ansible.builtin.debug:
msg: "stat_var: {{ stat_var }}"

- name: Check if aap.tar.gz exists with stat module for symbolic link
ansible.builtin.stat:
path: "{{ stat_var.stat.lnk_source }}"
checksum_algorithm: sha256
register: stat_var
when: stat_var.stat.checksum is undefined

- name: attempt to download specified AAP from specified URL if we don't already have it
when:
- aap_download_url is defined
Expand Down Expand Up @@ -37,6 +52,13 @@
checksum_algorithm: sha256
register: stat_var

- name: Check if aap.tar.gz exists with stat module for symbolic link
ansible.builtin.stat:
path: "{{ stat_var.stat.lnk_source }}"
checksum_algorithm: sha256
register: stat_var
when: stat_var.stat.checksum is undefined

- name: Verify sha256sum of aap.tar.gz
fail:
msg: "Failure, sha256sum does not match"
Expand Down
27 changes: 27 additions & 0 deletions roles/code_server_container/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Code Server Role

This roll will install [code server](https://github.com/cdr/code-server) onto a Red Hat Enterprise Linux (RHEL) node that also has Ansible Automation Platform installed (i.e. Tower/Controller). It supports both Ansible Tower and Automation controller.

This is tested on RHEL 8.X

Example:

```
- name: configure ansible control node
hosts: 'controller_hosts'
gather_facts: true
become: true
vars:
workshop_dns_zone: "demoredhat.com"
admin_password: ansible123
username: "student1"
ec2_name_prefix: "my_workbench"
tasks:
- include_role:
name: ansible.workshops.code_server
```

# Requirements

- AWS (Amazon Web Services) account with Route53 access - this role is only currently supported with route53 and uses the `community.aws.route53` module
7 changes: 7 additions & 0 deletions roles/code_server_container/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
s3_state: "present"
teardown: false
aap_dir: "/home/{{ username }}/aap_install"
codeserver_url: https://github.com/coder/code-server/releases/download/v4.9.1/code-server-4.9.1-amd64.rpm
codeserver_rescue_url: https://github.com/coder/code-server/releases/download/v4.9.1/code-server-4.9.1-amd64.rpm
username: "ec2-user"
69 changes: 69 additions & 0 deletions roles/code_server_container/meta/argument_spec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
argument_specs:
main:
short_description: Set up the code server, main entrypoint.
options:
teardown:
description: Whether to execute teardown or creation.
type: bool
required: true
username:
description: The workshop username.
type: str
required: true
ec2_name_prefix:
description: A prefix for EC2 and DNS resources.
type: str
required: true
workshop_dns_zone:
description: The base DNS zone for the workshop.
type: str
required: true
codeserver:
short_description: Provision the code server.
options:
s3_state:
description: Whether the DNS record is present or absent.
type: str
options:
- present
- absent
required: true
workshop_dns_zone:
description: The base DNS zone for the workshop.
type: str
required: true
username:
description: The workshop username.
type: str
required: true
ec2_name_prefix:
description: A prefix for EC2 and DNS resources.
type: str
required: true
admin_password:
description: The code server admin password.
type: str
required: true
teardown:
short_description: Teardown the code server.
options:
s3_state:
description: Whether the DNS record is present or absent.
type: str
options:
- present
- absent
required: true
workshop_dns_zone:
description: The base DNS zone for the workshop.
type: str
required: true
ec2_name_prefix:
description: A prefix for EC2 and DNS resources.
type: str
required: true
student_total:
description: The total number of students for the workshop.
type: int
required: true
56 changes: 56 additions & 0 deletions roles/code_server_container/tasks/codeserver.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
- name: Pull code-server image
containers.podman.podman_image:
name: "{{ item }}"
register: podman_pull
until: podman_pull is not failed
retries: 5
delay: 15

# source: https://vscode.readthedocs.io/en/latest/getstarted/settings/
# - name: ensure custom facts directory exists
# ansible.builtin.file:
# path: "/home/{{ username }}/.local/share/code-server/User/"
# recurse: true
# state: directory
# owner: "{{ username }}"

# - name: Apply code server defaults
# ansible.builtin.template:
# src: settings.json
# dest: "/home/{{ username }}/.local/share/code-server/User/settings.json"
# owner: "{{ username }}"

# - name: Create a directory if it does not exist
# ansible.builtin.file:
# path: /home/{{ username }}/.local/share/code-server/extensions/
# state: directory
# owner: "{{ username }}"
# group: "{{ username }}"

# - name: Download files for vscode
# ansible.builtin.get_url:
# url: "{{ item }}"
# dest: /home/{{ username }}/.local/share/code-server/extensions/
# owner: "{{ username }}"
# group: "{{ username }}"
# loop:
# - https://github.com/ansible/workshops/raw/devel/files/bierner.markdown-preview-github-styles-0.1.6.vsix
# - https://github.com/ansible/workshops/raw/devel/files/hnw.vscode-auto-open-markdown-preview-0.0.4.vsix
# - https://github.com/ansible/workshops/raw/devel/files/redhat.ansible-0.4.5.vsix
# register: download_extension
# until: download_extension is not failed
# retries: 5

# - name: install ansible and markdown extensions
# become_user: "{{ username }}"
# ansible.builtin.command: "/bin/code-server --install-extension /home/{{ username }}/.local/share/code-server/extensions/{{ item }}"
# loop:
# - bierner.markdown-preview-github-styles-0.1.6.vsix
# - hnw.vscode-auto-open-markdown-preview-0.0.4.vsix
# - redhat.ansible-0.4.5.vsix
# ignore_errors: true
# register: install_extension
# until: install_extension is not failed
# retries: 5

Loading

0 comments on commit eda5fcd

Please sign in to comment.