PowerShell Automation : Introduction To Kasini3000

tags: Ansible , pipeline , winrm , SSH , psremoting , automation , devops

site mirror: https://github.com/kasini3000/kasini3000 — Welcome give star to project

win,linux devops automation batch script framework.(It is similar to Puppet,Ansible,pipeline)
Open source, free, cross-platform

English manual:

kasini3000_agent_linux

https://gitee.com/chuanjiao10/kasini3000_agent_linux

Shell script,one click install powershell on linux,modify sshd_config for PsRemote.

feedback:

Submitting an issue with a github account is the easiest way to give feedback I think.

It would be better if you could join Tencent QQ group, which is an instant messaging software similar to msn.

kasini3000 is script, ansible is YAML.

kasini3000 can transfer powershell objects between local and remote machines each other.

transfer powershell objects support :win

Note: powershell commands in azure, aws, vmware, win node machines, will generate objects and return to the master machine.

for linux node , you need to construct the object yourself, here is an example:

c:\ProgramData\kasini3000\node_script

The technology, protocol, or feature keyword supported by “kasini3000”:

Offline installation of win, linux, master, node and all libraries.

winrm, ssh, rsync between win and linux, batch telnet, batch sftp, batch ftp-sync, batch sftp-sync, sqlite, remote object transfer,
batch database client, picture alarm, balloon alarm, sound alarm, WeChat alarm , Dingding alarm.

Support from win, linux master sodo login to linux node.

Free support for 1 batch of linux2winrm. Another batch of linux2winrm is supported for a fee.

The remote command line from the master to node supports only bash in the Linux node, but no pwsh is installed. But this is not recommended.

A: The framework provides these functions:
Kasini3000 provides multi-process and multi-thread engine; automatic remote transfer of ps1 scripts and code blocks;
timed task engine; remote value transfer of objects; Batch modify win node, linux node password.

Remove-Item -LiteralPath ‘c:\ProgramData\kasini3000’ -Recurse -Force -Confirm:$false
cd ‘c:\ProgramData\’
git clone https://gitee.com/chuanjiao10/kasini3000.git

git clone git@gitee.com:chuanjiao10/kasini3000.git

c:\ProgramData\kasini3000\zkj_install_k记饭店_win主控机.ps1

script dependencies 【c:\Users\【your_name】\Documents\kasini3000\nodelist.csv】

Remove-Item -Force -LiteralPath ‘/etc/kasini3000’
cd /etc
git clone https://gitee.com/chuanjiao10/kasini3000.git

git clone git@gitee.com:chuanjiao10/kasini3000.git

/etc/kasini3000/zkj_install_k记饭店_linux主控机.ps1

win file patch : c:\users\【your_name】\Documents\kasini3000\user_config.ps1
inux file patch : /root/kasini3000/user_config.ps1

$global:被控机列表文件 = “${global:kasini3000_data_path}/nodelist111.csv”
$global:zd只读nodelist文件 = $false
$global:config = $false
$global:0k_source = $false

Charging plugin:

20$ nodelist.xslx
Supports Win, Linux, and host computers. No need to install Excel.

win file patch : c:\users\【your_name】\Documents\kasini3000\nodelist.csv

inux file patch : /root/kasini3000/nodelist.csv

ip,port,user,pass for win
ip,port,user for linux.

If the linux password field is not empty string, the linux password can be used to push ssh-pub-key-file
./cduuid ‘c3afb273-8ab4-4ec2-8716-12a05fac1bfe’
./cdname ‘the name of node’
./cdip ‘the ip of node’
./cdg ‘the group of node’
The password timestamp is used for batch password change script for win
node os type is an empty field. When connected to the node, its value is written into the powershell varible

You can add any custom fields to nodelist.csv. For example: region

make two ssh-keyfile for linux node :

Change one of two key in turn every 3-6 months.

run:
/etc/kasini3000/gx更新主控机ssh秘钥1.ps1
/etc/kasini3000/gx更新主控机ssh秘钥2z.ps1

created file path win:
c:\users\【your_name】\Documents\kasini3000\ssh_key_files_old1\id_rsa
c:\users\【your_name】.ssh\id_rsa
c:\users\【your_name】\Documents\kasini3000\ssh_key_files_old1\authorized_keys

created file path linux:
/root/.ssh/id_rsa
/root/kasini3000/ssh_key_files_old1/id_rsa
/root/kasini3000/ssh_key_files_old1/authorized_keys

on win master,push c:\users\【your_name】\Documents\kasini3000\ssh_key_files_old1\authorized_keys to linux node /root/.ssh/authorized_keys:
winscp复制主控机公钥到被控机_win2linux_pwd.ps1 -ipaddress nodeip -root_password ‘xxx’
winscp复制主控机公钥到被控机_win2linux_pwd.ps1 -ipaddress nodeip -sudo_user ‘aaa’ -sudo_password ‘bbb’
or
putty复制主控机公钥到被控机_win2linux_pwd.ps1 -ipaddress nodeip -root_password ‘xxx’
putty复制主控机公钥到被控机_win2linux_pwd.ps1 -ipaddress nodeip -sudo_user ‘aaa’ -sudo_password ‘bbb’

on linux master,push /root/kasini3000/ssh_key_files_old1/authorized_keys to linux node /root/.ssh/authorized_keys:
use ssh-copy-id

set_Language_english.ps1

Welcome to help translate the project to English.

config.ps1

k-console.ps1 #console main program,
krun.ps1 #run kasini3000 script or file
k_run_ip.ps1 #run kasini3000 script or file

goto node console,”exit” to exit ,like powershell Enter-PSSession

./gtnode

verbose on

./v-kai开启详细信息输出.ps1

./cdall choose all node
./cduuid ‘c3afb273-8ab4-4ec2-8716-12a05fac1bfe’
./cdname ‘the name of node’
./cdip ‘the ip of node’
./cdg ‘choose a group of node’
./cdos ‘win7’ choose all win7
‘win7′,’win8′,’win10′,’win11′,’win2008r2′,’win2012r2′,’win2016′,’win2019′,’win2022′,’centos6′,’centos7′,’centos8′,’debian9′,’debian10′,’ubuntu1404′,’ubuntu1604′,’ubuntu1804′,’ubuntu2004′,’Amazon Linux 2′,’kylin v10′,’alpine’,’统信UOS服务器版’

./cdwin #choose all win
./cddebian #choose all debian 9,debian10,debian11
./cdubuntu #choose all ubuntu 1604—2204

(from win,linux master,to win,linux node)

$object_return_from_node_to_master = ./k_run_ip -ip 1.1.1.1 -scriptblock {command_on_node} -allparameter $a,$b
$object_return_from_node_to_master = ./k_run_ip -ip 1.1.1.1 -file ‘d:\script_file_on_master.ps1’ -allparameter $a,$b
$string_return_from_node_to_master = ./k_run_ip -ip 1.1.1.1 -scriptblock { bash /tmp/xxx.sh} -allparameter $a,$b

default timeout:30min max:10day max-process:99,change from create user_config.ps1
k-commit.ps1 -ip 1.1.1.1 -scriptblock {command_on_node} -allparameter $a,$b
k-commit.ps1 -ip 1.1.1.1 -file ‘d:\script_file_on_master.ps1’ -allparameter $a,$b
./kt.ps1 #table
./kl.ps1 #list

default timeout:10min max:1hour max-threaded:50per process,300 max limit.change from create user_config.ps1 #need powershell module poshrsjob
There is no need to run the command k-console.ps1 before k-commit-rs.ps1 command runs
k-commit-rs.ps1 -ip 1.1.1.1 -scriptblock {command_on_node} -allparameter $a,$b
k-commit-rs.ps1 -ip 1.1.1.1 -file ‘d:\script_file_on_master.ps1’ -allparameter $a,$b
./kt-rs.ps1 #table
./kl-rs.ps1 #list
./kt-rs -ip ‘192.168.168.223’ #select ip from sqlite
./kt-rs -remark ‘xxx’
./kt-rs -begin_time ‘2021-11-11 15:05:01’
./kt-rs -end_time ‘2021-11-11 16:05:01’

./kt-rs -grep ‘disk full’

$global:_mtout #kt-rs and kl-rs output variable

$global:_mpout #kt and kl output variable

k_commit_ip_rs.ps1 # for advanced users

k_copyfrom_ip.ps1 -ip 1.1.1.1 -Path ‘node’ -Destination ‘master’ #win2linux,win2win,linux2linux
k_copyto_ip.ps1 -ip 1.1.1.1 -Path ‘master’ -Destination ‘node’

100% Compatible with all scripts(.py .sh .perl or more) in win and linux.

The results are stored in the sqlite database. According to node-ip, time, query results.

6 ftp, sftp folder synchronization (win master only)

k_sync_ftpd2l_win.ps1
k_sync_l2ftpd_win.ps1
k_sync_l2sftpd_win.ps1
k_sync_sftpd2l_win.ps1
k_download_from_ftpd_win.ps1
k_upload2ftpd_win.ps1

k_rsync_winfromlinux.ps1
k_rsync_wintolinux.ps1

baoj中英文声音报警.ps1
\admin_gui\qwin右下角气球报警.ps1

win terminal background picture alarm:

c:\ProgramData\kasini3000\node_script\7z
l7za2zip.ps1
l7za27z.ps1
l7zu2zip.ps1
l7zu27z.ps1
l7zx.ps1

w7za2zip.ps1
w7za27z.ps1
w7zu2zip.ps1
w7zu27z.ps1
w7zx.ps1

“c:\ProgramData\kasini3000\node_script” on master

to copy node_script folder to node:

./cdip 1.2.3.4

./kctf复制主控机node_script目录脚本到当前被控机.ps1

c:\ProgramData\kasini3000\node_script\kasini3000\psed.ps1
manual: c:\ProgramData\kasini3000\docs\ps找算替_v3_readme.html

12.1 Build an 18-bit random number and write it into the old password field in nodelist. csv

c:\ProgramData\kasini3000\cs产生所有被控机旧密码并写入nodelist.ps1

12.2 Change the password, verify, swap the current password and old password fields, and write the password change time.

c:\ProgramData\kasini3000\zkj_s所有linux被控机改密码_验证周期_改密码_验证_对调密码_写入时间戳.ps1 # for all linux node on this nodelist.csv
c:\ProgramData\kasini3000\zkj_s所有win被控机改密码_验证周期_改密码_验证_对调密码_写入时间戳.ps1 # for all win node on this nodelist.csv

c:\ProgramData\kasini3000\node_script\bkj_remove_linuxpackage.ps1

c:\ProgramData\kasini3000\node_script\bkj_install_linuxpackage.ps1

use title 10 command ,copy up 2 files to each linux node,then:

./k_run_ip -ip 1.2.3.4 { /etc/kasini3000/node_script/bkj_install_linuxpackage.ps1 -package_names ‘a’,’b’,’no_this_packagename’ }

1 install omi https://github.com/microsoft/omi
or https://github.com/jborean93/omi

After install microsoft OMI or jborean93/omi , then you can connect from linux to windows by WINRM-5985 (ntlm).

but OMI has some bug ,sctipt file name on windows does not support characters other than English.

2 k_run_ip_port_l2w_user_pwd.ps1 -ip your_windows_node_ip -port xxx -user xxx -pwd xxx {
command on windows
more command …

}

Here is a paid plugin for $20.

Support batch from linux to win (k-commit&k-commit-rs), support nodelist.csv

https://gitee.com/chuanjiao10/kasini3000/blob/master/k_run_ip_port_w2l_user_expect_pwd.ps1
The script solves the following problems:
1 The ps session from win to linux does not support the problem of specifying a password to login through parameter values.

2 The ps session from win to linux does not support specifying the sudo password through parameter values, and it is necessary to manually enter the sudo password.

3 Support the original parameter transfer of pssession. pass value.

4 For a single node machine, it cannot run concurrently. Powershell v5.x is not supported

5 need powershell install on linux

usage:
$a = 123
[scriptblock]$b = { touch $args[0] }
c:\ProgramData\kasini3000\k_run_ip_port_w2l_user_expect_pwd.ps1 -sudo -ipaddress '192.168.1.2' -user 'xxx' -pwd 'xxx'
-file ‘d:\c.ps1’ or -scriptblock $b
-allparameter $a

c:\ProgramData\kasini3000\cmdb\u库_触发器表_添加触发器341.ps1 #add trigger
c:\ProgramData\kasini3000\cmdb\u库_计划表_添加动作331.ps1 #add action
c:\ProgramData\kasini3000\cmdb\u库_绑定_动作和触发器351.ps1 #Bind Trigger Action
ul.ps1
ut.ps1

k_copyfrom_ip_port_l2l_user.ps1
k_copyfrom_ip_port_w2l_user.ps1
k_copyfrom_ip_port_w2w_user_pwd.ps1

k_copyto_ip_port_l2l_user.ps1
k_copyto_ip_port_w2l_user.ps1
k_copyto_ip_port_w2w_user_pwd.ps1

k_run_ip_port_l2l_user.ps1
k_run_ip_port_w2l_user.ps1
k_run_ip_port_w2w_user_pwd.ps1

k_copyfrom_ip_port_winscp2bash_user_pwd.ps1
k_copyto_ip_port_winscp2bash_user_pwd.ps1
k_run_ip_port_winscp2bash_user_pwd.ps1 #only run one-line command

“kaiiit’s Hotel”(kasini3000) supports multi-cloud platform use, has multiple databases client, supports aws-powershell, azure-powershell to pass objects, supports devops (as jenkins & gitlab backend) Welcome to submit translation and pr, welcome to gitee wiki to see.

Original: https://www.cnblogs.com/piapia/p/16534765.html
Author: PowerShell免费软件
Title: PowerShell Automation : Introduction To Kasini3000

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/609896/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

  • LeetCode 543-二叉树的直径

    题目描述: 给定一棵二叉树,你需要计算它的直径长度。一棵二叉树的直径长度是任意两个结点路径长度中的最大值。这条路径可能穿过根结点。 示例: 给定二叉树 返回 3, 它的长度是路径 …

    Linux 2023年6月7日
    064
  • 跳石板—牛客网

    #include #include #include using namespace std; //计算第i个&#x7684…

    Linux 2023年6月13日
    0108
  • 自己写的文件夹图标修改脚本

    自己写了一个文件图标修改的Python脚本,只要把文件夹拖动到这个脚本上,就可以用文件夹中的图片和视频作为文件夹的封面。把图片或视频拖到脚本上,就可以把这个图片或视频用作其所在文件…

    Linux 2023年6月6日
    0150
  • Mysql在linux对大小写敏感的设置

    编辑/etc/my.cnf文件,在[mysqld]节下 添加 lower_case_table_names 参数,并设置相应的值 (备注:为0时大小写敏感,为1时大小写不敏感,默认…

    Linux 2023年6月13日
    086
  • 洛谷P3372–线段树代码模板1

    时空限制:1000ms,128M 数据规模: 对于30%的数据:N Original: https://www.cnblogs.com/ygsworld/p/11279732.ht…

    Linux 2023年6月7日
    0108
  • AI芯片的软件挑战

    本文是记录会议【ICPA联盟微课 | 第1期】燧原科技李彬:AI芯片的软件挑战内容。不得不说,什么叫高屋建瓴。 芯片软件的5个衡量指标:算力利用率、开发效率、生态兼容性、可移植性、…

    Linux 2023年6月7日
    081
  • zabbix监控配置流程

    zabbix监控配置流程 管理层次: 开发人员要加监控,需要让其提供监控指标运营人员要加监控,让其找开发要监控指标运维人员要加监控,让运营人员去找开发要监控指标。 配置层次: 1….

    Linux 2023年6月6日
    094
  • Redis 内存压缩原理

    Redis 无疑是一个大量消耗内存的数据库,因此 Redis 引入了一些设计巧妙的数据结构进行内存压缩来减轻负担。ziplist、quicklist 以及 intset 是其中最常…

    Linux 2023年5月28日
    086
  • Redis 优化之 tcp-backlog

    tcp-backlog:511 此参数确定了TCP连接中已完成队列(完成三次握手之后)的长度, 当然此值必须不大于Linux系统定义的/proc/sys/net/core/soma…

    Linux 2023年5月28日
    091
  • 浪剑天下H5游戏详细图文架设教程

    404. 抱歉,您访问的资源不存在。 可能是网址有误,或者对应的内容被删除,或者处于私有状态。 代码改变世界,联系邮箱 contact@cnblogs.com 园子的商业化努力-困…

    Linux 2023年6月7日
    083
  • find 查询命令 & 正则表达式

    今日内容 find 正则表达式 Linux 三剑客之 grep 内容详细 一、find 按名称或属性查询文件 按名称查询 find [查找目录] [参数] [] 通配符 : * 表…

    Linux 2023年5月27日
    085
  • 详解 Serverless 架构的 6 大应用场景

    Serverless 架构将成为未来云计算领域重要的技术架构,将会被更多的业务所采纳。进一步深究,Serverless 架构在什么场景下有优秀的表现,在什么场景下可能表现得并不是很…

    Linux 2023年6月8日
    080
  • JDK的环境变量

    jdk下载并配置下载jdk下图是自己资源管理器中jdk的安装路径,双击然后next就好,不需要改什么配置 手里没有安装包的,下载地址在这里 :https://www.oracle….

    Linux 2023年6月13日
    061
  • Vue3 封装 Element Plus Menu 无限级菜单组件

    本文分别使用 SFC(模板方式)和 tsx 方式对 Element Plus el-menu 组件进行二次封装,实现配置化的菜单,有了配置化的菜单,后续便可以根据路由动态渲染菜单。…

    Linux 2023年6月7日
    0132
  • THE EVOLUTION OF INTELLECTUAL FREEDOM;

    分享几张有趣的图: 1:http://www.cs.cmu.edu/~dskarlat/ 2022-03-03 17:47 2:https://www.zhihu.com/ques…

    Linux 2023年6月14日
    084
  • 2.VMware三种网络模式

    本文参考《Vmware虚拟机三种网络模式详解》、《网络原理,以及对VMware Workstation虚拟网络VMnet0、VMnet1、VMnet8的图解》 一.VMware的网…

    Linux 2023年5月27日
    0116
亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球