当前位置:网站首页>Ansible practical Series III_ Task common commands
Ansible practical Series III_ Task common commands
2022-07-06 10:56:00 【hyh123a】
Preface
Record the common ansible task Common commands in
Note the time and version number
--- Record on 2021 year 8 month
Environmental Science
ubuntu 20.04
ansible 2.9.20
Official documents
https://docs.ansible.com/ansible/latest/user_guide/index.html
1、 Script related
- perform shell
- name: Add route
command: /sbin/ip route add 10.250.129.0/24 dev eth0
2、 Document text related
- Copy
- name: Copy sources.list
copy:
src: sources.list.stretch
dest: /etc/apt/sources.list
- Change the text
- name: Update monit service
lineinfile:
path: /etc/init.d/monit
regexp: '^CONFIG='
line: 'CONFIG=/root/monitrc'
- Delete file
- name: Remove tunnel service
file:
path: /etc/systemd/system/node-exporter-tunnel.service
state: absent
3、 Install and uninstall related software
- install
- name: Install tcpdump
apt:
name: tcpdump
update_cache: yes
- uninstall
- name: Uninstall ntpd
apt:
name: ntp
state: absent
4、 Service related
- Set power on self start
- name: Enable systemd-timesyncd service
systemd:
name: systemd-timesyncd
state: restarted
enabled: yes
daemon_reload: yes
- Turn off startup
- name: Disable autossh-tunnel service
systemd:
name: autossh-tunnel
state: stopped
enabled: no
daemon_reload: yes
ignore_errors: yes
- Restart the service
- name: Restart journald service
systemd:
name: systemd-journald
state: restarted
5、 other
- Set time zone
- name: Set timezone to Asia/Shanghai
timezone:
name: Asia/Shanghai
- Add timing task
- name: Add cronjob
cron:
name: "cell_mgmt.sh"
user: root
job: "/root/cell_mgmt.sh | sponge /root/cell_mgmt.prom"
cron_file: /etc/crontab
other
If there is a problem Welcome to add
If you have any questions Welcome to
If it works Welcome to thumb up
边栏推荐
- CSDN问答模块标题推荐任务(二) —— 效果优化
- MySQL27-索引优化与查询优化
- [recommended by bloggers] C # generate a good-looking QR code (with source code)
- Mysql27 - Optimisation des index et des requêtes
- Mysql35 master slave replication
- MySQL 29 other database tuning strategies
- Nanny hand-in-hand teaches you to write Gobang in C language
- 虚拟机Ping通主机,主机Ping不通虚拟机
- C语言标准的发展
- [programmers' English growth path] English learning serial one (verb general tense)
猜你喜欢
Mysql36 database backup and recovery
MySQL31-MySQL事务日志
Swagger、Yapi接口管理服务_SE
MySQL18-MySQL8其它新特性
Installation and use of MySQL under MySQL 19 Linux
CSDN question and answer tag skill tree (I) -- Construction of basic framework
Postman Interface Association
A brief introduction to the microservice technology stack, the introduction and use of Eureka and ribbon
Some problems in the development of unity3d upgraded 2020 VR
MySQL33-多版本并发控制
随机推荐
【博主推荐】C#MVC列表实现增删改查导入导出曲线功能(附源码)
There are three iPhone se 2022 models in the Eurasian Economic Commission database
[paper reading notes] - cryptographic analysis of short RSA secret exponents
Some problems in the development of unity3d upgraded 2020 VR
[recommended by bloggers] asp Net WebService background data API JSON (with source code)
Mysql35 master slave replication
Why is MySQL still slow to query when indexing is used?
MySQL20-MySQL的数据目录
@Controller, @service, @repository, @component differences
MySQL21-用戶與權限管理
A brief introduction to the microservice technology stack, the introduction and use of Eureka and ribbon
[BMZCTF-pwn] 12-csaw-ctf-2016-quals hungman
数据库中间件_Mycat总结
A trip to Macao - > see the world from a non line city to Macao
Solve the problem that XML, YML and properties file configurations cannot be scanned
MySQL32-锁
Ubuntu 20.04 安装 MySQL
CSDN问答模块标题推荐任务(二) —— 效果优化
[programmers' English growth path] English learning serial one (verb general tense)
Esp8266 at+cipstart= "", "", 8080 error closed ultimate solution