当前位置:网站首页>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
边栏推荐
- Transactions have four characteristics?
- Breadth first search rotten orange
- MySQL32-锁
- A trip to Macao - > see the world from a non line city to Macao
- Pytorch RNN actual combat case_ MNIST handwriting font recognition
- CSDN markdown editor
- 1. Mx6u learning notes (VII): bare metal development (4) -- master frequency and clock configuration
- MySQL 20 MySQL data directory
- MySQL主从复制、读写分离
- Global and Chinese markets of static transfer switches (STS) 2022-2028: Research Report on technology, participants, trends, market size and share
猜你喜欢
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博文摘要(一) —— 一个简单的初版实现
Just remember Balabala
Idea import / export settings file
Pytorch RNN actual combat case_ MNIST handwriting font recognition
IDEA 导入导出 settings 设置文件
MySQL19-Linux下MySQL的安装与使用
C language advanced pointer Full Version (array pointer, pointer array discrimination, function pointer)
Postman Interface Association
CSDN question and answer module Title Recommendation task (I) -- Construction of basic framework
随机推荐
Mysql30 transaction Basics
MySQL29-数据库其它调优策略
MySQL other hosts cannot connect to the local database
MySQL主从复制、读写分离
Mysql27 - Optimisation des index et des requêtes
35 is not a stumbling block in the career of programmers
MySQL35-主从复制
[reading notes] rewards efficient and privacy preserving federated deep learning
Emotional classification of 1.6 million comments on LSTM based on pytoch
Advantages and disadvantages of evaluation methods
SSM integrated notes easy to understand version
MySQL21-用戶與權限管理
MySQL19-Linux下MySQL的安装与使用
There are three iPhone se 2022 models in the Eurasian Economic Commission database
[leectode 2022.2.13] maximum number of "balloons"
Have you mastered the correct posture of golden three silver four job hopping?
CSDN问答标签技能树(一) —— 基本框架的构建
API learning of OpenGL (2004) gl_ TEXTURE_ MIN_ FILTER GL_ TEXTURE_ MAG_ FILTER
MySQL32-锁
CSDN blog summary (I) -- a simple first edition implementation