Merge branch 'master' of github.com:LCTT/TranslateProject

This commit is contained in:
MjSeven 2021-02-01 23:45:48 +08:00
commit aa20bf0683
68 changed files with 819 additions and 414 deletions

View File

@ -1,42 +1,42 @@
[#]: collector: (lujun9972) [#]: collector: (lujun9972)
[#]: translator: (geekpi) [#]: translator: (geekpi)
[#]: reviewer: ( ) [#]: reviewer: (wxy)
[#]: publisher: ( ) [#]: publisher: (wxy)
[#]: url: ( ) [#]: url: (https://linux.cn/article-13073-1.html)
[#]: subject: (3 tips for automating your email filters) [#]: subject: (3 tips for automating your email filters)
[#]: via: (https://opensource.com/article/21/1/email-filter) [#]: via: (https://opensource.com/article/21/1/email-filter)
[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney)
3 个自动化电子邮件过滤器的技巧 3 个自动化电子邮件过滤器的技巧
====== ======
通过这些简单的建议,减少你的电子邮件并让你的生活更轻松。
![gears and lightbulb to represent innovation][1] > 通过这些简单的建议,减少你的电子邮件并让你的生活更轻松。
![](https://img.linux.net.cn/data/attachment/album/202102/01/103638ozdejmy6eycm6omx.jpg)
在前几年,这个年度系列涵盖了单个的应用。今年,我们除了关注 2021 年的策略外,还将关注一体化解决方案。欢迎来到 2021 年 21 天生产力的第十二天。 在前几年,这个年度系列涵盖了单个的应用。今年,我们除了关注 2021 年的策略外,还将关注一体化解决方案。欢迎来到 2021 年 21 天生产力的第十二天。
如果有一件事是我喜欢的,那就是自动化。只要有机会,我就会把小任务自动化。早起打开鸡舍的门?我买了一扇门,可以在日出和日落时开门和关门。每天从早到晚实时监控鸡群?用 Node-RED 和 [OBS-Websockets][2] 稍微花点时间,就能搞定。 如果有一件事是我喜欢的,那就是自动化。只要有机会,我就会把小任务进行自动化。早起打开鸡舍的门?我买了一扇门,可以在日出和日落时开门和关门。每天从早到晚实时监控鸡群?用 Node-RED 和 [OBS-Websockets][2] 稍微花点时间,就能搞定。
我们还有电子邮件。几天前,我写过关于处理邮件的文章,也写过关于标签和文件夹的文章。只要做一点前期的工作,你就可以在邮件进来的时候,你就可以自动摆脱掉大量管理邮件的开销。 我们还有电子邮件。几天前,我写过关于处理邮件的文章,也写过关于标签和文件夹的文章。只要做一点前期的工作,你就可以在邮件进来的时候,你就可以自动摆脱掉大量管理邮件的开销。
![Author has 480 filters][3] ![Author has 480 filters][3]
是的我有很多过滤器。Kevin Sonney, [CC BY-SA 4.0][4] *是的我有很多过滤器。Kevin Sonney, [CC BY-SA 4.0][4]*
有两种主要方式来过滤你的电子邮件:在服务端或者客户端上。我更喜欢在服务端上做,因为我不断地在尝试新的和不同的电子邮件客户端。(不,真的,我光这个星期就已经使用了五个不同的客户端。我可能有问题。) 有两种主要方式来过滤你的电子邮件:在服务端或者客户端上。我更喜欢在服务端上做,因为我不断地在尝试新的和不同的电子邮件客户端。(不,真的,我光这个星期就已经使用了五个不同的客户端。我可能有问题。)
无论哪种方式,我都喜欢用电子邮件规则做几件事,以使我的电子邮件更容易浏览,并保持我的收件箱不混乱。
1. 将不紧急的邮件移到”稍后阅读“文件夹中。对我而言,这包括来自社交网络、新闻简报和邮件列表的通知。
2. 按列表或主题给消息贴上标签。我属于几个组织,虽然它们经常会被放在”稍后阅读“文件夹中,但我会添加第二个或第三个标签,以说明该源或项目的内容,以帮助搜索时找到相关的东西。
3. 不要把规则搞得太复杂。这个想法让我有一段困难的时间。我想把邮件发送到某个文件夹的所有可能情况都加到一个规则里。如果有什么问题或需要添加或删除的东西,有一个大规则只是让它更难修复。
无论哪种方式,我都喜欢用电子邮件过滤规则做几件事,以使我的电子邮件更容易浏览,并保持我的收件箱不混乱。
1. 将不紧急的邮件移到“稍后阅读”文件夹中。对我而言,这包括来自社交网络、新闻简报和邮件列表的通知。
2. 按列表或主题给消息贴上标签。我属于几个组织,虽然它们经常会被放在“稍后阅读”文件夹中,但我会添加第二个或第三个标签,以说明该来源或项目的内容,以帮助搜索时找到相关的东西。
3. 不要把规则搞得太复杂。这个想法让我困难了一段时间。我想把邮件发送到某个文件夹的所有可能情况都加到一个规则里。如果有什么问题或需要添加或删除的东西,有一个大规则只是让它更难修复。
![Unsubscribe from email][5] ![Unsubscribe from email][5]
点击它点击它就行Kevin Sonney, [CC BY-SA 4.0][4] *点击它点击它就行Kevin Sonney, [CC BY-SA 4.0][4]*
说了这么多,还有一件事我一直在做,它有助于减少我花在电子邮件上的时间:退订邮件。两年前我感兴趣的那个邮件列表已经不感兴趣了,所以就不订阅了。产品更新通讯是我去年停止使用的商品?退订!这一直在积极解放。我每年都会试着评估几次列表中的邮件信息是否(仍然)有用。 说了这么多,还有一件事我一直在做,它有助于减少我花在电子邮件上的时间:退订邮件。两年前我感兴趣的那个邮件列表已经不感兴趣了,所以就不订阅了。产品更新通讯是我去年停止使用的商品?退订!这一直在积极解放。我每年都会试着评估几次列表中的邮件信息是否(仍然)有用。
过滤器和规则可以是非常强大的工具,让你的电子邮件保持集中,减少花在它们身上的时间。而点击取消订阅按钮是一种解放。试试就知道了! 过滤器和规则可以是非常强大的工具,让你的电子邮件保持集中,减少花在它们身上的时间。而点击取消订阅按钮是一种解放。试试就知道了!
@ -47,7 +47,7 @@ via: https://opensource.com/article/21/1/email-filter
作者:[Kevin Sonney][a] 作者:[Kevin Sonney][a]
选题:[lujun9972][b] 选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi) 译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -1,8 +1,8 @@
[#]: collector: (lujun9972) [#]: collector: (lujun9972)
[#]: translator: (wxy) [#]: translator: (wxy)
[#]: reviewer: ( ) [#]: reviewer: (wxy)
[#]: publisher: ( ) [#]: publisher: (wxy)
[#]: url: ( ) [#]: url: (https://linux.cn/article-13074-1.html)
[#]: subject: (Explore binaries using this full-featured Linux tool) [#]: subject: (Explore binaries using this full-featured Linux tool)
[#]: via: (https://opensource.com/article/21/1/linux-radare2) [#]: via: (https://opensource.com/article/21/1/linux-radare2)
[#]: author: (Gaurav Kamathe https://opensource.com/users/gkamathe) [#]: author: (Gaurav Kamathe https://opensource.com/users/gkamathe)
@ -12,13 +12,13 @@
> Radare2 是一个为二进制分析定制的开源工具。 > Radare2 是一个为二进制分析定制的开源工具。
![电脑屏幕上的二进制代码][1] ![](https://img.linux.net.cn/data/attachment/album/202102/01/112611baw4gpqlch10ps1c.jpg)
在《[Linux 上分析二进制文件的 10 种方法][2]》中,我解释了如何使用 Linux 上丰富的原生工具集来分析二进制文件。但如果你想进一步探索你的二进制文件,你需要一个为二进制分析定制的工具。如果你是二进制分析的新手,并且大多使用的是脚本语言,《[GNU binutils 里的九种武器][3]》将帮助你开始学习编译过程和什么是二进制。 在《[Linux 上分析二进制文件的 10 种方法][2]》中,我解释了如何使用 Linux 上丰富的原生工具集来分析二进制文件。但如果你想进一步探索你的二进制文件,你需要一个为二进制分析定制的工具。如果你是二进制分析的新手,并且大多使用的是脚本语言,这篇文章《[GNU binutils 里的九种武器][3]》可以帮助你开始学习编译过程和什么是二进制。
### 为什么我需要另一个工具? ### 为什么我需要另一个工具?
如果现有的 Linux 原生工具也能做类似的事情,那么自然会问为什么你需要另一个工具。嗯,这和你用手机做闹钟、做笔记、做相机、听音乐、上网、偶尔打电话和接电话的原因是一样的。以前,使用单独的设备和工具处理这些功能 —— 比如拍照的实体相机,记笔记的小记事本,起床的床头闹钟等等。对用户来说,有一个设备来做多件(但相关的)事情是*方便的*。另外,杀手锏就是独立功能之间的*互操作性*。 如果现有的 Linux 原生工具也能做类似的事情,你自然会问为什么需要另一个工具。嗯,这和你用手机做闹钟、做笔记、做相机、听音乐、上网、偶尔打电话和接电话的原因是一样的。以前,使用单独的设备和工具处理这些功能 —— 比如拍照的实体相机,记笔记的小记事本,起床的床头闹钟等等。对用户来说,有一个设备来做多件(但相关的)事情是*方便的*。另外,杀手锏就是独立功能之间的*互操作性*。
同样,即使许多 Linux 工具都有特定的用途,但在一个工具中捆绑类似(和更好)的功能是非常有用的。这就是为什么我认为 [Radare2][4] 应该是你需要处理二进制文件时的首选工具。 同样,即使许多 Linux 工具都有特定的用途,但在一个工具中捆绑类似(和更好)的功能是非常有用的。这就是为什么我认为 [Radare2][4] 应该是你需要处理二进制文件时的首选工具。
@ -26,11 +26,11 @@
### 为什么选择 Radare2 ### 为什么选择 Radare2
有大量非原生的Linux 工具可用于二进制分析,为什么要选择 Radare2我的理由很简单。 有大量非原生的Linux 工具可用于二进制分析,为什么要选择 Radare2?我的理由很简单。
首先,它是一个开源项目,有一个活跃而健康的社区。如果你正在寻找新颖的功能或着 bug 修复的工具,这很重要。 首先,它是一个开源项目,有一个活跃而健康的社区。如果你正在寻找新颖的功能或提供着 bug 修复的工具,这很重要。
其次Radare2 可以在命令行上使用而且它有一个功能丰富的图形用户界面GUI环境叫做 Cutter适合那些对 GUI 比较熟悉的人。作为一个长期使用 Linux 的用户,我对在 shell 上输入感到更舒服。虽然熟悉 Radare2 的命令稍微有一点学习曲线,但我会把它比作 [学习 Vim][6]。你先学习基本的东西,一旦你掌握了它们,你就可以继续学习更高级的东西。很快,它就变成了肌肉记忆。 其次Radare2 可以在命令行上使用而且它有一个功能丰富的图形用户界面GUI环境叫做 Cutter适合那些对 GUI 比较熟悉的人。作为一个长期使用 Linux 的用户,我对习惯于在 shell 上输入。虽然熟悉 Radare2 的命令稍微有一点学习曲线,但我会把它比作 [学习 Vim][6]。你可以先学习基本的东西,一旦你掌握了它们,你就可以继续学习更高级的东西。很快,它就变成了肌肉记忆。
第三Radare2 通过插件可以很好的支持外部工具。例如,最近开源的 [Ghidra][7] 二进制分析和<ruby>逆向工具<rt>reversing tool</rt></ruby>很受欢迎,因为它的反编译器功能是逆向软件的关键要素。你可以直接从 Radare2 控制台安装 Ghidra 反编译器并使用,这很神奇,让你两全其美。 第三Radare2 通过插件可以很好的支持外部工具。例如,最近开源的 [Ghidra][7] 二进制分析和<ruby>逆向工具<rt>reversing tool</rt></ruby>很受欢迎,因为它的反编译器功能是逆向软件的关键要素。你可以直接从 Radare2 控制台安装 Ghidra 反编译器并使用,这很神奇,让你两全其美。
@ -76,9 +76,6 @@ int main() {
``` ```
$ gcc adder.c -o adder $ gcc adder.c -o adder
```
```
$ file adder $ file adder
adder: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=9d4366f7160e1ffb46b14466e8e0d70f10de2240, not stripped adder: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=9d4366f7160e1ffb46b14466e8e0d70f10de2240, not stripped
$ ./adder $ ./adder
@ -87,7 +84,7 @@ Number now is : 101
#### 加载二进制文件 #### 加载二进制文件
要分析二进制文件,你必须在 Radare2 中加载它。通过提供文件作为 `r2` 命令的一个命令行参数来加载它。你会进入一个独立的 Radare2 控制台,与你的 shell 不同。要退出控制台,你可以输入 `Quit``Exit` 或按 `Ctrl+D` 要分析二进制文件,你必须在 Radare2 中加载它。通过提供文件作为 `r2` 命令的一个命令行参数来加载它。你会进入一个独立的 Radare2 控制台,与你的 shell 不同。要退出控制台,你可以输入 `Quit``Exit` 或按 `Ctrl+D`
``` ```
$ r2 ./adder $ r2 ./adder
@ -133,7 +130,7 @@ $ r2 -A ./adder
#### 获取一些关于二进制的基本信息 #### 获取一些关于二进制的基本信息
在开始分析一个二进制文件之前你需要一些背景信息。在许多情况下这可以是二进制文件的格式ELF、PE 等)二进制的架构x86、AMD、ARM 等),以及二进制是 32 位还是 64 位。方便的 `r2``iI` 命令可以提供所需的信息: 在开始分析一个二进制文件之前你需要一些背景信息。在许多情况下这可以是二进制文件的格式ELF、PE 等)二进制的架构x86、AMD、ARM 等),以及二进制是 32 位还是 64 位。方便的 `r2``iI` 命令可以提供所需的信息:
``` ```
[0x004004b0]> iI [0x004004b0]> iI
@ -175,7 +172,7 @@ va true
### 导入和导出 ### 导入和导出
通常情况下,当你知道你要处理的是什么样的文件后,你就想知道二进制程序使用了什么样的标准库函数,或者了解程序的潜在功能。在本教程中的示例 C 程序中,唯一的库函数是 `printf` 来打印信息。你可以通过运行 `ii` 命令看到这一点,它显示了二进制所有导入的库: 通常情况下,当你知道你要处理的是什么样的文件后,你就想知道二进制程序使用了什么样的标准库函数,或者了解程序的潜在功能。在本教程中的示例 C 程序中,唯一的库函数是 `printf`,用来打印信息。你可以通过运行 `ii` 命令看到这一点,它显示了二进制所有导入的库:
``` ```
[0x004004b0]> ii [0x004004b0]> ii
@ -189,7 +186,7 @@ nth vaddr bind type lib name
5 0x00000000 WEAK NOTYPE _ITM_registerTMCloneTable 5 0x00000000 WEAK NOTYPE _ITM_registerTMCloneTable
``` ```
二进制也可以有自己的符号、函数或数据。这些函数通常显示在 `Exports` 下。这个测试的二进制导出了两个函数:`main` 和 `adder`。其余的函数是在编译阶段,当二进制文件被构建时添加的。加载器需要这些函数来加载二进制文件(现在不用太关心它们): 二进制也可以有自己的符号、函数或数据。这些函数通常显示在 `Exports` 下。这个测试的二进制导出了两个函数:`main` 和 `adder`。其余的函数是在编译阶段,当二进制文件被构建时添加的。加载器需要这些函数来加载二进制文件(现在不用太关心它们):
``` ```
[0x004004b0]> [0x004004b0]>
@ -359,7 +356,6 @@ entry0 0x4004d1 [DATA] mov rdi, main
这是 `adder` 函数的反汇编结果: 这是 `adder` 函数的反汇编结果:
``` ```
[0x004005a5]> s sym.adder [0x004005a5]> s sym.adder
[0x00400596]> [0x00400596]>
@ -622,7 +618,7 @@ via: https://opensource.com/article/21/1/linux-radare2
作者:[Gaurav Kamathe][a] 作者:[Gaurav Kamathe][a]
选题:[lujun9972][b] 选题:[lujun9972][b]
译者:[wxy](https://github.com/wxy) 译者:[wxy](https://github.com/wxy)
校对:[校对者ID](https://github.com/校对者ID) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -1,304 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (My first day using Ansible)
[#]: via: (https://opensource.com/article/20/10/first-day-ansible)
[#]: author: (David Both https://opensource.com/users/dboth)
My first day using Ansible
======
A sysadmin shares information and advice about putting Ansible into
real-world use configuring computers on his network.
![People work on a computer server with devices][1]
Getting a new computer, whether physical or virtual, up and running is time-consuming and requires a good deal of work—whether it's your first time or the 50th. For many years, I have used a series of scripts and RPMs that I created to install the packages I need and to perform many bits of configuration for my favorite tools. This approach has worked well and simplified my work, as well as reduced the amount of time I spend typing commands.
I am always looking for better ways of doing things, and, for several years now, I have been hearing and reading about [Ansible][2], which is a powerful tool for automating system configuration and management. Ansible allows a sysadmin to define a specific state for each host in one or more playbooks and then performs whatever tasks are necessary to bring the host to that state. This includes installing or deleting various resources such as RPM or Apt packages, configuration and other files, users, groups, and much more.
I have delayed learning how to use it for a long time because—stuff. Until recently, when I ran into a problem that I thought Ansible could easily solve.
This article is not a complete how-to for getting started with Ansible; rather, it is intended to provide insight into some of the issues that I encountered and some information that I found only in some very obscure places. Much of the information I found in various online discussions and Q&amp;A groups about Ansible was incorrect. Errors ranged from information that was really old with no indication of its date or provenance to information that was just wrong.
The information in this article is known to work—although there might be other ways of accomplishing the same things—and it works with Ansible 2.9.13 and [Python][3] 3.8.5.
### My problem
All of my best learning experiences start with a problem I need to solve, and this was no exception.
I have been working on a little project to modify the configuration files for the [Midnight Commander][4] (mc) file manager and pushing them out to various systems on my network for testing. Although I have a script to automate this, it still requires a bit of fussing with a command-line loop to provide the names of the systems to which I want to push the new code. The large number of changes I was making to the configuration files made it necessary for me to push the new ones frequently. But, just when I thought I had my new configuration just right, I would find a problem and need to do another push after making the fix.
This environment made it difficult to keep track of which systems had the new files and which did not. I also have a couple of hosts that need to be treated differently. And my little bit of knowledge about Ansible suggested that it would probably be able to do all or most of what I need.
### Getting started
I had read a number of good articles and books about Ansible, but never in an "I have to get this working NOW!" kind of situation. And now was—well, NOW!
In rereading these documents, I discovered that they mostly talk about how to install Ansible from GitHub using—wait for it—Ansible. That is cool, but I really just wanted to get started, so I installed it on my Fedora workstation using DNF and the version in the Fedora repository. Easy.
But then I started looking for the file locations and trying to determine which configuration files I needed to modify, where to keep my playbooks, what a playbook even looks like, and what it does. I had lots of (so far) unanswered questions running around in my head.
So, without further descriptions of my tribulations, here are the things I discovered and that got me going.
### Configuration
Ansible's configuration files are kept in `/etc/ansible`. Makes sense, right, since `/etc` is where system programs are supposed to keep their configuration files. The two files I needed to work with are `ansible.cfg` and `hosts`.
#### ansible.cfg
After getting started with some of the exercises I found in the documents and online, I began receiving warning messages about deprecating certain older Python files. So, I set `deprecation_warnings` to `false` in `ansible.cfg` and those angry red warning messages stopped:
```
`deprecation_warnings = False`
```
Those warnings are important, so I will revisit them later and figure out what I need to do. But for now, they no longer clutter the screen and obfuscate the errors I actually need to be concerned about.
#### The hosts file
Not the same as the `/etc/hosts` file, the `hosts` file is also known as the inventory file, and it lists the hosts on your network. This file allows grouping hosts together in related sets, such as servers, workstations, and pretty much any designation you need. This file contains its own help and plenty of examples, so I won't go into boring detail here. However, there are some things to know.
Hosts can be listed outside of any groups, but groups can be helpful in identifying hosts with one or more common characteristics. Groups use the INI format, so a server group looks like this:
```
[servers]
server1
server2
...etc.
```
A hostname must be present in this file for Ansible to work on it. Even though some subcommands allow you to specify a hostname, the command will fail unless the hostname is in the `hosts` file. A host can also be listed in multiple groups. So `server1` might also be a member of the `[webservers]` group in addition to the `[servers]` group, and a member of the `[ubuntu]` group to differentiate it from Fedora servers.
Ansible is smart. If the `all` argument is used for the hostname, Ansible scans the file and performs the defined tasks on all hosts listed in the file. Ansible will only attempt to work on each host once, no matter how many groups it appears in. This also means that there does not need to be a defined "all" group because Ansible can determine all hostnames in the file and create its own list of unique hostnames.
Another little thing to look out for is multiple entries for a single host. I use `CNAME` records in my DNS zone file to create aliased names that point to the [A records][5] for some of my hosts. That way, I can refer to a host as `host1` or `h1` or `myhost`. If you use multiple hostnames for the same host in the `hosts` file, Ansible will try to perform its tasks on all of those hostnames; it has no way of knowing that they refer to the same host. The good news is that this does not affect the overall result; it just takes a bit more time as Ansible works on the secondary hostnames and determines that all of the operations have already been performed.
### Ansible facts
Most of the materials I have read on Ansible talk about [Ansible facts][6], which "are data related to your remote systems, including operating systems, IP addresses, attached filesystems, and more." This information is available in other ways, such as `lshw`, `dmidecode`, the `/proc` filesystem, and more, but Ansible generates a JSON file containing this information. Each time Ansible runs, it generates this facts data. There is an amazing amount of information in this data stream, all of which are in `<"variable-name": "value">` pairs. All of these variables are available for use within an Ansible playbook. The best way to understand the huge amount of information available is to display it yourself:
```
`# ansible -m setup <hostname> | less`
```
See what I mean? Everything you ever wanted to know about your host hardware and Linux distribution is there and usable in a playbook. I have not yet gotten to the point where I need to use those variables, but I am certain I will in the next couple of days.
### Modules
The `ansible` command above uses the `-m` option to specify the "setup" module. Ansible has many modules already built-in, so you do not need to use the `-m` for those. There are also many downloadable modules that can be installed, but the built-ins do everything I have needed for my current projects so far.
### Playbooks
Playbooks can be located almost anywhere. Since I need to run my playbooks as root, I placed mine in `/root/ansible`. As long as this directory is the present working directory (PWD) when I run Ansible, it can find my playbook. Ansible also has a runtime option to specify a different playbook and location.
Playbooks can contain comments, although I have seen very few articles or books that mention this. As a sysadmin who believes in documenting everything, I find using comments can be very helpful. This is not so much about saying the same things in the comments as I do in the task name; rather, it is about identifying the purpose of groups of tasks and ensuring that I record my reasons for doing certain things in a certain way or order. This can help with debugging problems later when I may have forgotten my original thinking.
Playbooks are simply collections of tasks that define the desired state of a host. A hostname or inventory group is specified at the beginning of the playbook and defines the hosts on which Ansible will run the playbook.
Here is a sample of my playbook:
```
################################################################################
# This Ansible playbook updates Midnight commander configuration files.        #
################################################################################
\- name: Update midnight commander configuration files
  hosts: all
 
  tasks:
  - name: ensure midnight commander is the latest version
    dnf:
      name: mc
      state: present
  - name: create ~/.config/mc directory for root
    file:
      path: /root/.config/mc
      state: directory
      mode: 0755
      owner: root
      group: root
  - name: create ~/.config/mc directory for dboth
    file:
      path: /home/dboth/.config/mc
      state: directory
      mode: 0755
      owner: dboth
      group: dboth
  - name: copy latest personal skin
    copy:
      src: /root/ansible/UpdateMC/files/MidnightCommander/DavidsGoTar.ini
      dest: /usr/share/mc/skins/DavidsGoTar.ini
      mode: 0644
      owner: root
      group: root
  - name: copy latest mc ini file
    copy:
      src: /root/ansible/UpdateMC/files/MidnightCommander/ini
      dest: /root/.config/mc/ini
      mode: 0644
      owner: root
      group: root
  - name: copy latest mc panels.ini file
    copy:
      src: /root/ansible/UpdateMC/files/MidnightCommander/panels.ini
      dest: /root/.config/mc/panels.ini
      mode: 0644
      owner: root
      group: root
&lt;SNIP&gt;
```
The playbook starts with its own name and the hosts it will act on—in this case, all of the hosts listed in my `hosts` file. The `tasks` section lists the specific tasks required to bring the host into compliance with the desired state. This playbook starts with a task in which Ansible's built-in DNF updates Midnight Commander if it is not the most recent release. The next tasks ensure that the required directories are created if they do not exist, and the remainder of the tasks copy the files to the proper locations. These `file` and `copy` tasks can also set the ownership and file modes for the directories and files.
The details of my playbook are beyond the scope of this article, but I used a bit of a brute-force attack on the problem. There are other methods for determining which users need to have the files updated rather than using a task for each file for each user. My next objective is to simplify this playbook to use some of the more advanced techniques.
Running a playbook is easy; just use the `ansible-playbook` command. The .yml extension stands for YAML. I have seen several meanings for that, but my bet is on "Yet Another Markup Language," despite the fact that some claim that YAML is not one.
This command runs the playbook I created for updating my Midnight Commander files:
```
`# ansible-playbook -f 10 UpdateMC.yml`
```
The `-f` option specifies that Ansible should fork up to 10 threads in order to perform operations in parallel. This can greatly speed overall task completion, especially when working on multiple hosts.
### Output
The output from a running playbook lists each task and the results. An `ok` means the machine state managed by the task is already defined in the task stanza. Because the state defined in the task is already true, Ansible did not need to perform the actions defined in the task stanza.
The response `changed` indicates that Ansible performed the task specified in the stanza in order to bring it to the desired state. In this case, the machine state defined in the stanza was not true, so the actions defined were performed to make it true. On a color-capable terminal, the `TASK` lines are shown in color. On my host with my amber-on-black terminal color configuration, the `TASK` lines are shown in amber, `changed` lines are in brown, and `ok` lines are shown in green. Error lines are displayed in red.
The following output is from the playbook I will eventually use to perform post-install configuration on new hosts:
```
PLAY [Post-installation updates, package installation, and configuration]
TASK [Gathering Facts]
ok: [testvm2]
TASK [Ensure we have connectivity]
ok: [testvm2]
TASK [Install all current updates]
changed: [testvm2]
TASK [Install a few command line tools]
changed: [testvm2]
TASK [copy latest personal Midnight Commander skin to /usr/share]
changed: [testvm2]
TASK [create ~/.config/mc directory for root]
changed: [testvm2]
TASK [Copy the most current Midnight Commander configuration files to /root/.config/mc]
changed: [testvm2] =&gt; (item=/root/ansible/PostInstallMain/files/MidnightCommander/DavidsGoTar.ini)
changed: [testvm2] =&gt; (item=/root/ansible/PostInstallMain/files/MidnightCommander/ini)
changed: [testvm2] =&gt; (item=/root/ansible/PostInstallMain/files/MidnightCommander/panels.ini)
TASK [create ~/.config/mc directory in /etc/skel]
changed: [testvm2]
&lt;SNIP&gt;
```
### The cow
If you have the [cowsay][7] program installed on your computer, you will notice that the `TASK` names appear in the cow's speech bubble:
```
 ____________________________________
&lt; TASK [Ensure we have connectivity] &gt;
 ------------------------------------
        \   ^__^
         \  (oo)\\_______
            (__)\       )\/\
                ||----w |
                ||     ||
```
If you do not have this fun feature and want it, install the cowsay package using your distribution's package manager. If you have this and don't want it, disable it with by setting `nocows = 1` in the `/etc/ansible/ansible.cfg` file.
I like the cow and think it is fun, but it reduces the amount of screen space that can be used to display messages. So I disabled it after it started getting in the way.
### Files
As with my Midnight Commander task, it is frequently necessary to install and maintain files of various types. There are as many "best practices" for creating a directory tree for storing files used in playbooks as there are sysadmins—or at least as many as the number of authors writing books and articles about Ansible.
I chose a simple structure that makes sense to me:
```
/root/ansible
└── UpdateMC
    ├── files
     └── MidnightCommander
         ├── DavidsGoTar.ini
         ├── ini
         └── panels.ini
    └── UpdateMC.yml
```
You should use whatever structure works for you. Just be aware that some other sysadmin will likely need to work with whatever you set up, so there should be some level of logic to it. When I was using RPM and Bash scripts to perform my post-install tasks, my file repository was a bit scattered and definitely not structured with any logic. As I work through creating playbooks for many of my administrative tasks, I will introduce a much more logical structure for managing my files.
### Multiple playbook runs
It is safe to run a playbook as many times as needed or desired. Each task will only be executed if the state does not match the one specified in the task stanza. This makes it easy to recover from errors encountered during previous playbook runs. The playbook stops running when it encounters an error.
While testing my first playbook, I made many mistakes and corrected them. Each additional run of the playbook—assuming my fix is a good one—skips the tasks whose state already matches the specified one and executes those that did not. When my fix works, the previously failed task completes successfully, and any tasks after that one in my playbook also execute—until it encounters another error.
This also makes testing easy. I can add new tasks and, when I run the playbook, only those new tasks are performed because they are the only ones that do not match the test host's desired state.
### Some thoughts
Some tasks are not appropriate for Ansible because there are better methods for achieving a specific machine state. The use case that comes to mind is that of returning a VM to an initial state so that it can be used as many times as necessary to perform testing beginning with that known state. It is much easier to get the VM into the desired state and then to take a snapshot of the then-current machine state. Reverting to that snapshot is usually going to be easier and much faster than using Ansible to return the host to that desired state. This is something I do several times a day when researching articles or testing new code.
After completing my playbook for updating Midnight Commander, I started a new playbook that I will use to perform post-installation tasks on newly installed Fedora hosts. I have already made good progress, and the playbook is a bit more sophisticated and less brute-force than my first one.
On my very first day using Ansible, I created a playbook that solves a problem. I also started a second playbook that will solve the very big problem of post-install configuration. And I have learned a lot.
Although I really like using [Bash][8] scripts for many of my administrative tasks, I am already finding that Ansible can do everything I want—and in a way that can maintain the system in the state I want. After only a single day of use, I am an Ansible fan.
### Resources
The most complete and useful document I have found is the [User Guide][9] on the Ansible website. This document is intended as a reference and not a how-to or getting-started document.
Opensource.com has published many [articles about Ansible][10] over the years, and I have found most of them very helpful for my needs. The Enable Sysadmin website also has a lot of [Ansible articles][11] that I have found to be helpful. You can learn even more by checking out [AnsibleFest][12] happening this week (October 13-14, 2020). The event is completely virtual and free to register.
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/10/first-day-ansible
作者:[David Both][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/dboth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_linux11x_cc.png?itok=XMDOouJR (People work on a computer server with devices)
[2]: https://www.ansible.com/
[3]: https://www.python.org/
[4]: https://midnight-commander.org/
[5]: https://en.wikipedia.org/wiki/List_of_DNS_record_types
[6]: https://docs.ansible.com/ansible/latest/user_guide/playbooks_vars_facts.html#ansible-facts
[7]: https://en.wikipedia.org/wiki/Cowsay
[8]: https://opensource.com/downloads/bash-cheat-sheet
[9]: https://docs.ansible.com/ansible/latest/user_guide/index.html
[10]: https://opensource.com/tags/ansible
[11]: https://www.redhat.com/sysadmin/topics/ansible
[12]: https://www.ansible.com/ansiblefest

View File

@ -1,74 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Use your Raspberry Pi as a productivity powerhouse)
[#]: via: (https://opensource.com/article/21/1/raspberry-pi-productivity)
[#]: author: (Kevin Sonney https://opensource.com/users/ksonney)
Use your Raspberry Pi as a productivity powerhouse
======
The Raspberry Pi has come a long way from being primarily for hacking
and hobbyists to a solid choice for a small productive workstation.
![Team checklist and to dos][1]
In prior years, this annual series covered individual apps. This year, we are looking at all-in-one solutions in addition to strategies to help in 2021. Welcome to day 16 of 21 Days of Productivity in 2021.
The [Raspberry Pi][2] is a pretty amazing little computer—small, surprisingly powerful, and very easy to set up and use. I have used them for home automation projects, dashboards, and a dedicated media player. But can it be a productivity powerhouse as well?
The answer is, quite simply, yes.
![Geary and Calendar apps on the Raspberry Pi][3]
Geary and Calendar (Kevin Sonney, [CC BY-SA 4.0][4])
The base [Raspbian][5] install includes [Claws Mail][6], which is a lightweight mail client. The UI is a little dated, and it is very bare-bones. If you are a [Mutt user][7], this will probably meet your needs just fine.
I prefer to install [Geary][8] since it is also lightweight and has a modern interface. Also, unlike Claws, Geary has support for rich-text (HTML) email by default. I dislike rich-text email, but it has become necessary, so having good support for it is critical.
The default Raspbian installation does not include a calendar, so I added [GNOME Calendar][9] since it can talk to remote services (since almost all of my calendars are on cloud providers).
![GTG and GNote open on Raspberry Pi][10]
GTG and GNote (Kevin Sonney, [CC BY-SA 4.0][4])
What about notes and to-do lists? There are a lot of options out there, but I'm a fan of [GNote][11] for notes and [Getting-Things-GNOME!][12] for to-do lists. Both are reasonably lightweight and can sync to each other, as well as to other services.
You'll note that I'm using quite a few GNOME applications here. Why not just install the full GNOME Desktop? On the Raspberry Pi 4 with 4Gb (or 8Gb) of memory, GNOME works exceptionally well. You will need to take some extra steps to disable the default wifi setup on Raspbian and replace it with Network Manager, but that is well documented on the internet and really easy.
Included with GNOME is [Evolution][13], which combines mail, calendars, notes, to-do lists, and contact management into a single app. It is a little heavy compared to Geary and GNOME Calendar, but it is rock solid on the Raspberry Pi 4. This was surprising to me since I'm used to Evolution being kind of a resource hog, but the Raspberry Pi 4 runs it as well as my brand-name laptops with resources to spare.
![Evolution on Raspbian][14]
Evolution on Raspbian (Kevin Sonney, [CC BY-SA 4.0][4])
The Raspberry Pi has come a long way in the last few years and has gone from being primarily for hacking and hobbyists to a solid choice for a small productive workstation.
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/1/raspberry-pi-productivity
作者:[Kevin Sonney][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/ksonney
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/todo_checklist_team_metrics_report.png?itok=oB5uQbzf (Team checklist and to dos)
[2]: https://www.raspberrypi.org/
[3]: https://opensource.com/sites/default/files/day16-image1.png
[4]: https://creativecommons.org/licenses/by-sa/4.0/
[5]: https://www.raspbian.org/
[6]: https://www.claws-mail.org/
[7]: http://www.mutt.org/
[8]: https://wiki.gnome.org/Apps/Geary
[9]: https://wiki.gnome.org/Apps/Calendar
[10]: https://opensource.com/sites/default/files/day16-image2.png
[11]: https://wiki.gnome.org/Apps/Gnote
[12]: https://wiki.gnome.org/Apps/GTG
[13]: https://opensource.com/business/18/1/desktop-email-clients
[14]: https://opensource.com/sites/default/files/day16-image3.png

View File

@ -1,5 +1,5 @@
[#]: collector: (lujun9972) [#]: collector: (lujun9972)
[#]: translator: ( ) [#]: translator: (geekpi)
[#]: reviewer: ( ) [#]: reviewer: ( )
[#]: publisher: ( ) [#]: publisher: ( )
[#]: url: ( ) [#]: url: ( )

View File

@ -0,0 +1,63 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (3 wishes for open source productivity in 2021)
[#]: via: (https://opensource.com/article/21/1/productivity-wishlist)
[#]: author: (Kevin Sonney https://opensource.com/users/ksonney)
3 wishes for open source productivity in 2021
======
There are plenty of ways the open source world can expand for 2021. Here
are the three areas I'm particularly interested in.
![Looking at a map for career journey][1]
In prior years, this annual series covered individual apps. This year, we are looking at all-in-one solutions in addition to strategies to help in 2021. Welcome to the final day of 21 Days of Productivity in 2021.
Here we are, at the end of another series. So let's talk about the things I want to see more of in 2021.
### Disconnecting
![Large Lego set built by the author][2]
I built this over the holidays (Kevin Sonney, [CC BY-SA 4.0][3])
For many, many, _many_ people, 2020 was a very difficult year. The pandemic, the various political events, the 24-hour news cycle, and so on took a toll on our mental well-being. And while I did talk about [making time for self-care][4], I only touched on disconnecting—that is, turning off alerts, phones, tablets, etc., and just ignoring the world for a bit. One of the managers in my company actually told us to turn off all our work-related stuff if we had a holiday or a day off (unless we were on call). One of my favorite "disconnect" activities is just listening to music and building big, complex Lego sets.
### Accessibility
While many of the techniques I talked about are something anyone can do, the software aspects all have some difficulty with accessibility. Linux and the open source world have come a long way when it comes to assistive technologies since the early days of the movement. However, there are still far too many applications and systems that do not consider that the user may not have the same abilities as the person who designed them. I am keeping an eye on developments in this area because everyone should be able to access things.
### More all-in-one options
![JPilot all in one organizer software interface][5]
JPilot (Kevin Sonney, [CC BY-SA 4.0][3])
There are nowhere near as many all-in-one Personal Information Manager solutions in the FOSS world as there are in the commercial software world. The overall trend has been to use individual apps that must be configured to talk to each other or through an intermediary service (like a CalDAV server). The mobile market largely drives this trend, but I still yearn for the days when something like [JPilot][6] could do almost everything I needed without extra plugins or services.
Thank you all very much for reading the series year. Please comment with what you think I missed or need to look at for next year.
And as I say on [Productivity Alchemy][7], do your best to Stay Productive!
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/1/productivity-wishlist
作者:[Kevin Sonney][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/ksonney
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/career_journey_road_gps_path_map_520.png?itok=PpL6jJgY (Looking at a map for career journey)
[2]: https://opensource.com/sites/default/files/day21-image1.png
[3]: https://creativecommons.org/licenses/by-sa/4.0/
[4]: https://opensource.com/article/21/1/self-care
[5]: https://opensource.com/sites/default/files/day21-image2.png
[6]: http://www.jpilot.org/
[7]: https://productivityalchemy.com

View File

@ -0,0 +1,72 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to teach open source beyond business)
[#]: via: (https://opensource.com/article/21/1/open-source-beyond-business)
[#]: author: (Irit Goihman https://opensource.com/users/iritgoihman)
How to teach open source beyond business
======
The Beyond program connects future talents in the tech industry with
open source culture.
![Teacher or learner?][1]
When I was a university student, I didn't understand the fuss about open source software. I used Linux and open source software but didn't really understand the open source model, how to contribute to projects, or how it could benefit my future career. My development experience consisted mainly of homework assignments and a large final project required for my degree.
So, when I took my first steps in the tech industry, there was a big learning curve before I felt comfortable. I needed to understand how to join established, sometimes large, and distributed teams working on an ongoing project. I also needed to know how to communicate properly so that my efforts could be recognized.
I am not special in this regard. This is a common situation among new graduates.
### Open source gives students a head start
Since then, as an engineer and later as a manager, I have helped onboard many junior engineers. One of the things I've noticed is that the new graduates who have already contributed to open source projects could onboard quickly and start contributing faster than those without this experience.
By incorporating open source methodology into academic studies, students can gain experience relevant to the industry, learn to reuse their existing knowledge, and establish a good platform for formulating ideas and sharing knowledge. Practicing open source can make a positive impact on students' technical knowledge and experience. This can help them become more successful in bootstrapping their careers.
The value of open source methodologies in the tech industry is well-established and shapes the culture of software companies worldwide. Involvement in open source projects and adoption of the [open organization culture][2] has become an industry standard. Companies seek fresh-minded, talented employees who know how to work in open source and cultivate its culture. Therefore, the tech industry must drive the academic world to embrace open source culture as one of the fundamental methodologies to learn in tech studies.
### Moving open source culture 'Beyond' business
When I met [Liora Milbaum][3], a senior principal software engineer at Red Hat, I learned we shared an interest in bringing open source culture and principles into academics. Liora had previously founded [DevOps Loft][4], in which she shared DevOps practices with people interested in stepping into this world, and wished to start a similar initiative to teach open source to university students. We decided to launch the [Beyond][5] program to connect future talents in the tech industry with open source culture as Red Hat practices it.
We started the Beyond program at the [Academic College of Tel Aviv-Yafo][6], where we were warmly welcomed by the information systems faculty. We started by teaching an "Introduction to DevOps'' course to introduce elements of the DevOps tech stack. Our biggest challenge at the start was deciding how to teach what open source is. The answer was simple: by practicing it, of course. We didn't want to deliver yet another old-school academic course; rather, we wanted to expose students to industry standards.
We created a syllabus that incorporated common open source projects and tools to teach the DevOps stack. The course consisted of lectures and hands-on participation taught by engineers. The students were divided into groups, each one mentored and supported by an engineer. They practiced working in teams, sharing knowledge (both inside and outside of their groups), and collaborating effectively.
During our second course, "Open source development pillars," for students in the computer science department, we encountered another big obstacle. Two weeks after the course started, we became fully remote as the COVID pandemic hit the globe. We solved this problem by using the same remote collaboration tools with our students that we were using for our daily work at Red Hat. We were amazed at how simple and smooth the transition was.
![Beyond teaching online][7]
(Irit Goihman, [CC BY-SA 4.0][8])
### Successful early outcomes
The two courses were a huge success, and we even hired one of the top students we taught. The feedback we received was amazing; the students said we positively impacted their knowledge, thinking, and soft skills. A few students were hired for their first tech job based on their open source contributions during the course.
Other academic institutions have expressed interest in adopting these courses, so we've expanded the program to another university.
I am fortunate to co-lead this successful initiative with Liora, accompanied by a team of talented engineers. Together, we are helping increase the open source community a bit more.
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/1/open-source-beyond-business
作者:[Irit Goihman][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/iritgoihman
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc-lead-teacher-learner.png?itok=rMJqBN5G (Teacher or learner?)
[2]: https://opensource.com/open-organization/resources/open-org-definition
[3]: https://www.linkedin.com/in/lioramilbaum
[4]: https://www.devopsloft.io/
[5]: https://research.redhat.com/blog/2020/05/24/open-source-development-course-and-devops-methodology/
[6]: https://www.int.mta.ac.il/
[7]: https://opensource.com/sites/default/files/pictures/beyond_mta.png (Beyond teaching online)
[8]: https://creativecommons.org/licenses/by-sa/4.0/

View File

@ -0,0 +1,282 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Best Single Board Computers for AI and Deep Learning Projects)
[#]: via: (https://itsfoss.com/best-sbc-for-ai/)
[#]: author: (Community https://itsfoss.com/author/itsfoss/)
Best Single Board Computers for AI and Deep Learning Projects
======
[Single-board computers][1] (SBC) are very popular with tinkerers and hobbyists alike, they offer a lot of functionality in a very small form factor. An SBC has the CPU, GPU, memory, IO ports, etc. on a small circuit board and users can add functionality by adding new devices to the [GPIO ports][2]. Some of the more popular SBCs include the [Raspberry Pi][3] and [Arduino][4] family of products.
However, there is an increasing demand for SBCs that can be used for edge compute applications like Artificial Intelligence (AI) or Deep Learning (DL) and there are quite a few. The list below consists of some of the best SBCs that have been developed for edge computing.
The list is in no particular order of ranking. Some links here are affiliate links. Please read our [affiliate policy][5].
### 1\. Nvidia Jetson Family
Nvidia has a great lineup of SBCs that cater to AI developers and hobbyists alike. Their line of “[Jetson Developer Kits][6]” are some of the most powerful and value for money SBCs available in the market. Below is a list of their offerings.
#### Nvidia Jetson Nano Developer Kit
![][7]
Starting at **$59**, the Jetson Nano is the cheapest SBC in the list and offers a good price to performance ratio. It can run multiple neural networks alongside other applications such as object detection, segmentation, speech processing and image classification.
The Jetson Nano is aimed towards AI enthusiasts, hobbyists and developers who want to do projects by implementing AI.
The Jetson Nano is being offered in two variants: 4 GB and 2 GB. The main differences between the two are, the price, RAM capacity and IO ports being offered. The 4 GB variant has been showcased in the image above.
**Key Specifications**
* **CPU:** Quad-core ARM A57 @ 1.43 GHz
* **GPU:** 128-core NVIDIA Maxwell
* **Memory:** 4 GB 64-bit LPDDR4 @ 25.6 GB/s or 2 GB 64-bit LPDDR4 @ 25.6 GB/s
* **Storage:** microSD card support
* **Display:** HDMI and Display Port or HDMI
Preview | Product | Price |
---|---|---|---
![NVIDIA Jetson Nano 2GB Developer Kit \(945-13541-0000-000\)][8] ![NVIDIA Jetson Nano 2GB Developer Kit \(945-13541-0000-000\)][8] | [NVIDIA Jetson Nano 2GB Developer Kit (945-13541-0000-000)][9] | $59.00[][10] | [Buy on Amazon][11]
#### Nvidia Jetson Xavier NX Developer Kit
![][12]
The Jetson Xavier NX is a step up from the Jetson Nano and is aimed more towards OEMs, start-ups and AI developers.
The Jetson Xavier NX is meant for applications that need more serious AI processing power that an entry level offering like the Jetson Nano simply cant deliver. The Jetson Xavier NX is being offered at **$386.99**.
**Key Specifications**
* **CPU:** 6-core NVIDIA Carmel ARM v8.2 64-bit CPU
* **GPU:** NVIDIA Volta architecture with 384 NVIDIA CUDA cores and 48 Tensor cores
* **DL Accelerator:** 2x NVDLA Engines
* **Vision Accelerator:** 7-Way VLIW Vision Processor
* **Memory:** 8 GB 128-bit LPDDR4x @ 51.2 GB/s
* **Storage:** microSD support
* **Display:** HDMI and Display Port
Preview | Product | Price |
---|---|---|---
![NVIDIA Jetson Xavier NX Developer Kit \(812674024318\)][13] ![NVIDIA Jetson Xavier NX Developer Kit \(812674024318\)][13] | [NVIDIA Jetson Xavier NX Developer Kit (812674024318)][14] | $386.89[][10] | [Buy on Amazon][15]
#### Nvidia Jetson AGX Xavier Developer Kit
![][16]
The Jetson AGX Xavier is the flagship product of the Jetson family, it is meant to be deployed in servers and AI robotics applications in industries such as manufacturing, retail, automobile, agriculture, etc.
Coming in at **$694.91**, the Jetson AGX Xavier is not meant for beginners, it is meant for developers who want top-tier edge compute performance at their disposal and for companies who want good scalability for their applications.
**Key Specifications**
* **CPU:** 8-core ARM v8.2 64-bit CPU
* **GPU:** 512-core Volta GPU with Tensor Cores
* **DL Accelerator:** 2x NVDLA Engines
* **Vision Accelerator:** 7-Way VLIW Vision Processor
* **Memory:** 32 GB 256-Bit LPDDR4x @ 137 GB/s
* **Storage:** 32 GB eMMC 5.1 and uSD/UFS Card Socket for storage expansion
* **Display:** HDMI 2.0
Preview | Product | Price |
---|---|---|---
![NVIDIA Jetson AGX Xavier Developer Kit \(32GB\)][17] ![NVIDIA Jetson AGX Xavier Developer Kit \(32GB\)][17] | [NVIDIA Jetson AGX Xavier Developer Kit (32GB)][18] | $694.91[][10] | [Buy on Amazon][19]
### 2\. ROCK Pi N10
![][20]
The ROCK Pi N10, developed by [Radxa][21] is the second cheapest offering in this list with its base variant coming in at **$99**, its range topping variant comes in at **$169**,
The ROCK Pi N10 is equipped with a NPU (Neural Processing Unit) that helps it in processing AI/ Deep Learning workloads with ease. It offers up to 3 TOPS (Tera Operations Per Second) of performance.
It is being offered in three variants namely, ROCK Pi N10 Model A, ROCK Pi N10 Model B, ROCK Pi N10 Model C, the only differences between these variants are the price, RAM and Storage capacities.
The ROCK Pi N10 is available for purchase through [Seeed Studio][22].
**Key Specifications**
* **CPU:** RK3399Pro with 2-core Cortex-A72 @ 1.8 GHz and 4-Core Cortex-A53 @ 1.4 GHz
* **GPU:** Mali T860MP4
* **NPU:** Supports 8bit/16bit computing with up to 3.0 TOPS computing power
* **Memory:** 4 GB/6 GB/8 GB 64-bit LPDDR3 @ 1866 Mb/s
* **Storage:** 16 GB/32 GB/64 GB eMMC
* **Display:** HDMI 2.0
### 3\. BeagleBone AI
![][23]
The BeagleBone AI is [BeagleBoard.org][24]s open source SBC is meant to bridge the gap between small SBCs and more powerful industrial computers. The hardware and software of the BeagleBoard are completely open source.
It is meant for use in the automation of homes, industries and other commercial use cases. It is priced at **~$110**, the price varies across dealers, for more info check [their website][25].
**Key Specifications**
* **CPU:** Texas Instrument AM5729 with Dual-core ARM Cortex-A15 @ 1.5GHz
* **Co-Processor:** 2 x Dual-core ARM Cortex-M4
* **DSP:** 2 x C66x floating-point VLIW
* **EVE:** 4 x Embedded Vision Engines
* **GPU:** PowerVR SGX544
* **RAM:** 1 GB
* **Storage:** 16 GB eMMC
* **Display:** microHDMI
Preview | Product | Price |
---|---|---|---
![BeagleBone AI][26] ![BeagleBone AI][26] | [BeagleBone AI][27] | $127.49[][10] | [Buy on Amazon][28]
### 4\. BeagleV
![][29]
The BeagleV is the latest launch in the list, it is an SBC that runs Linux out of the box and has a [RISC-V][30] CPU.
It is capable of running edge compute applications effortlessly, to know more about the BeagleV check [our coverage][31] of the launch.
The BeagleV will be getting two variants, a 4 GB RAM variant and an 8 GB RAM variant. Pricing starts at **$119** for the base model and **$149** for the 8 GB RAM model, it is up for pre-order through [their website][32].
**Key Specifications**
* **CPU:** RISC-V U74 2-Core @ 1.0GHz
* **DSP:** Vision DSP Tensilica-VP6
* **DL Accelerator:** NVDLA Engine 1-core
* **NPU:** Neural Network Engine
* **RAM:** 4 GB/8 GB (2 x 4 GB) LPDDR4 SDRAM
* **Storage:** microSD slot
* **Display:** HDMI 1.4
### 5\. HiKey970
![][33]
HiKey970 is [96 Boards][34] first SBC meant for edge compute applications and is the worlds first dedicated NPU AI platform.
The HiKey970 features an CPU, GPU and an NPU for accelerating AI performance, it can also be used for training and building DL (Deep Learning) models.
The HiKey970 is priced at **$299** and can be bought from their [official store][35].
**Key Specifications**
* **SoC:** HiSilicon Kirin 970
* **CPU:** ARM Cortex-A73 4-Core @ 2.36GHz and ARM Cortex-A53 4-Core @ 1.8GHz
* **GPU:** ARM Mali-G72 MP12
* **RAM:** 6 GB LPDDR4X @ 1866MHz
* **Storage:** 64 GB UFS 2.1 microSD
* **Display:** HDMI and 4 line MIPI/LCD port
### 6\. Google Coral Dev Board
![][36]
The Coral Dev Board is Googles first attempt at an SBC dedicated for edge computing. It is capable of performing high speed ML (Machine Learning) inferencing and has support for TensorFlow Lite and AutoML Vision Edge.
The board is priced at **$129.99** and is available through [Corals official website][37].
**Key Specifications**
* **CPU:** NXP i.MX 8M SoC (4-Core Cortex-A53, Cortex-M4F)
* **ML Accelerator**: Google Edge TPU coprocessor
* **GPU:** Integrated GC7000 Lite Graphics
* **RAM:** 1 GB LPDDR4
* **Storage:** 8 GB eMMC and microSD slot
* **Display:** HDMI 2.0a, 39-pin FFC connector for MIPI-DSI display (4-lane) and 24-pin FFC connector for MIPI-CSI2 camera (4-lane)
### 7\. Google Coral Dev Board Mini
![][38]
The Coral Dev Board Mini is the successor to the Coral Dev Board, it packs in more processing power into a smaller form factor and a lower price point of **$99.99**.
The Coral Dev Board Mini can be purchased from their [official web store][39].
**Key Specifications**
* **CPU:** MediaTek 8167s SoC (4-core Arm Cortex-A35)
* **ML Accelerator:** Google Edge TPU coprocessor
* **GPU:** IMG PowerVR GE8300
* **RAM:** 2 GB LPDDR3
* **Storage:** 8 GB eMMC
* **Display:** micro HDMI (1.4), 24-pin FFC connector for MIPI-CSI2 camera (4-lane) and 24-pin FFC connector for MIPI-DSI display (4-lane)
Preview | Product | Price |
---|---|---|---
![Google Coral Dev Board Mini][40] ![Google Coral Dev Board Mini][40] | [Google Coral Dev Board Mini][41] | $99.99[][10] | [Buy on Amazon][42]
### Closing Thoughts
There is an SBC available in every price range for edge compute applications. Some are just basic, like the Nvidia Jetson Nano or the BeagleBone AI and some are performance oriented models like the BeagleV and Nvidia Jetson AGX Xavier.
If you are looking for something more universal you can check [our article on Raspberry Pi alternatives][1] that could help you in finding a suitable SBC for your use case.
If I missed any SBC dedicated for edge compute, feel free to let me know in the comments below.
_**Author info: Sourav Rudra is a FOSS Enthusiast with love for Gaming Rigs/Workstation building.**_
--------------------------------------------------------------------------------
via: https://itsfoss.com/best-sbc-for-ai/
作者:[Community][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/itsfoss/
[b]: https://github.com/lujun9972
[1]: https://itsfoss.com/raspberry-pi-alternatives/
[2]: https://en.wikipedia.org/wiki/General-purpose_input/output
[3]: https://www.raspberrypi.org/products/
[4]: https://www.arduino.cc/en/main/products
[5]: https://itsfoss.com/affiliate-policy/
[6]: https://developer.nvidia.com/embedded/jetson-developer-kits
[7]: https://i0.wp.com/news.itsfoss.com/wp-content/uploads/2021/01/Nvidia-Jetson-Nano.png?ssl=1
[8]: https://i1.wp.com/m.media-amazon.com/images/I/310YWrfdnTL._SL160_.jpg?ssl=1
[9]: https://www.amazon.com/dp/B08J157LHH?tag=chmod7mediate-20&linkCode=osi&th=1&psc=1 (NVIDIA Jetson Nano 2GB Developer Kit (945-13541-0000-000))
[10]: https://www.amazon.com/gp/prime/?tag=chmod7mediate-20 (Amazon Prime)
[11]: https://www.amazon.com/dp/B08J157LHH?tag=chmod7mediate-20&linkCode=osi&th=1&psc=1 (Buy on Amazon)
[12]: https://i1.wp.com/news.itsfoss.com/wp-content/uploads/2021/01/Nvidia-Jetson-Xavier-NX.png?ssl=1
[13]: https://i1.wp.com/m.media-amazon.com/images/I/31B9xMmCvwL._SL160_.jpg?ssl=1
[14]: https://www.amazon.com/dp/B086874Q5R?tag=chmod7mediate-20&linkCode=ogi&th=1&psc=1 (NVIDIA Jetson Xavier NX Developer Kit (812674024318))
[15]: https://www.amazon.com/dp/B086874Q5R?tag=chmod7mediate-20&linkCode=ogi&th=1&psc=1 (Buy on Amazon)
[16]: https://i1.wp.com/news.itsfoss.com/wp-content/uploads/2021/01/Nvidia-Jetson-AGX-Xavier-.png?ssl=1
[17]: https://i1.wp.com/m.media-amazon.com/images/I/41tO5hw4zHL._SL160_.jpg?ssl=1
[18]: https://www.amazon.com/dp/B083ZL3X5B?tag=chmod7mediate-20&linkCode=ogi&th=1&psc=1 (NVIDIA Jetson AGX Xavier Developer Kit (32GB))
[19]: https://www.amazon.com/dp/B083ZL3X5B?tag=chmod7mediate-20&linkCode=ogi&th=1&psc=1 (Buy on Amazon)
[20]: https://i2.wp.com/news.itsfoss.com/wp-content/uploads/2021/01/ROCK-Pi-N10.png?ssl=1
[21]: https://wiki.radxa.com/Home
[22]: https://www.seeedstudio.com/ROCK-Pi-4-c-1323.html?cat=1343
[23]: https://i1.wp.com/news.itsfoss.com/wp-content/uploads/2021/01/Beagle-AI.png?ssl=1
[24]: https://beagleboard.org/
[25]: https://beagleboard.org/ai
[26]: https://i2.wp.com/m.media-amazon.com/images/I/41K+htPCUHL._SL160_.jpg?ssl=1
[27]: https://www.amazon.com/dp/B07YR1RV64?tag=chmod7mediate-20&linkCode=ogi&th=1&psc=1 (BeagleBone AI)
[28]: https://www.amazon.com/dp/B07YR1RV64?tag=chmod7mediate-20&linkCode=ogi&th=1&psc=1 (Buy on Amazon)
[29]: https://i2.wp.com/news.itsfoss.com/wp-content/uploads/2021/01/BeagleV.png?ssl=1
[30]: https://en.wikipedia.org/wiki/RISC-V
[31]: https://news.itsfoss.com/beaglev-announcement/
[32]: https://beaglev.seeed.cc/
[33]: https://i0.wp.com/news.itsfoss.com/wp-content/uploads/2021/01/HiKey970.png?ssl=1
[34]: https://www.96boards.org/
[35]: https://www.96boards.org/product/hikey970/
[36]: https://i1.wp.com/news.itsfoss.com/wp-content/uploads/2021/01/Google-Coral-Dev-Board.png?ssl=1
[37]: https://coral.ai/products/dev-board/
[38]: https://i0.wp.com/news.itsfoss.com/wp-content/uploads/2021/01/Google-Coral-Dev-Board-Mini.png?ssl=1
[39]: https://coral.ai/products/dev-board-mini
[40]: https://i0.wp.com/m.media-amazon.com/images/I/41g5c6IwLmL._SL160_.jpg?ssl=1
[41]: https://www.amazon.com/dp/B08QLXKJB7?tag=chmod7mediate-20&linkCode=ogi&th=1&psc=1 (Google Coral Dev Board Mini)
[42]: https://www.amazon.com/dp/B08QLXKJB7?tag=chmod7mediate-20&linkCode=ogi&th=1&psc=1 (Buy on Amazon)

View File

@ -0,0 +1,297 @@
[#]: collector: "lujun9972"
[#]: translator: "MjSeven"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
[#]: subject: "My first day using Ansible"
[#]: via: "https://opensource.com/article/20/10/first-day-ansible"
[#]: author: "David Both https://opensource.com/users/dboth"
使用 Ansible 的第一天
======
一名系统管理员分享了如何使用 Ansible 在网络中配置计算机并把其带入实际工作的信息和建议。
![People work on a computer server with devices][1]
无论是第一次还是第五十次,启动并运行一台新的物理或虚拟计算机都非常耗时,而且需要大量的工作。多年来,我一直使用我创建的一系列脚本和 RPM 来安装所需的软件包,并为我喜欢的工具配置选项。这种方法效果很好,简化了我的工作,而且还减少了在键盘上输入命令的时间。
我一直在寻找更好的工作方式。近几年来,我一直在听到并且读到有关 [Ansible][2] 的信息它是一个自动配置和管理系统的强大工具。Ansible 允许系统管理员在一个或多个剧本中为每个主机指定一个特定状态,然后执行使主机进入该状态的所有任务。包括安装或删除各种资源,例如 RPM 或 Apt 软件包、配置和其它文件、用户、组等等。
因为一些琐事,我推迟了很长一段时间学习如何使用它。直到最近,我遇到了一个我认为 Ansible 可以轻松解决的问题。
这篇文章并不会完整地告诉你如何入门 Ansible相反它只是对我遇到的问题和我在一些隐秘的地方发现的信息的做一些记录。我在各种在线讨论和问答小组中找到的有关 Ansible 的许多信息都是错误的。错误范围包括明显的老旧信息(没有任何日期或来源的迹象),还有一些是完全错误的信息。
本文所介绍的内容是有用的,尽管可能还有其它方法可以完成相同的事情,但我使用的是 Ansible 2.9.13 和 [Python][3] 3.8.5。
### 我的问题
我所有的最佳学习经历都始于我需要解决的问题,这次也不例外。
我一直在做一个小项目,修改 [Midnight Commander][4] 文件管理器的配置文件,并将它们推送到我网络上的各种系统中进行测试。尽管我有一个脚本可以自动执行这个操作,但它仍然需要使用命令行循环来提供我想要推送新代码的系统名称。我对配置文件进行了大量的更改,这使我必须频繁推送新的配置文件。但是,就在我以为我的新配置刚刚好时,我发现了一个问题,所以我需要在修复后再进行一次推送。
这种环境使得很难跟踪哪些系统有新文件,哪些没有。我还有几个主机需要区别对待。我对 Ansible 的一点了解表明,它可能能够满足我的全部或大部分工作。
### 开始
我读过许多有关 Ansible 的好文章和书籍,但从来没有遇到过“我必须把这个用到工作中”那种情况。但是,现在就是这种情况。
在重读这些文档时,我发现它们主要是在讨论如何从 GitHub 开始安装并使用 Ansible这很酷。但是我真的只是想尽快开始所以我使用 DNF 和 Fedora 仓库中的版本在我的 Fedora 工作站上安装了它,非常简单。
但是后来我开始寻找文件位置,并尝试确定需要修改哪些配置文件、将我的剧本保存在什么位置,甚至一个剧本怎么写以及它的作用,我脑海中有一大堆(到目前为止)悬而未决的问题。
因此,在没有进一步描述我的困难的情况下,以下是我发现的东西以及促使我继续前进的东西。
### 配置
Ansible 的配置文件保存在 `/etc/ansible` 中,这很有道理,因为 `/etc/` 是系统程序应该保存配置文件的地方。我需要使用的两个文件是 `ansible.cfg``hosts`
#### ansible.cfg
在进行文档和线上找到的一些实践练习之后,我遇到了一些有关弃用某些较旧的 Python 文件的警告信息。因此,我在 `ansible.cfg` 中将 `deprecation_warnings` 设置为 `false`,这样那些愤怒的红色警告消息就不会出现了:
```bash
deprecation_warnings = False
```
这些警告很重要,所以我稍后将重新回顾它们,并弄清楚我需要做什么。但是现在,它们不会再扰乱屏幕,也不会让我混淆实际上需要关注的错误。
#### hosts 文件
`/etc/hosts` 文件不同,`hosts` 文件也被称为清单文件,它列出了网络上的主机。此文件允许将主机分组到相关集合中,例如服务器、工作站和任何你所需的名称。这个文件包含帮助和大量示例,所以我在这里就不详细介绍了。但是,有些事情你必须知道。
主机可以在任何组之外列出,但是组对于识别具有一个或多个共同特征的主机很有帮助。组使用 INI 格式,所以服务器组看起来像这样:
```
[servers]
server1
server2
...etc.
```
这个文件中必须有一个主机名,这样 Ansible 才能对它进行操作。尽管有些子命令允许指定主机名,但除非主机名在 `hosts` 文件中,否则命令会失败。一个主机也可以在多个组中。因此,除了 `[servers]` 组之外,`server1` 也可能是 `[webservers]` 组的成员,还可以是 `[ubuntu]` 组的成员,这样以区别于 Fedora 服务器。
Ansible 很智能。如果 `all` 参数用作主机名Ansible 会扫描 `hosts` 文件并在它列出的所有主机上执行定义的任务。Ansible 只会尝试在每个主机上工作一次,不管它出现在多少个组中。这也意味着不需要定义 "all" 组,因为 Ansible 可以确定文件中的所有主机名,并创建自己唯一的主机名列表。
另一件需要注意的事情是单个主机的多个条目。我在 DNS 文件中使用 `CNAME` 记录来创建别名,这些别名指向某些主机的 [A 记录][5],这样,我可以将一个主机称为 `host1``h1``myhost`。如果你在 `hosts` 文件中为同一主机指定多个主机名,则 Ansible 将尝试在所有这些主机名上执行其任务,它无法知道它们指向同一主机。好消息是,这并不会影响整体结果;它只是多花了一点时间,因为 Ansible在辅助主机名上工作它会确定所有操作均已执行。
### Ansible facts
我阅读过 Ansible 的大多数材料都谈到了 [Ansible facts][6]它是与远程系统相关的数据包括操作系统、IP 地址、文件系统等等。这些信息可以通过其它方式获得,如 `lshw`、`dmidecode` 或 `/proc` 文件系统等。但是 Ansible 会生成一个包含此信息的 JSON 文件。每次 Ansible 运行时,它都会生成这些数据。在这个数据流中,有大量的信息都是键值对形式:`<"变量名": "值">`。所有这些变量都可以在 Ansible 剧本中使用,理解海量信息的最好方法是亲自实践:
```bash
# ansible -m setup <hostname> | less
```
明白了吗?你想知道的有关主机硬件和 Linux 发行版的所有内容都在这里,它们都可以在剧本中使用。我还没有达到需要使用这些变量的地步,但是我相信在接下来的几天中会用到。
### 模块
`ansible` 命令使用 `-m` 选项来指定 `setup` 模块。Ansible 已经内置了许多模块,所以你不需要使用 -m。也可以安装许多下载的模块但是内置模块可以完成我目前项目所需的一切。
### 剧本
剧本可以放在任何地方。因为我需要以 root 身份运行,所以我将它放在了 `/root/ansible` 下。当我运行 Ansible 时,只要这个目录是当前的工作目录(PWD)它就可以找到我的剧本。Ansible 还有一个选项,用于在运行时指定其它剧本和位置。
剧本可以包含注释,但是我看到的文章或书籍很少提及此。作为一个相信记录的系统管理员,我发现使用注释很有帮助。这并不是和任务名称做同样的事情,而是要确定任务组的目的,并确保我以某种方式或顺序记录我做这些事情的原因。当我可能忘记最初的想法时,这可以帮助以后解决调试问题。
剧本只是定义主机所需状态的任务集合。在剧本的开头指定主机名或目录组,并定义 Ansible 将在其上运行剧本的主机。
以下是我的一个剧本示例:
```bash
################################################################################
# This Ansible playbook updates Midnight commander configuration files.        #
################################################################################
\- name: Update midnight commander configuration files
  hosts: all
 
  tasks:
  - name: ensure midnight commander is the latest version
    dnf:
      name: mc
      state: present
  - name: create ~/.config/mc directory for root
    file:
      path: /root/.config/mc
      state: directory
      mode: 0755
      owner: root
      group: root
  - name: create ~/.config/mc directory for dboth
    file:
      path: /home/dboth/.config/mc
      state: directory
      mode: 0755
      owner: dboth
      group: dboth
  - name: copy latest personal skin
    copy:
      src: /root/ansible/UpdateMC/files/MidnightCommander/DavidsGoTar.ini
      dest: /usr/share/mc/skins/DavidsGoTar.ini
      mode: 0644
      owner: root
      group: root
  - name: copy latest mc ini file
    copy:
      src: /root/ansible/UpdateMC/files/MidnightCommander/ini
      dest: /root/.config/mc/ini
      mode: 0644
      owner: root
      group: root
  - name: copy latest mc panels.ini file
    copy:
      src: /root/ansible/UpdateMC/files/MidnightCommander/panels.ini
      dest: /root/.config/mc/panels.ini
      mode: 0644
      owner: root
      group: root
&lt;SNIP&gt;
```
剧本从它自己的名字和它将要操作的主机开始,在本文中,所有主机都在我的 `hosts` 文件中。`tasks` 部分列出了使主机达到所需状态的特定任务。这个剧本从使用 DNF 更新 Midnight Commander 开始(如果它不是最新的版本的话)。下一个任务确保创建所需的目录(如果它们不存在),其余任务将文件复制到合适的位置,这些 `file``copy` 任务还可以为目录和文件设置所有权和文件模式。
剧本细节超出了本文的范围,但是我对这个问题使用了一点蛮力。还有其它方法可以确定哪些用户需要更新文件,而不是对每个用户的每个文件使用一个任务。我的下一个目标是简化这个剧本,使用一些更先进的技术。
运行剧本很容易,只需要使用 `ansible-playbook` 命令。.yml 扩展名代表 YAML我看到过它的几种不同含义但我认为它是“另一种标记语言”尽管有些人声称 YAML 不是这种语言。
这个命令将会运行剧本,它会更新 Midnight Commander 文件:
```bash
# ansible-playbook -f 10 UpdateMC.yml
```
`-f` 选项指定 Ansible 使用 10 个线程来执行操作。这可以大大加快整个任务的完成速度,特别是在多台主机上工作时。
### 输出
剧本运行时会列出每个任务和执行结果。`ok` 代表任务管理的机器状态已经完成,因为在任务中定义的状态已经为真,所以 Ansible 不需要执行任何操作。
`changed` 表示 Ansible 已经执行了指定的任务。在这种情况下,任务中定义的机器状态不为真,所以执行指定的操作使其为真。在彩色终端上,`TASK` 线会显示彩色。在我的咖啡色终端的主机上,`TASK` 线显示为琥珀色,`changed` 是棕色,`ok` 为绿色,错误是红色。
下面的输出是我最终用于在新主机执行安装后配置的剧本:
```bash
PLAY [Post-installation updates, package installation, and configuration]
TASK [Gathering Facts]
ok: [testvm2]
TASK [Ensure we have connectivity]
ok: [testvm2]
TASK [Install all current updates]
changed: [testvm2]
TASK [Install a few command line tools]
changed: [testvm2]
TASK [copy latest personal Midnight Commander skin to /usr/share]
changed: [testvm2]
TASK [create ~/.config/mc directory for root]
changed: [testvm2]
TASK [Copy the most current Midnight Commander configuration files to /root/.config/mc]
changed: [testvm2] =&gt; (item=/root/ansible/PostInstallMain/files/MidnightCommander/DavidsGoTar.ini)
changed: [testvm2] =&gt; (item=/root/ansible/PostInstallMain/files/MidnightCommander/ini)
changed: [testvm2] =&gt; (item=/root/ansible/PostInstallMain/files/MidnightCommander/panels.ini)
TASK [create ~/.config/mc directory in /etc/skel]
changed: [testvm2]
&lt;SNIP&gt;
```
### cowsay
如果你的计算机上安装了 [cowsay][7] 程序,你会发现 `TASK` 的名字出现在奶牛的语音泡泡中:
```
 ____________________________________
&lt; TASK [Ensure we have connectivity] &gt;
 ------------------------------------
        \   ^__^
         \  (oo)\\_______
            (__)\       )\/\
                ||----w |
                ||     ||
```
如果你没有这个有趣的程序,你可以使用发行版的包管理器安装 Cowsay 程序。如果你有这个程序但不想要它,可以通过在 `/etc/ansible/ansible.cfg` 文件中设置 `nocows=1` 将其禁用。
我喜欢这头奶牛,它很有趣,但是它会占用我的一部分屏幕。因此,在它开始妨碍我使用时,我就把它禁用了。
### 目录
与我的 Midnight Commander 任务一样,经常需要安装和维护各种类型的文件。创建用于存储剧本的目录树的“最佳实践”和系统管理员一样多,至少与编写有关 Ansible 书和文章的作者数量一样多。
我选择了一个对我有意义的简单结构:
```bash
/root/ansible
└── UpdateMC
    ├── files
     └── MidnightCommander
         ├── DavidsGoTar.ini
         ├── ini
         └── panels.ini
    └── UpdateMC.yml
```
你可以使用任何结构。但是请注意,其它系统管理员可能需要使用你设置的剧本来工作,所以目录应该具有一定程度的逻辑。当我使用 RPM 和 Bash 脚本执行安装任务后,我的文件仓库有点分散,而且绝对没有任何逻辑结构。当我为许多管理任务创建剧本时,我将介绍一个更有逻辑的结构来管理我的目录。
### 多个剧本运行
根据需要或期望多次运行剧本是安全的。只有当主机状态与任务中指定的状态不匹配时,才会执行每个任务。这使得很容易从先前的剧本运行中遇到的错误中恢复。因为当剧本遇到错误时,它将停止运行。
在测试我的第一个剧本时,我犯了很多错误并改正了它们。假设我的修正正确,那么剧本每次运行,都会跳过那些状态已与指定状态匹配的任务,执行不匹配状态的任务。当我的修复程序起作用时,前面失败的任务将成功完成,并且会执行此任务之后的任务--直到遇到另一个错误。
这使得测试变得容易。我可以添加新任务,并且在运行剧本时,只有新任务会被执行,因为它们是唯一与测试主机期望状态不匹配的任务。
### 一些想法
有些任务不适合用 Ansible因为有更好的方法可以实现特定的计算机状态。我想到的场景是使 VM 返回到初始状态,以便可以多次使用它来执行从已知状态开始的测试。让 VM 进入特定状态,然后对此时的计算机状态进行快照要容易得多。还原到该快照通常比 Ansible 将主机返回到之前状态相比,还原到快照通常会更容易且更快。在研究文章或测试新代码时,我每天都会做几次这样的事情。
在完成用于更新 Midnight Commander 的剧本之后,我创建了一个新的剧本,用于在新安装的 Fedora 主机上执行安装任务。我已经取得了不错的进步,剧本比我第一个的更加复杂,但没有那么粗暴。
在使用 Ansible 的第一天,我创建了一个解决问题的剧本,我还开始编写第二个剧本,它将解决安装后配置的大问题,在这个过程中我学到了很多东西。
尽管我真的很喜欢使用 [Bash][8] 脚本来管理任务,但是我发现 Ansible 可以完成我想要的一切,并且可以使系统保持在我所需的状态。只用了一天,我就成为了 Ansible 的粉丝。
### 资源
我找到的最完整、最有用的参考文档是 Ansible 网站上的[用户指南][9]。本文仅供参考,不作为入门文档。
多年来Opensource.com 已经发布了许多[有关 Ansible 的文章][10]我发现其中大多数对我的需求很有帮助。Enable Sysadmin 网站上也有很多对我有帮助 [Ansible 文章][11]。你可以通过查看本周2020 年 10 月 13 日至 14 日)的 [AnsibleFest][12] 了解更多信息。该活动完全是虚拟的,可以免费注册。
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/10/first-day-ansible
作者:[David Both][a]
选题:[lujun9972][b]
译者:[MjSeven](https://github.com/MjSeven)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/dboth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_linux11x_cc.png?itok=XMDOouJR "People work on a computer server with devices"
[2]: https://www.ansible.com/
[3]: https://www.python.org/
[4]: https://midnight-commander.org/
[5]: https://en.wikipedia.org/wiki/List_of_DNS_record_types
[6]: https://docs.ansible.com/ansible/latest/user_guide/playbooks_vars_facts.html#ansible-facts
[7]: https://en.wikipedia.org/wiki/Cowsay
[8]: https://opensource.com/downloads/bash-cheat-sheet
[9]: https://docs.ansible.com/ansible/latest/user_guide/index.html
[10]: https://opensource.com/tags/ansible
[11]: https://www.redhat.com/sysadmin/topics/ansible
[12]: https://www.ansible.com/ansiblefest

View File

@ -0,0 +1,73 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Use your Raspberry Pi as a productivity powerhouse)
[#]: via: (https://opensource.com/article/21/1/raspberry-pi-productivity)
[#]: author: (Kevin Sonney https://opensource.com/users/ksonney)
将你的树莓派用作生产力源泉
======
树莓派已经从主要为 hack 和业余爱好者服务,成为了小型生产力工作站的可靠选择。
![Team checklist and to dos][1]
在前几年,这个年度系列涵盖了单个的应用。今年,我们除了关注 2021 年的策略外,还将关注一体化解决方案。欢迎来到 2021 年 21 天生产力的第十六天。
[树莓派][2]是一台相当棒的小电脑。它体积小,功能却出奇的强大,而且非常容易设置和使用。我曾将它们用于家庭自动化项目、面板和专用媒体播放器。但它也能成为生产力的动力源泉么?
答案相当简单:是的。
![Geary and Calendar apps on the Raspberry Pi][3]
Geary 和 Calendar 应用 Kevin Sonney, [CC BY-SA 4.0][4]
基本的 [Raspbian][5] 安装包括 [Claw Mail][6],这是一个轻量级的邮件客户端。它的用户界面有点过时了,而且非常的简陋。如果你是一个 [Mutt 用户][7],它可能会满足你的需求。
我更喜欢安装 [Geary][8],因为它也是轻量级的,而且有一个现代化的界面。另外,与 Claws 不同的是Geary 默认支持富文本 HTML 邮件。我不喜欢富文本电子邮件,但它已经成为必要的,所以对它有良好的支持是至关重要的。
默认的 Raspbian 安装不包含日历,所以我添加了 [GNOME Calendar][9] ,因为它可以与远程服务通信(因为我的几乎所有日历都在云提供商那里)。
![GTG and GNote open on Raspberry Pi][10]
GTG 和 GNoteKevin Sonney, [CC BY-SA 4.0][4]
那笔记和待办事项清单呢?有很多选择,但我喜欢用 [GNote][11] 来做笔记,用 [Getting-Things-GNOME!][12] 来做待办事项。两者都相当轻量级,并且可以相互同步,也可以同步到其他服务。
你会注意到,我在这里使用了不少 GNOME 应用。为什么不直接安装完整的 GNOME 桌面呢?在内存为 4Gb或 8Gb的树莓派 4 上GNOME 工作得很好。你需要采取一些额外的步骤来禁用 Raspbian 上的默认 wifi 设置,并用 Network Manager 来代替它,但这个在网上有很好的文档,而且真的很简单。
GNOME 中包含了 [Evolution][13],它将邮件、日历、笔记、待办事项和联系人管理整合到一个应用中。与 Geary 和 GNOME Calendar 相比,它有点重,但在树莓派 4 上却很稳定。这让我很惊讶,因为我习惯了 Evolution 有点消耗资源,但树莓派 4 却和我的品牌笔记本一样运行良好,而且资源充足。
![Evolution on Raspbian][14]
Raspbian 上的 Evolution Kevin Sonney, [CC BY-SA 4.0][4]
树莓派在过去的几年里走过了很长的路,已经从主要为 hack 和业余爱好者服务,成为了小型生产力工作站的可靠选择。
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/1/raspberry-pi-productivity
作者:[Kevin Sonney][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/ksonney
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/todo_checklist_team_metrics_report.png?itok=oB5uQbzf (Team checklist and to dos)
[2]: https://www.raspberrypi.org/
[3]: https://opensource.com/sites/default/files/day16-image1.png
[4]: https://creativecommons.org/licenses/by-sa/4.0/
[5]: https://www.raspbian.org/
[6]: https://www.claws-mail.org/
[7]: http://www.mutt.org/
[8]: https://wiki.gnome.org/Apps/Geary
[9]: https://wiki.gnome.org/Apps/Calendar
[10]: https://opensource.com/sites/default/files/day16-image2.png
[11]: https://wiki.gnome.org/Apps/Gnote
[12]: https://wiki.gnome.org/Apps/GTG
[13]: https://opensource.com/business/18/1/desktop-email-clients
[14]: https://opensource.com/sites/default/files/day16-image3.png