当前位置:网站首页>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
边栏推荐
- La table d'exportation Navicat génère un fichier PDM
- Navicat 導出錶生成PDM文件
- Ubuntu 20.04 安装 MySQL
- MySQL32-锁
- [BMZCTF-pwn] 12-csaw-ctf-2016-quals hungman
- Mysql27 - Optimisation des index et des requêtes
- Transactions have four characteristics?
- CSDN-NLP:基于技能树和弱监督学习的博文难度等级分类 (一)
- CSDN question and answer module Title Recommendation task (II) -- effect optimization
- Database middleware_ MYCAT summary
猜你喜欢

MySQL18-MySQL8其它新特性

Mysql33 multi version concurrency control

Case identification based on pytoch pulmonary infection (using RESNET network structure)

Isn't there anyone who doesn't know how to write mine sweeping games in C language
![[reading notes] rewards efficient and privacy preserving federated deep learning](/img/c3/5e88277b5024885d5ceeaa0de14b27.jpg)
[reading notes] rewards efficient and privacy preserving federated deep learning

【博主推荐】C#MVC列表实现增删改查导入导出曲线功能(附源码)

【博主推荐】C#生成好看的二维码(附源码)

CSDN问答模块标题推荐任务(一) —— 基本框架的搭建

API learning of OpenGL (2002) smooth flat of glsl

Postman Interface Association
随机推荐
【博主推荐】asp.net WebService 后台数据API JSON(附源码)
Time in TCP state_ The role of wait?
Mysql32 lock
Postman Interface Association
@Controller, @service, @repository, @component differences
A brief introduction to the microservice technology stack, the introduction and use of Eureka and ribbon
API learning of OpenGL (2005) gl_ MAX_ TEXTURE_ UNITS GL_ MAX_ TEXTURE_ IMAGE_ UNITS_ ARB
Valentine's Day is coming, are you still worried about eating dog food? Teach you to make a confession wall hand in hand. Express your love to the person you want
CSDN博文摘要(一) —— 一个简单的初版实现
Solve the problem that XML, YML and properties file configurations cannot be scanned
Generate PDM file from Navicat export table
MySQL23-存储引擎
Mysql30 transaction Basics
frp内网穿透那些事
The virtual machine Ping is connected to the host, and the host Ping is not connected to the virtual machine
Postman environment variable settings
[paper reading notes] - cryptographic analysis of short RSA secret exponents
API learning of OpenGL (2001) gltexgen
【博主推荐】C#MVC列表实现增删改查导入导出曲线功能(附源码)
Idea import / export settings file