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)

大家都在看

  • 分享四款H5怀旧小游戏魔塔+伏魔记+三国霸业+寻仙纪

    前言 还记得中学时,用步步高学习机玩的魔塔、伏魔记、三国霸业吗?还记得3g网时,用Nokia或是杂牌机在3GQQ家园里玩的精武堂、纵横四海吗?没错,说的就是你! 那时的游戏很粗糙,…

    Linux 2023年6月7日
    0149
  • 学习一下 JVM (二) — 学习一下 JVM 中对象、String 相关知识

    一、JDK 8 版本下 JVM 对象的分配、布局、访问(简单了解下) 1、对象的创建过程 (1)前言Java 是一门面向对象的编程语言,程序运行过程中在任意时刻都可能有对象被创建。…

    Linux 2023年6月11日
    0112
  • Jquery如何使用animation动画效果改变背景色

    一、问题引入 1. jquery的animate动画虽然强大,但是无法使用其进行背景色(background-color)的动画效果变化,因为animate动画效果只能动态改变数值…

    Linux 2023年6月14日
    0222
  • (转)redis系列之——一致性hash算法

    数据分片(sharding)分布式数据存储时,经常要考虑数据分片,避免将大量的数据放在单表或单库中,造成查询等操作的耗时过长。比如,存储订单数据时使用三个mysql库(编号0,1,…

    Linux 2023年5月28日
    0135
  • 原码反码补码

    3.1 知识点补充 在计算机内部,所有信息都是用二进制数串的形式表示的。整数通常都有正负之分,计算机中的整数分为无符号的和带符号的。无符号的整数用来表示0和正整数,即自然数;带符号…

    Linux 2023年6月13日
    0110
  • 【windows】在windows右键菜单加入在当前路径打开cmd功能?

    在Ubuntu中可以在一般目录下点击右键选中Open in Terminal即可打开一个命令终端,由于自己平常在windows上开发时也常常使用cmd命令行进行操作,但是每次都需要…

    Linux 2023年6月13日
    0109
  • shell生成指定长度的随机数

    生成指定长度是随机数 8位纯数字的随机数 tr -cd ‘0-9’ 使用/dev/urandom而不是/dev/random是因为后者比较慢。 Original: https://…

    Linux 2023年5月28日
    0113
  • Git报错 error: cannot spawn more: No such file or directory

    问题原因 error: cannot spawn more: No such file or directory 这个错误意思是不存在more指令,我是windows平台,自然这个…

    Linux 2023年6月6日
    0102
  • 【EventOS Nano】EventOS Nano初步了解

    EventOS Nano是什么? EventOS Nano是一个面向单片机、事件驱动的、分布式的、可跨平台开发的嵌入式开发平台。主要有两大技术特色: 事件驱动和 超轻量 Event…

    Linux 2023年6月13日
    093
  • Git工作流程

    学于2018年6月 总的流程: 一: 首先克隆整个项目到本地 二: 在本地创建一个属于自己的分支, 并push到远程(当时的工作情况是, 每实现一个功能, 或修改一个BUG都创建一…

    Linux 2023年6月6日
    0126
  • 嵌入式软件架构设计-程序分层

    1 前言 在嵌入式MCU软件开发过程中,程序分层设计也是重中之重,关系到整个软件开发过程中的协同开发,降低系统软件的复杂度(复杂问题分解)和依赖关系、同时有利于标准化,便于管理各层…

    Linux 2023年6月7日
    0148
  • 安卓开发封装处理Retrofit协程请求中的异常

    上篇文章讲解了怎么使用 Kotlin的协程配合 Retrofit发起网络请求,使用也是非常方便,但是在处理请求异常还不是很人性化。这篇文章,我们将处理异常的代码进行封装,以便对异常…

    Linux 2023年6月8日
    0111
  • 域控制器所需的DNS SRV记录没有在DNS中注册的解决方法

    搭建完AD和DNS之后,发现在DNS的正向查找区域没有SRV记录,并且客户端无法加入到AD中,如下 解决方法 删除正向查找区域下的目录 然后选择”正向查找区域&#822…

    Linux 2023年6月14日
    0113
  • Python 练习题:用索引取出LIST中的值

    请用索引取出下面list的指定元素,分别为Apple,Python,Lisa -*- coding: utf-8 -*- 请用索引取出下面list的指定元素 L = [ [‘App…

    Linux 2023年6月8日
    0103
  • 利用numpy实现list降维

    python读取数据库得到的事一个类似二维数组的list,有时候需要降维操作,numpy提供一个很有用的函数,可以直接使用 import numpy as np a = np.ar…

    Linux 2023年6月14日
    0123
  • Linux显示IP和主机名

    (1) ifconfig:Linux ifconfig命令用于显示或设置网络设备。 语法: ifconfig [网络设备][down up -allmulti -arp -prom…

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