- Documentation
Elastic Compute Service
Elastic Compute Service
Best Practices
O&M
Using Ansible to install cloud assistant Agent
O&M
Using Ansible to install cloud assistant Agent
Using Ansible to install cloud assistant Agent
This topic describes how to use the open-source tool Ansible to batch install cloud assistant Agent for Linux ECS instances.
What is Ansible
Ansible is an open-source tool for IT automation, which is developed based on Python. It is simple to use, secure, and reliable, with OpenSSH used for transmitting data (other transmission modes, such as the pull mode, are also supported). It is used to automatically configure, deploy applications, perform orchestration, and complete other remote tasks on managed nodes. For more details, see Ansible. Terms
Usage notes
Procedure
- Install Ansible on the primary control node.
In the example provided in this practice, an ECS instance with the operating system CentOS 7.9 serves as the primary control node. To install Ansible on more operating systems, see Installation guide. - Execute the following command to install EPEL repository.
yum install -y epel-release
- Execute the following command to install Ansible.
- Execute the following command to add EIPs of servers serving as managed nodes.
- Press the i key to add EIP addresses of managed nodes.
tip
You can also group different IP addresses in the format of [$groupname$] for easier batch operations by group. To learn more about Ansible grouping, see Inventory basics - For example, instances can be divided into two groups: [keypair] (key pair-based login) and [password] (password-based login).
-
- Press esc and enter :wq to save the change and exit.
- Execute the following command to modify the Ansible configuration file.
vim /etc/ansible/ansible.cfg
- Press the / key and enter host_key_checking to search for the keyword.
- At the beginning of the line containing host_key_checking = False, delete the # (comment character).
tip
After performing the above steps, you do not need to verify via SSH host key when logging in to managed nodes for the first time.
-
- Press esc and enter :wq to save the change and exit.
- (Optional) When logging in to a managed node by using a key pair, you can create a private key file for login.
- Execute the following command to create and edit the private key file.
In this practice, all managed nodes with key pair-based login use the same key pair.
- Press the i key to paste the private key information into this file.
- Press esc and enter :wq to save the change and exit.
- Execute the following command to add read/write permissions on the private key file.
- Install cloud assistant Agent on managed nodes.
tip
In the example provided in this practice, after cloud assistant Agent is installed, restarting managed nodes is not required.
- On the ECS instance serving as the primary control node, execute the following command to install Agent for ECS instances with key pair-based login grouped in [keypair].
tip
- Replace keypair with actual group name.
- Replace ~/key.pem with actual path where the login key for managed nodes is stored.
sudo ansible -i /etc/ansible/hosts keypair -b --become-user=root -m shell -a 'sudo bash -c "$(curl https://assist-client.tos-cn-beijing.volces.com/install.sh)"' --private-key=~/key.pem
- You can view the installation progress and results for each instance based on script responses.
-
- On the ECS instance serving as the primary control node, execute the following command and enter the login password of the managed node. This enables you to install Agent for the instance with password-based login grouped in [password].
tip
Replace password with the actual group name.
sudo ansible -i /etc/ansible/hosts password -b --become-user=root -m shell -a 'sudo bash -c "$(curl https://assist-client.tos-cn-beijing.volces.com/install.sh)"' -k
-
- Check the running status of cloud assistant Agent on each managed node.
- Execute the following command to view the Agent status on ECS instances with key pair-based login and grouped in [keypair].
sudo ansible -i /etc/ansible/hosts keypair -b --become-user=root -m shell -a 'systemctl status assist-client.service' --private-key=~/key.pem
- Sample instance in a normal status:
-
- To view the Agent status on the ECS instance with password-based login grouped in [password], execute the following command and then enter the login password of the managed node.
sudo ansible -i /etc/ansible/hosts password -b --become-user=root -m shell -a 'systemctl status assist-client.service' -k
- Sample instance in a normal status:
-
Last updated: 2025.11.05 10:29:11