gpt4 book ai didi

linux - Ansible 剧本

转载 作者:太空狗 更新时间:2023-10-29 11:24:04 26 4
gpt4 key购买 nike

我以前没有使用过 Ansible,有谁知道如何编写一个简单的 playbook 来卸载 nano 并在 Linux 服务器上安装 vim?我想在完成上述操作后,您需要包含一个选项来配置您想要的文本编辑器首选项。

干杯

编辑

这就是我到目前为止所得到的......

---
# Playbook to uninstall nano and install vim

- hosts: all
remote_user: luca
sudo: yes

tasks:
- name: uninstall nano
action: command: sudo apt-get purge nano

- name: Install vim
action: command: sudo apt-get install vim

最佳答案

tmp.yml

---
- hosts: all
tasks:
- name: nano remove
apt: name=nano state=absent
- name: vim install
apt: name=vim state=present

ansible-playbook tmp.yml

关于linux - Ansible 剧本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23048985/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com