Ubuntu22.04使用apt在线安装Ansible
Ubuntu22.04使用apt在线安装Ansible
0.环境说明
操作系统版本:Ubuntu 20.04.6 LTS
1.配置apt源
将 apt 源修改为阿里云,操作步骤及命令如下:
# 备份并修改配置文件
cd /etc/apt/ && cp sources.list sources.list.bak
cat << EOF > sources.list
deb https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
# deb https://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
EOF
# 更新apt仓库
apt update
2.安装Ansible软件
注意:安装后不需要启动 Ansible。
安装命令如下:
# 使用apt安装Ansible
apt install ansible -y
# 查看Ansible版本
ansible --version
3.修改配置文件
修改配置文件,将跳过指纹检测选项打开,命令如下:
sed -i 's/#host_key_checking = False/host_key_checking = False/g' /etc/ansible/ansible.cfg

浙公网安备 33010602011771号