[toc]
## A0. instructor - su, day*4, 9:30-17:30
hand
| ID | URL | NAME |
| :--: | ---------------------------------------------- | :-----------------------------: |
| 1 | https://typoraio.cn
https://www.marktext.cc | Markdown 编辑器 |
| 2 | https://excalidraw.com
https://handraw.top | 手绘网络画图
\*.excalidraw |
## A1. 学习准备
- 电子教材 <=- 邮件
- 培训环境
- 地址 https://rol-cn.ole.redhat.com/rol/app/login/local
帐号,密码 <=- 邮件
- 时间:`45` 天
## A2. 培训环境
加入 / 实验 / `workstation` 打开控制台
==student==%==student==
## A3. 建议
1. 更改分辨率
2. 全屏
3. 两显示器
## A4. Linux 小技巧
> 命令选项
>
> - ==-==字母
>
> - ==--==单词
| STEP | TITLE | COMMENTS |
| :--: | --------------------- | ------------------------------------------------------------ |
| 1 | word | [ansible](https://www.themoviedb.org/movie/80274-ender-s-game?language=zh-CN) |
| 2 | ansTab | $ anibleTabTab |
| 3 | man CMD
CMD --help | $ man ansible
$ ansible --help
$ ansible -h
\*$ ansible-navigator doc
$ ansible-doc
https://docs.ansible.com |
| 4 | echo $? | $ echo $?
0 == ok |
## A5. vimrc
> - /etc/vimrc
>
> - ~/.vimrc
>
>
>
> 列出所有选项
>
> ```bash
> $ vim
> set all
> ```
| ID | Short | Long | Comments |
| :--: | :-----: | :----------: | -------------------------- |
| 1 | nu | number | 行号 |
| 2 | ts=2 | tabstop | tab -=> space*2 |
| 2 | et | expandtab | 显示2空格,保存文件中2空格 |
| 3 | sw=2 | shiftwidth | >, < |
| 4 | cuc | cursorcolumn | 光标列 |
| 5 | - | `paste` | 粘贴 |
| 6 | ft=yaml | filetype | 指明文件类型,语法高亮显示 |
```bash
$ cat > ~/.vimrc >/dev/null</dev/null< - 第一行 `---`,可以省略
> - 只能使用空格,不支持 Tab
> - 每个级别对齐,空格缩进(两空格)
> - Key:spacevalue
## A7. ansible-navigator
> - openshfit -=> oc
> - K8s -=> kubectl
> - Ceph -=> ceph
| ID | NEW(container) | OLD |
| :--: | ----------------------------- | ------------------------ |
| 1 | $ ansible-navigator run X.yml | $ ansible-playbook X.yml |
| 2 | $ ansible-navigator inventory | $ ansible-inventory |
| 3 | $ ansible-navigator config | $ ansible-config |
## A8. 相关网址
| ID | URL | COMMENTS |
| :--: | ------------------------------------------------------------ | ----------- |
| 1 | https://www.redhat.com/zh/services/training/do374-developing-advanced-automation-red-hat-ansible-automation-platform | 红帽课程 |
| 2 | https://docs.ansible.com/ansible/latest/index.html | ansible手册 |
| 3 | https://developers.redhat.com/ | 开发者帐号 |
| 4 | https://galaxy.ansible.com/ | 集合、角色 |
| 5 | https://rime.im/ | 输入法 |
| ID | URL | ACCOUNT | COMMENTS |
| :--: | ---------------------------------- | :-------------------------------: | :---------------------------------------: |
| 1 | https://hub.lab.example.com | admin%redhat
student%redhat123 | ⾃动化中⼼
(LAN: galaxy.ansible.com) |
| 2 | https://controller.lab.example.com | admin%redhat | ⾃动化控制器
(ansible Tower / AWX) |
| 3 | https://git.lab.example.com | student%Student@123 | |
## A9. 环境
```bash
$ dnf provides ansible-navigator
$ sudo dnf -y install ansible-navigator
$ podman login hub.lab.example.com -u admin -p redhat
$ ansible-navigator welcome \
--eei hub.lab.example.com/ee-supported-rhel8:latest
```
:config esc
:images esc
esc
```bash
$ cat > inventory < 外币信用卡,申请 aws 1年 免费云主机
>
> - 亚太地区(东京)
> - 安全组放行端口:
> - 53/tcp, 53/udp
> - 374/tcp
- 1. AWS(aws.opensu.org)-frps
```bash
# var
FRP_FILE=frp_0.61.2_linux_amd64
# download
wget https://github.com/fatedier/frp/releases/download/v0.61.2/${FRP_FILE}.tar.gz
# extract
tar -xf ${FRP_FILE}.tar.gz
# program
sudo mv ${FRP_FILE}/frps /usr/local/sbin/
# configure
sudo tee /etc/frps.toml >/dev/null</dev/null</dev/null</dev/null<ssh -D == socket5 代理
```bash
# windows: `cmd` -=> 以管理员身份运行
# macOS: sudo
# 开启 socket 代理
sudo ssh -o Port=374 -fND 8374 student@aws.opensu.org
sudo netstat -anl | grep 8374
:< 代理指向 socks 代理
>
> - 服务器:`127.0.0.1`
> - 端口:`8374`
3. 🖥️ 物理机:访问测试
https://hub.lab.example.com
https://controller.lab.example.com
## A10.2 流量分流
> 使用 自动配置代理 PAC
1. 🖥️ 物理机
代理 / 自动配置代理 /
代理配置文件 URL https://opensu.org:8443/Redhat/pacs/proxy-374.pac
1. 🖥️ 物理机
https://hub.lab.example.com
https://controller.lab.example.com
## A11. delegate
```yaml
---
- name: Delegation Example
hosts: demo.lab.example.com
become: false
tasks:
- name: Get system information
ansible.builtin.command: uname -a
register: managed_host
- name: Display demo system information
ansible.builtin.debug:
var: managed_host
- name: Delegation Example
hosts: host.lab.example.com
become: false
tasks:
- name: Get system information
ansible.builtin.command: uname -a
register: delegated
- name: Display localhost system information
ansible.builtin.debug:
var: delegated
```
## A12. ssh client
| ID | Windows |
macOS |
Linux | NAME | COMMENT |
| :---------------------------------: | :------------------------------: | :----------------------------------------------------------: | :----------------------------------------------------------: | :----------------------------------------------------------- | ------------------------------------------------------------ |
| 1 | :heavy_check_mark: | :heavy_minus_sign: | :heavy_minus_sign: |
[MobaXterm](https://mobaxterm.mobatek.net/) | 免费(限制)和收费 |
| 2 | :heavy_check_mark: | :heavy_minus_sign: | :heavy_minus_sign: |
[XSHELL](https://www.xshell.com/zh/xshell/) | 家庭、学生免费 |
| 3 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
[WindTerm](https://github.com/kingToolbox/WindTerm) | 开源,github |
| 4 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | [Tabby](https://tabby.sh/) | 开源,github |
| 5 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
[Hyper](https://hyper.is/) | 开源,github |
| 6 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
[SecureCRT](https://securecrtfx.cn/SecureCRT/) | 收费 |
| 7 | :heavy_minus_sign: | :heavy_check_mark: | :heavy_minus_sign: |
[iTerm2](https://iterm2.com/) | 免费 |