【Windows】【DevOps】Windows Server 2022 安装ansible,基于powershell实现远程自动化运维部署 入门到放弃!

news2024/10/24 19:15:06

目标服务器安装openssh server参考

【Windows】【DevOps】Windows Server 2022 在线/离线 安装openssh实现ssh远程登陆powershell、scp文件拷贝-CSDN博客

注意:Ansible不支持Windows操作系统部署

根据官方说明:

Windows Frequently Asked Questions — Ansible Community Documentation

Can Ansible run on Windows?

No, Ansible can only manage Windows hosts. Ansible cannot run on a Windows host natively, though it can run under the Windows Subsystem for Linux (WSL).

Note

The Windows Subsystem for Linux is not supported by Ansible and should not be used for production systems.

基于Cygwin安装Ansbile

参考以下内容

Install Ansible on Windows Using Cygwin

Cygwin is a POSIX-compatible environment that lets you run tools and code designed for Unix-like operating systems on Microsoft Windows.

To install Ansible on Windows using Cygwin, follow these steps:

1. Download the Cygwin installation file. This file is compatible with both the 32-bit and 64-bit versions of Windows. It automatically installs the right version for your system.

2. Double-click the downloaded file to run it. On the welcome screen, click Next to continue.

Cygwin setup welcome screen.

3. Select Install from Internet as the download source and click Next.

Choose Cygwin download source.

4. In the Root Directory field, specify where you want the application installed, then click Next.

Select the root installation directory for Cygwin.

5. In the Local Package Directory field, select where you want to install your Cygwin packages, then click Next.

Cygwin setup - select the local package directory.

6. Choose the appropriate Internet connection option. If you are not using a proxy, select Direct Connection. Otherwise, select Use System Proxy Settings or enter the proxy settings manually with the Use HTTP/FTP Proxy. Click Next to continue.

Select internet connection type for Cygwin setup.

7. Choose one of the available mirrors to download the installation files, then click Next.

Select download mirror for Cygwin.

8. On the Select Packages screen, type ansible in the search bar and press Enter to perform the search. Expand the Admin and Doc categories and double-click the ansible and ansible-doc files to select them.

Click Next to install the packages.

Select which Ansible packages to install.

9. The next screen lets you review the installation settings. To confirm and begin the installation process, click Next.

Review Cygwin installation.

The install wizard downloads and installs all the selected packages, including Ansible.

10. Once the installation is complete, select whether you want to add a Cygwin desktop and the Start Menu icon. Click Finish to close the wizard.

Finish the installation

验证安装

配置/etc/ansible/hosts

[server]
服务器ip  ansible_ssh_user=服务器用户名 ansible_ssh_pass=服务器用户密码

ansible ping(windows版本openssh 有兼容问题!)

直接拿linux主机测试ansible连接windows server上的openssh(乱码!)

严重怀疑其兼容性!

ansible+winrm

Windows Remote Management — Ansible Community Documentation

先使用linux系统测试验证

yum install ansible python3-pywinrm

各种故障,放弃!

基于WSL安装ansible(失败)

管理员权限启动powershell

安装WSL

wsl --install
PS C:\Windows\system32> wsl -l -o
PS C:\Windows\system32>

wsl指令没有列出可用的镜像!

参考资料

How to Install Ansible on Windows {3 Methods Explained} (phoenixnap.com)

在 Windows Server 上安装 Linux 子系统 | Microsoft Learn

直接安装python3+ansible(失败):

控制节点安装python3

下载页:https://www.python.org/downloads/windows/
文件URL:https://www.python.org/ftp/python/3.13.0/python-3.13.0-amd64.exe

图形界面安装python3

验证安装

打开powershell,验证版本

控制节点安装ansible

提前关闭 病毒和威胁防护的实时保护

pip install -vvv ansible -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com --default-timeout=100

安装过程比较缓慢(相对Linux来说,可能是Hyper-V主机内CPU调度问题)

安装完成

故障

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2211069.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

C语言初阶-数据类型和变量【下】

紧接上期------------------------->>>C语言初阶-数据类型和变量【上】 全局变量和局部变量在内存中存储在哪⾥呢? ⼀般我们在学习C/C语⾔的时候,我们会关注内存中的三个区域: 栈区 、 堆区 、 静态区 。 内存的分配情况 局部变量是…

STM32 RTC实时时钟 F407 寄存器

RTC介绍 STM32F1: RTC模块拥有一组连续计数的计数器,在相应软件配置下,可提供时钟日历的功能。 即在F1系列,RTC的日历部分只有一个32位的寄存器 该寄存器直接存放 时间戳 的值,即&#xff1…

LeetCode 279. 完全平方数(经典必会)

LeetCode 279. 完全平方数 给你一个整数 n ,返回 和为 n 的完全平方数的最少数量 。 完全平方数 是一个整数,其值等于另一个整数的平方;换句话说,其值等于一个整数自乘的积。例如,1、4、9 和 16 都是完全平方数&#x…

java中连接Mysql以及PreparedStatement如何防止sql注入

目录 JDBC 使用JDBC连接到MySQL 使用 Statement 使用 PreparedStatement Statement 和 PreparedStatement 区别 在 java 中如何连接到 MySQL 数据库,执行 SQL 查询,并处理查询结果? JDBC java 程序连接到 mysql,首先需要下…

Dev-C++萌新福利2

朝鲜球作品原创 1 符号认识: 1.1简单例题1 1.2简单例题22奇奇怪怪的符号 2.1简单例题3 2.2符号表 2.2.1符号表中特殊符号 2.3符号使用代码样例(部分) 萌新福利 作品成本6999元&#xff0…

OSError: [Errno 22] Invalid argument:无效的参数完美解决方法

🚨 OSError: [Errno 22] Invalid argument:无效的参数完美解决方法 💡 🚨 OSError: [Errno 22] Invalid argument:无效的参数完美解决方法 💡摘要引言正文1. 什么是 OSError: [Errno 22] Invalid argument&…

牛客.数字游戏​编辑牛客.体操队形(暴力搜索)​​​​​​​牛客.二叉树最大路径和​编辑牛客.排序子序列

目录 牛客.数字游戏​编辑 牛客.体操队形(暴力搜索) 牛客.二叉树最大路径和​编辑 牛客.排序子序列 牛客.数字游戏 难度不大,但是要注意,他这个快速输入与输出 import java.util.*; import java.io.*; import java.util.StringTokenizer; // 注意类名…

架构设计笔记-15-面向服务架构设计理论与实践

目录 知识要点 案例分析 1.微服务架构 2.微服务 3.微服务架构 4.SOA与微服务 5.基于微服务架构的系统/传统单体式系统 论文 1.论微服务架构及其应用 知识要点 服务组件体系结构(Service Component Architecture,SCA)是面向服务体系…

IT基础监控运维:监控易的深度解析与应用

在数字化转型加速的今天,IT系统的稳定性和高效运维成为了企业业务连续性的关键保障。IT基础监控作为运维工作的基石,其重要性不言而喻。本文将以监控易产品为核心,深入探讨IT基础监控的功能、特点及范围,为运维团队提供实用的参考…

销售管理之线索管理

一、线索获取:销售增长与市场洞察的双引擎 销售增长的基石 线索:销售旅程的起点:在销售的宏伟蓝图中,高质量的线索无疑是构筑成功的基石。缺乏持续、优质的线索供应,任何销售团队都难以跨越销售目标的重重山峦。以软…

Apktool:解包重打包工具

ApKtool是一个apk编译工具,能够反编译apk文件。 解包 使用命令apktool d test.apk 会在同目录下生成一个同名的文件夹 重打包 使用命令apktool b test 会在test文件夹里生成一个dist目录,在dist目录里有打包好的test.apk

Top6 最好的 Android 数据恢复软件免费获取

虽然在智能手机上随身携带您最喜爱的音乐收藏或珍贵的录音很方便,但如果您的设备出现技术问题或您不小心删除了文件,文件也有可能丢失。 不管文件是如何删除或丢失的,丢失那些珍贵的音频文件的痛苦对每个人来说都是一样的。这就是我们创建本…

鸿蒙开发之ArkUI 界面篇 三十三 Builder(封装容器)

鸿蒙开发中遇到容器相同、容器下面的子组件相同,就是子组件的文字不同,背景颜色不同,文字颜色不同之类,就可以使用Builder来封装,语法格式如下: 例如下面的界面: Row4个ColumImageText来实现&am…

Java初阶测试编程题目

文章目录 1.大小写转换2.斐波那契数列2.1递归解决(不推荐)2.2递推公式(非递归) 3.删除公共字符3.1题目说明3.2第一种方法3.3第二种方法 4.字符串的加法4.1题目说明4.2题目核心方法4.3题目代码解析 Java初阶测试编程题目分析与总结…

C++第六讲:STL--vector的使用及模拟实现

C第六讲&#xff1a;STL--vector的使用及模拟实现 1.vector简介2.vector的常见接口介绍2.1constructor -- 构造2.2destructor -- 析构2.3begin、end2.3.1vector和string的区别、vector<string> 2.4rbegin、rend2.5cbegin、cend2.6crbegin、crend2.7size、max_size、resiz…

C++AVL树的介绍和实现

目录 1.AVL树的概念 2.AVL树的实现 2.1AVL树的结构 2.2AVL树的插入 2.2.1AVL树插入一个值的大概过程 2.2.2平衡因子的更新 2.2.3插入节点及更新平衡因子的代码实现(暂未实现旋转逻辑) 2.3旋转 2.3.1旋转的原则 2.3.2右单旋(处理parent->_bf -2 && cur-&g…

简易入门:使用Docke 部署一个tomcat服务

简易入门&#xff1a;使用Docke 部署一个tomcat服务 # 拉取 >docker pull tomcat:9.0# 后台运行容器&#xff0c;端口映射为8080. -p 宿主机端口:容器端口 >docker run -d --name tomcat-c-01 -p 8080:8080 tomcat:9.0# 查看容器id >docker ps CONTAINER ID IMAG…

Qt-系统线程安全(63)

目录 描述 使用 线程不安全 线程安全 释放锁问题 其他的锁 条件变量和信号量 描述 多线程程序太复杂了 在C/C 和 Linux中&#xff0c;我们为了保证线程安全&#xff0c;简单的方式就是加锁 为此 Qt 也封装了自己的一套锁管理 使用 线程不安全 我们先测验一下线程不安…

七、程序流程控制

一、三种执行顺序 执行顺序说明顺序结构自上而下的执行代码分支结构根据条件&#xff0c;选择对应代码执行循环结构控制某段代码重复执行 二、分支结构 1、if 分支 根据条件&#xff08;真或假&#xff09;来决定执行某段代码if 分支有三种形式 //第一种形式 if(条件表达式…

Qt学习(一)——win10系统下Qt安装(Qt5.15.2+QtCreator5.0.3+MSVC2019)

win10平台下&#xff0c;Qt Creator 5.0.3 软件About Qt Creator界面如下&#xff1a; 其基于Qt 5.15.2 MSVC2019&#xff0c;64bit,故在用Qt4 设计师自定义控件所设计的控件能够被Qt Creator加载到&#xff0c;就要安装相应版本的Qt和MSVC。此安装便可支持win10系统下的自定义…