当前位置:网站首页>Ansible实战系列三 _ task常用命令
Ansible实战系列三 _ task常用命令
2022-07-06 09:13:00 【hyh123a】
前言
记录一下常用的ansible task中常用命令
注意记录时间和版本号
--- 记录于 2021年8月
环境
ubuntu 20.04
ansible 2.9.20
官方文档
https://docs.ansible.com/ansible/latest/user_guide/index.html
1、脚本相关
- 执行shell
- name: Add route
command: /sbin/ip route add 10.250.129.0/24 dev eth0
2、文件文本相关
- 复制
- name: Copy sources.list
copy:
src: sources.list.stretch
dest: /etc/apt/sources.list
- 修改文字
- name: Update monit service
lineinfile:
path: /etc/init.d/monit
regexp: '^CONFIG='
line: 'CONFIG=/root/monitrc'
- 删除文件
- name: Remove tunnel service
file:
path: /etc/systemd/system/node-exporter-tunnel.service
state: absent
3、安装卸载相关
- 安装
- name: Install tcpdump
apt:
name: tcpdump
update_cache: yes
- 卸载
- name: Uninstall ntpd
apt:
name: ntp
state: absent
4、服务相关
- 设置开机自启动
- name: Enable systemd-timesyncd service
systemd:
name: systemd-timesyncd
state: restarted
enabled: yes
daemon_reload: yes
- 关闭开机自启动
- name: Disable autossh-tunnel service
systemd:
name: autossh-tunnel
state: stopped
enabled: no
daemon_reload: yes
ignore_errors: yes
- 重启服务
- name: Restart journald service
systemd:
name: systemd-journald
state: restarted
5、 其他
- 设置时区
- name: Set timezone to Asia/Shanghai
timezone:
name: Asia/Shanghai
- 添加定时任务
- name: Add cronjob
cron:
name: "cell_mgmt.sh"
user: root
job: "/root/cell_mgmt.sh | sponge /root/cell_mgmt.prom"
cron_file: /etc/crontab
其他
如有问题 欢迎补充
如有疑问 欢迎提出
如有作用 欢迎点赞
边栏推荐
- 35 is not a stumbling block in the career of programmers
- Are you monitored by the company for sending resumes and logging in to job search websites? Deeply convinced that the product of "behavior awareness system ba" has not been retrieved on the official w
- MySQL34-其他数据库日志
- Mysql27 index optimization and query optimization
- Mysql33 multi version concurrency control
- CSDN问答标签技能树(五) —— 云原生技能树
- [untitled]
- Anaconda3 安装cv2
- [paper reading notes] - cryptographic analysis of short RSA secret exponents
- MySQL29-数据库其它调优策略
猜你喜欢

MySQL35-主从复制

Moteur de stockage mysql23
![[unity] simulate jelly effect (with collision) -- tutorial on using jellysprites plug-in](/img/1f/93a6c6150ec2b002f667a882569b7b.jpg)
[unity] simulate jelly effect (with collision) -- tutorial on using jellysprites plug-in

Why is MySQL still slow to query when indexing is used?
![[C language] deeply analyze the underlying principle of data storage](/img/d6/1c0cd38c75da0d0cc1df7f36938cfb.png)
[C language] deeply analyze the underlying principle of data storage

CSDN问答标签技能树(五) —— 云原生技能树

MySQL29-数据库其它调优策略

MySQL23-存储引擎

MySQL31-MySQL事务日志

Mysql21 user and permission management
随机推荐
Bytetrack: multi object tracking by associating every detection box paper reading notes ()
MySQL28-数据库的设计规范
Mysql25 index creation and design principles
Idea import / export settings file
Global and Chinese market for intravenous catheter sets and accessories 2022-2028: Research Report on technology, participants, trends, market size and share
Pytorch RNN actual combat case_ MNIST handwriting font recognition
Windows cannot start the MySQL service (located on the local computer) error 1067 the process terminated unexpectedly
【博主推荐】C# Winform定时发送邮箱(附源码)
Invalid default value for 'create appears when importing SQL_ Time 'error reporting solution
MySQL完全卸载(Windows、Mac、Linux)
Kubernetes - problems and Solutions
Postman environment variable settings
windows下同时安装mysql5.5和mysql8.0
NPM an error NPM err code enoent NPM err syscall open
La table d'exportation Navicat génère un fichier PDM
MNIST implementation using pytoch in jupyter notebook
First blog
Global and Chinese markets for aprotic solvents 2022-2028: Research Report on technology, participants, trends, market size and share
Mysql27 index optimization and query optimization
MySQL31-MySQL事务日志