当前位置:网站首页>Related operations of ansible and Playbook
Related operations of ansible and Playbook
2022-06-25 00:06:00 【qq_ fifty-two million one hundred and seventy-eight thousand fi】
1、 Deploy to the managed host yum Warehouse , Examples are as follows :
Warehouse 1 : Name: base
Description: baseos
Base url: Index of /centos-vault/8.5.2111/BaseOS/x86_64/os/
Need to validate the package GPG Signature GPG key stay /etc/pki/rpm-gpg/RPM-GPG-KEY-*
Enable this software repository
Warehouse 2: Name: app
Description: appstream
Base url: Index of /centos-vault/8.5.2111/AppStream/x86_64/os/
Need to validate the package GPG Signature GPG key stay : /etc/pki/rpm-gpg/RPM-GPG-KEY-*
Enable this software repository
[[email protected] test01]$ vim creat_yum.yml
---
- name: play1
hosts: all
tasks:
- name: create base
yum_repository:
name: base
description: baseos
baseurl: https://mirrors.aliyun.com/centos-vault/8.2.2004/BaseOS/x86_64/os/
gpgcheck: yes
- name: create appstream
yum_repository:
name: app
description: appstream
baseurl: https://mirrors.aliyun.com/centos-vault/8.2.2004/AppStream/x86_64/os/
gpgcheck: yes
- name: install vsftpd
yum:
name: vsftpd
state: latestnotes : Check your own linux System version , And select the corresponding version warehouse .
After successful deployment, install on the managed host vsftpd software package
2、 to web Host group write one playbook, The playbook There are two play, first play It can be guaranteed in web Install on host group httpd and php, Make sure web Of the host group /var/www/html/ There is a file under the directory named index.php, The contents are as follows :
$ cat /var/www/html/index.php <?php phpinfo();
The playbook The second one play Used to test the web Of the host group web Whether the service can be successfully accessed index.php Content .
[[email protected] test01]$ vim inventory
[[email protected] test01]$ vim 1.yml


3、 Add a normal user on the controlled node xiaohong, Users who configure the current control node can log in without secret xiaohong user , also xiaohong Sure sudo.
[[email protected] test01]$ vim 2.yml
---
- name: play1
hosts: node01
tasks:
- name: useradd xiaohong
user:
name: xiaohong
state: present
- name: xiaohong sudoers
lineinfile:
line: "xiaohong ALL=(ALL) NOPASSWD:ALL"
path: /etc/sudoers
- authorized_key:
state: present
user: xiaohong
key: "{
{ lookup('file', '/home/admin/.ssh/id_rsa.pub') }}"
边栏推荐
- 人体改造 VS 数字化身
- 磁带svg动画js特效
- China CAE industry investment strategic planning and future development analysis report 2022 ~ 2028
- Reservoir dam safety monitoring
- Analysis report on development trend and investment forecast of global and Chinese D-leucine industry from 2022 to 2028
- JPA学习2 - 核心注解、注解进行增删改查、List查询结果返回类型、一对多、多对一、多对多
- Arbitrary file download of file operation vulnerability (7)
- 5G dtu无线通信模块的电力应用
- Signal integrity (SI) power integrity (PI) learning notes (I) introduction to signal integrity analysis
- Analysis report on operation pattern and supply and demand situation of global and Chinese cyano ketoprofen industry from 2022 to 2028
猜你喜欢

Tiktok practice ~ project associated unicloud

Stm32f030f4 reading infrared remote control data

Svg line animation background JS effect

DO280OpenShift访问控制--加密和ConfigMap

Difficult and miscellaneous problems: A Study on the phenomenon of text fuzziness caused by transform

信号完整性(SI)电源完整性(PI)学习笔记(二十五)差分对与差分阻抗(五)

使用网络摄像头进行眼睛注视估计

有趣的checkbox计数器

Hello C (I) -- basics of C language

Interesting checkbox counters
随机推荐
linux 系统redis常用命令
Analysis report on development trend and investment forecast of global and Chinese D-leucine industry from 2022 to 2028
Scala IO writes data to a text file
颜色渐变梯度颜色集合
Why do more and more physical stores use VR panorama? What are the advantages?
从数字化过渡到智能制造
Nacos究竟是什么
Difficult and miscellaneous problems: A Study on the phenomenon of text fuzziness caused by transform
How does VR panorama make money? Based on the objective analysis of the market from two aspects
MySQL problem points
Creative SVG ring clock JS effect
Scala IO serialization and deserialization
Hibernate learning 3 - custom SQL
Hello C (III) - pointer
怎么把wps表格里某一列有重复项的整行删掉
Window system installation Nacos
In the past 5 years, from "Diandian" to the current test development, my success is worth learning from.
使用网络摄像头进行眼睛注视估计
Scala IO reads data from URLs and other data sources
【图数据库性能和场景测试利器LDBC SNB】系列一:数据生成器简介 & 应用于GES服务