当前位置:网站首页>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
边栏推荐
- First blog
- Mysql21 user and permission management
- CSDN question and answer module Title Recommendation task (I) -- Construction of basic framework
- [BMZCTF-pwn] 12-csaw-ctf-2016-quals hungman
- Global and Chinese market of operational amplifier 2022-2028: Research Report on technology, participants, trends, market size and share
- Unicode decodeerror: 'UTF-8' codec can't decode byte 0xd0 in position 0 successfully resolved
- Nanny hand-in-hand teaches you to write Gobang in C language
- Global and Chinese markets of static transfer switches (STS) 2022-2028: Research Report on technology, participants, trends, market size and share
- Mysql35 master slave replication
- MySQL20-MySQL的数据目录
猜你喜欢

CSDN blog summary (I) -- a simple first edition implementation

windows下同时安装mysql5.5和mysql8.0

MySQL24-索引的数据结构

MySQL transaction log

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

Esp8266 at+cipstart= "", "", 8080 error closed ultimate solution

CSDN markdown editor

Win10: how to modify the priority of dual network cards?

Invalid global search in idea/pychar, etc. (win10)

Nanny hand-in-hand teaches you to write Gobang in C language
随机推荐
CSDN问答模块标题推荐任务(二) —— 效果优化
[Li Kou 387] the first unique character in the string
Unicode decodeerror: 'UTF-8' codec can't decode byte 0xd0 in position 0 successfully resolved
Global and Chinese market of transfer switches 2022-2028: Research Report on technology, participants, trends, market size and share
[paper reading notes] - cryptographic analysis of short RSA secret exponents
虚拟机Ping通主机,主机Ping不通虚拟机
Mysql26 use of performance analysis tools
SSM整合笔记通俗易懂版
MySQL主从复制、读写分离
Global and Chinese market for intravenous catheter sets and accessories 2022-2028: Research Report on technology, participants, trends, market size and share
Yum prompt another app is currently holding the yum lock; waiting for it to exit...
[recommended by bloggers] C WinForm regularly sends email (with source code)
[recommended by bloggers] C MVC list realizes the function of adding, deleting, modifying, checking, importing and exporting curves (with source code)
Water and rain condition monitoring reservoir water and rain condition online monitoring
【博主推荐】asp.net WebService 后台数据API JSON(附源码)
Other new features of mysql18-mysql8
MySQL27-索引優化與查詢優化
[C language] deeply analyze the underlying principle of data storage
MySQL23-存儲引擎
Win10: how to modify the priority of dual network cards?