This commit is contained in:
starry
2025-07-16 12:35:21 +00:00
commit 1f7b4314c3
49 changed files with 18341 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
[defaults]
host_key_checking = False
ansible_ssh_common_args = '-o StrictHostKeyChecking=no'
+4
View File
@@ -0,0 +1,4 @@
[myservers]
1 ansible_host=192.168.1.1 ansible_user=root ansible_port=22 ansible_ssh_pass=password1
2 ansible_host=192.168.1.2 ansible_user=root ansible_port=22 ansible_ssh_pass=password2
3 ansible_host=192.168.1.3 ansible_user=root ansible_port=22 ansible_ssh_pass=password3
+17
View File
@@ -0,0 +1,17 @@
---
# 定义要执行任务的主机组
- hosts: myservers
become: yes
gather_facts: no # 禁用事实收集以避免依赖 Python
tasks:
- name: 将脚本复制到远程主机
copy:
# 本地脚本路径
src: ./shell.sh
# 远程主机上的目标路径
dest: /tmp/shell.sh
# 设置脚本权限为可执行
mode: '0755'
- name: 在远程主机上执行脚本
raw: /tmp/shell.sh # 在远程主机上执行脚本
+2
View File
@@ -0,0 +1,2 @@
#!/bin/bash
echo "Hello, world!"