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)

大家都在看

  • js笔记之switch-case

    switch 语句来选择要执行的多个代码块之一。switch 不能处理大于小于的 工作原理:首先设置表达式 n(通常是一个变量)。随后表达式的值会与结构中的每个 case 的值做比…

    Linux 2023年6月13日
    092
  • 利用Tensorboard可视化模型、数据和训练过程

    在60分钟闪电战中,我们像你展示了如何加载数据,通过为我们定义的 nn.Module的子类的model提供数据,在训练集上训练模型,在测试集上测试模型。为了了解发生了什么,我们在模…

    Linux 2023年6月14日
    0112
  • 微服务架构项目浅析

    微服务架构的演变 最初的需求 业务发展后需要克服的问题 微服务架构使用的组件 Nginx Redis Rabbitmq Mysql jar jdk * 总结 ​ 这个章节主要介绍微…

    Linux 2023年6月14日
    0119
  • mysql order by语句流程是怎么样的

    order by流程是怎么样的 注意点: select id, name,age,city from t1 where city=’杭州…

    Linux 2023年6月8日
    0114
  • 【V4L2】V4L2框架浅析

    概述 V4L2(Video4Linux的缩写)是Linux下关于视频采集相关设备的驱动框架,为驱动和应用程序提供了一套统一的接口规范。 V4L2支持的设备十分广泛,但是其中只有很少…

    Linux 2023年6月13日
    0122
  • 如何在CentOS 6.3上安装nslookup

    nslookup是bind-utils软件包的一部分。请注意,host、dig和nslookup也是bind工具的一部分。如果没有安装bind-utils包,当你尝试nslooku…

    Linux 2023年6月7日
    0115
  • 分布式数据库

    目录: 1.分布式数据库的核心功能 2.分布式数据库的优点 3.分布式数据库的缺点 4.市面上分布式数据库的产品分类 5.分布式数据库的搭建 随着互联网的发展,人类社会的数据量迅速…

    Linux 2023年6月6日
    069
  • 真·Android Zxing 扫码中文乱码解决

    Zxing3.2.1 之前遇到过Android Zxing扫码乱码的问题,网上搜了下解决了下。 今天又遇到了问题。 依然会乱码。 研究总结如下: Zxing 可以在Hints中添加…

    Linux 2023年6月13日
    083
  • linux磁盘配额管理

    磁盘配额是一种磁盘空间的管理机制,使用磁盘配额可限制用户或组在某个特定文件系统中能使用的最大空间 1、查看内核是否支持磁盘配额 grep “CONFIG_QUOTA&#…

    Linux 2023年5月27日
    0102
  • 我最鄙视的程序员

    今天在技术群里看到关于优秀程序员特质的话题,让我想起多年前的一个同事,一个我最鄙视的程序员。 他的名字叫李伟(化名),是入职没多久的员工,我所在的开发二组和他在的一组,以前没有过工…

    Linux 2023年6月6日
    093
  • [CentOS7]redis设置开机启动,设置密码

    简介 上篇文章介绍了如何安装redis,但每次重启服务器之后redis不会自启,这里将介绍如何进行自启设置,以及如何设置redis的密码,进行密码验证登陆。 上篇文章: Cento…

    Linux 2023年5月28日
    0110
  • locate-updatedb命令检索不全

    执行updatedb 命令,用于立刻更新locate 命令所必需的数据库文件,但有些文件可能会在检索过程中被过滤掉。 有时候明明存在的文件,用find 命令都能搜得出来,但用loc…

    Linux 2023年6月13日
    093
  • C++Lambda表达式

    C++ 11 中的 Lambda 表达式用于定义并创建匿名的函数对象,以简化编程工作。 Lambda 的语法形式如下: [捕获列表] (参数) mutable 或 exceptio…

    Linux 2023年6月8日
    0119
  • Visual Studio远程调试

    在工作中有时候需要在服务器的环境下远程调试,例如调试微信相关服务的时候。 1. 下载远程调试工具 网址:https://visualstudio.microsoft.com/zh-…

    Linux 2023年6月7日
    0110
  • WEB自动化-03-Cypress 测试框架概述

    3 Cypress 测试框架概述 3.1 Cypress 默认文件结构 在Cypress安装完成后,其生成的默认文件目录如下所示: 3.1.1 Fixtures Fixture又称…

    Linux 2023年6月7日
    0116
  • WPF 修复 ContextMenu 在开启 PerMonitorV2 后所用 DPI 错误

    本文告诉大家如何修复 WPF 的 ContextMenu 在开启 PerMonitorV2 之后,在双屏不同的 DPI 的设备上,在副屏弹出的 ContextMenu 使用了主屏的…

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