diff --git a/sources/tech/20161007 Deploy containers with Atomic Host, Ansible, and Cockpit.md b/sources/tech/20161007 Deploy containers with Atomic Host, Ansible, and Cockpit.md index ed21e69fc2..67531dc0a1 100644 --- a/sources/tech/20161007 Deploy containers with Atomic Host, Ansible, and Cockpit.md +++ b/sources/tech/20161007 Deploy containers with Atomic Host, Ansible, and Cockpit.md @@ -1,18 +1,16 @@ -translating by Bestony -Deploy containers with Atomic Host, Ansible, and Cockpit -==== +# 使用Atomic Host,Ansible和Cockpit部署容器 ![atomic-ansible-cockpit-containers](https://i0.wp.com/cdn.fedoramagazine.org/wp-content/uploads/2016/09/atomic-ansible-cockpit-containers.jpg?fit=945%2C400&ssl=1) -In the course of my job at [Red Hat](https://www.redhat.com/), I work with [Docker](https://www.docker.com/) containers on [Fedora Atomic host](https://getfedora.org/en/cloud/download/atomic.html) every day. The Atomic Host from [Project Atomic](http://www.projectatomic.io/) is a lightweight container OS that can run Linux containers in Docker format. It’s been modified for efficiency, making it optimal to use as a Docker run-time system for cloud environments. +在我在[红帽](https://www.redhat.com/)工作的过程中, 我每天在 [Fedora Atomic host](https://getfedora.org/en/cloud/download/atomic.html) 上使用 [Docker](https://www.docker.com/). 来自[Project Atomic](http://www.projectatomic.io/)的Atomic Host是一个轻量级容器操作系统,可以以Docker格式运行Linux容器。它为提高效率被修改,使其成为用于云环境的Docker运行时系统的最佳选择。 -Fortunately I’ve found a great way to manage containers running on the host: [Cockpit](http://cockpit-project.org/). Cockpit is a remote manager for GNU/Linux servers with a nice Web UI. It lets me manage servers and containers running on the host. You can read more about Cockpit in [this overview article](https://fedoramagazine.org/cockpit-overview/) previously published here. However, I also wanted to automate running containers on the host, which I’ve done using [Ansible](https://www.ansible.com/). +幸运的是,我发现一个很好的方式来管理在主机上运行的容器: [Cockpit](http://cockpit-project.org/). Cockpit是一个具有漂亮的Web UI的GNU / Linux服务器的远程管理器。它帮我管理在主机上运行的服务器和容器。你可以看更多的关于Cockpit在之前发布的 [这篇导览文](https://fedoramagazine.org/cockpit-overview/)  但是,我也想在主机上自动运行容器,我已经使用 [Ansible](https://www.ansible.com/). -Note that we cannot use the dnf command on the Atomic Host. The host is designed not as a general purpose OS, but to be more fit for containers and other purposes. But it’s still very easy to set up applications and services on the Atomic Host. This post shows you how to automate and simplify this process. +请注意,我们不能在Atomic主机上使用dnf命令。主机不是设计为通用操作系统,而是更适合容器和其他目的。但在Atomic主机上设置应用程序和服务仍然非常容易。这篇文章向您展示了如何自动化和简化这个过程。 -### Setting up the components +### 设置组件 -Before getting started, make sure you have Ansible installed on your system. +开始之前,请确保你的系统上安装了Ansible。 ``` sudo dnf -y install ansible @@ -20,56 +18,52 @@ sudo dnf -y install ansible ``` $ git clone https://github.com/trishnaguha/fedora-cloud-ansible.git - ``` ``` $ cd fedora-cloud-ansible $ cd cockpit $ vim inventory - ``` -1. Replace IP_ADDRESS_OF_HOST with the IP address of your Atomic host. -2. Replace PRIVATE_KEY_FILE in the line ansible_ssh_private_key_file=’PRIVATE_KEY_FILE’ with your SSH private key file. +1. 使用你的Atomic 主机IP替换掉 IP_ADDRESS_OF_HOST。 +2. 用您的SSH私钥文件的路径替换行ansible_ssh_private_key_file ='PRIVATE_KEY_FILE'中的PRIVATE_KEY_FILE。 -Now save and exit the inventory file. +现在保存并退出 inventory 文件。 -Next, edit the ansible configuration file: +接下来,编辑 ansible 配置文件: ``` $ vim ansible.cfg - ``` -### Putting it all together +### 把他们放在一起! -Now it’s time to run the playbook. This command starts running the Cockpit container on the Atomic host: +现在是运行PlayBook的时候了。此命令开始运行Atomic主机上的Cockpit容器: ``` $ ansible-playbook cockpit.yml - ``` [![Cockpit login screen](https://i1.wp.com/cdn.fedoramagazine.org/wp-content/uploads/2016/09/Screenshot-from-2016-10-03-12-02-27.jpg?resize=676%2C321&ssl=1)](https://i1.wp.com/cdn.fedoramagazine.org/wp-content/uploads/2016/09/Screenshot-from-2016-10-03-12-02-27.jpg?ssl=1) -### Managing your containers +### 管理你的容器 -Login with the credentials of your Atomic host or as root. Then visit the Containers section on the Cockpit manager to see the containers running on your Atomic host. In the example below, you’ll see I also set up others like [httpd](https://github.com/trishnaguha/fedora-cloud-ansible/tree/master/httpd) and [redis](https://github.com/trishnaguha/fedora-cloud-ansible/tree/master/redis): +使用Atomic主机的凭据或以root用户身份登录。然后访问Cockpit管理器上的Containers部分,查看Atomic主机上运行的容器。在下面的示例中,您会看到我还设置了其他类似 [httpd](https://github.com/trishnaguha/fedora-cloud-ansible/tree/master/httpd) 和 [redis](https://github.com/trishnaguha/fedora-cloud-ansible/tree/master/redis): [![Cockpit panel for managing containers](https://i1.wp.com/cdn.fedoramagazine.org/wp-content/uploads/2016/09/Screenshot-from-2016-10-03-12-13-05.jpg?resize=676%2C284&ssl=1)](https://i1.wp.com/cdn.fedoramagazine.org/wp-content/uploads/2016/09/Screenshot-from-2016-10-03-12-13-05.jpg?ssl=1) -Notice the interface lets you start and stop containers directly in the Cockpit manager using the Run and Stop buttons. You can also manage your Atomic host using the Cockpit manager. Go to Tools -> Terminals. There you can use the terminal of the Atomic host: +注意,该界面允许您直接在Cockpit管理器中使用Run和Stop按钮启动和停止容器。您还可以使用Cockpit管理器管理您的Atomic主机。转到工具 - >终端。在这里里你可以使用Atomic主机的终端: [![Cockpit terminal panel](https://i1.wp.com/cdn.fedoramagazine.org/wp-content/uploads/2016/09/Screenshot-from-2016-10-03-12-10-19.jpg?resize=676%2C279&ssl=1)](https://i1.wp.com/cdn.fedoramagazine.org/wp-content/uploads/2016/09/Screenshot-from-2016-10-03-12-10-19.jpg?ssl=1) -If you plan to deploy your containerized application on Atomic host, you can simply write a playbook for it. Then you can deploy using the ansible-playbook command and manage the containers using Cockpit. +如果您打算在Atomic主机上部署容器化的应用程序,则可以简单地为其编写PlayBook。然后,您可以使用ansible-playbook命令进行部署,并使用Cockpit管理容器。 [![Running ansible-playbook to deploy multiple containers](https://i0.wp.com/cdn.fedoramagazine.org/wp-content/uploads/2016/09/FotoFlexer_Photo51.jpg?resize=650%2C663&ssl=1)](https://i0.wp.com/cdn.fedoramagazine.org/wp-content/uploads/2016/09/FotoFlexer_Photo51.jpg?ssl=1) -Feel free to fork or add playbooks for containers in the repository [https://github.com/trishnaguha/fedora-cloud-ansible](https://github.com/trishnaguha/fedora-cloud-ansible). +你可以随意的Fork或添加容器的PlayBook在这个仓库 [https://github.com/trishnaguha/fedora-cloud-ansible](https://github.com/trishnaguha/fedora-cloud-ansible). --------------------------------------------------------------------------------- +------ via: https://fedoramagazine.org/deploy-containers-atomic-host-ansible-cockpit/