Deploy containers using atomic hosts, Ansible, and Cockpit

Source: Internet
Author: User

Deploy containers using atomic hosts, Ansible, and Cockpit
GuideAn atomic host from an atomic project is a lightweight container operating system that can run Linux containers in Docker format. It is specially tailored to improve efficiency and makes it an ideal choice for the Docker runtime system used in the cloud environment.

We are lucky to find a good way to manage the containers running on the host: Cockpit. It is a GNU/Linux Server Remote Management tool with a beautiful Web interface. It can manage the servers and containers running on the host. However, I also want to automatically run containers on the host. In this case, we can use Ansible to do this.

Note that we cannot use the dnf command on an atomic host. The atomic host is not designed as a general operating system, but is more suitable for containers and other purposes. However, it is still very easy to set applications and services on an atomic host. This article shows you how to automate and simplify this process.

Set ComponentsInstall Ansible

Before you start, make sure that Ansible is installed on your system.

sudo dnf -y install ansible
Download cockpit source code

We need to run the cockpit container on the atomic host. Download its source code from https://github.com/trishnaguha/fedora-cloud-ansible on your machine.

$ git clone https://github.com/trishnaguha/fedora-cloud-ansible.git
Edit configuration file

1. Switch to the cockpit directory and edit the inventory file as follows:

$ cd fedora-cloud-ansible$ cd cockpit$ vim inventory

Complete the following modifications:
1) Replace the IP address of your atomic hostIP_ADDRESS_OF_HOST.
2) Replace the path with your SSH Private Key FileIn the row ansible_ssh_private_key_file = 'private _ KEY_FILE ',PRIVATE_KEY_FILE.
Save and exit the inventory file editing.

2. Edit the ansible configuration file:

$ vim ansible.cfg

ReplaceRemote_user = UserUser is the remote User name on your atomic host. Save and exit file editing.

Combined

Now run Ansible's PlayBook. This command starts to run the Cockpit container on the atomic Host:

$ ansible-playbook cockpit.yml

Cockpit is now running on an atomic host. Use a browser to access port 9090 of the Public IP of your instance-this is the default port of Cockpit. For example, if the IP address of the instance is 192.168.1.4, access 192.168.1.4: 9090. You will see the following Web interface:

Manage your containers

Use the logon information of the atomic host or log on as the root user. Access the Containers section on the Cockpit manager to view the Containers running on the atomic host. In the following example, you will see that I have set other containers, such as httpd and redis:

Note: This interface allows you to use the Run and Stop buttons in the Cockpit manager to start and Stop the container. You can also use the Cockpit manager to manage your atomic hosts. Go to Tools> Terminals. Here you can use the terminal of the atomic Host:

If you want to deploy containerized applications on an atomic host, you can simply write a PlayBook for it. Then, you can use the ansible-playbook command to deploy and use Cockpit to manage containers.

From: https://linux.cn/article-7861-1.html

Address: http://www.linuxprobe.com/host-ansible-cockpit.html


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.