1. Requirements
Server Master Agent Envtype
8.0.0.1 8.0.0.11 8.0.0.111 AAA
8.0.0.112
8.0.0.12 8.0.0.113
8.0.0.114
1. Get the list of machines in the document
/etc/ansible/hosts
[Server]
[Master]
[Agent]
2. contract to target Machine
2.1 Send flask to all machines
2.2 Be familiar with distributing the installation package to each node
3. Execute the Script
3.1 Installing FLASK, etc.--flask.sh
3.2 Configuring the server node--config_server.py
3.2.1 Get the native IP address, when ip=8.0.0.1, master=[8.0.0.11, 8.0.0.12]; agent=[8.0.0.111, 8.0.0.112, 8.0.0.113, 8.0.0.114]
3.2.2 The server ip=8.0.0.1 in the Task_server.json
...
3.3 Configuring the Master node
3.3.1 Get the native IP address, when ip=8.0.0.11, server=8.0.0.1; agent=[8.0.0.111, 8.0.0.112]
3.3.2 Modify the server ip=8.0.0.1,master ip= native IP in Task_agent.json, agent1 ip=8.0.0.111, Agent2 IP =8.0.0.112, envtype=aaa
...
3.4 Configuring the Agent Node
...
4. Implementation
2.json3.ansible add native SSH key to the target machine Authorized_keys
# Generate asymmetric Encryption public key
Ssh-keygen-t rsa-f ~/.ssh/id_rsa-p "
# enables the machine to access the target machine
Ssh-copy-id-i ~/.ssh/id_rsa.pub target user @ Target machine IP
3. Command
Reference Document: Https://www.cnblogs.com/yc913344706/p/7867554.html
Shell Scripting--03 Automated Deployment