当前位置: 首页 > news >正文

apache 配置网站公司域名注册查询

apache 配置网站,公司域名注册查询,网站建设的优点和不足,中国十大知名网站ansible的一些重要配置文件 一、/etc/ansible有以下三个文件或者目录生成(默认配置文件) 1、Hosts ​ 主机清单配置文件 2、ansible.cfg ​ Ansible配置文件 3、Roles ​ 角色定义目录 [rootansible ~]# ssh rootmaster rootmasters pa…

ansible的一些重要配置文件

一、/etc/ansible有以下三个文件或者目录生成(默认配置文件)
1、Hosts

​ 主机清单配置文件

2、ansible.cfg

​ Ansible配置文件

3、Roles

​ 角色定义目录

[root@ansible ~]# ssh root@master
root@master's password: 
Register this system with Red Hat Insights: insights-client --register
Create an account or view all your systems at https://red.ht/insights-dashboard
Last login: Tue Aug 26 23:14:28 2025 from 192.168.122.1
[root@master ~]# cd /etc/ansible/
[root@master ansible]# ls
ansible.cfg  hosts  roles
二、ansible配置文件优先级

ANSIBLE_CONFIG :⾸先,Ansible命令会检查环境变量,及这个环境变量指向的配置⽂件

​ export ANSIBLE_CONFIG=/PATH

./ansible.cfg :其次,将会检查当前目录下的ansible.cfg配置⽂件

~/.ansible.cfg :再次,将会检查当前用户home目录下的.ansible.cfg配置⽂件

/etc/ansible/ansible.cfg :最后,将会检查软件包管理⼯具安装Ansible时产⽣的配置⽂件(默认配置文件

在没有手动定义 export ANSIBLE_CONFIG=/PATH的背景下:
[root@master ~]# ls  //当前目录下没有ansible.cfg的配置文件
anaconda-ks.cfg
[root@master ~]# pwd  //当前用户的家目录下也没有隐藏的.ansible.cfg的配置文件
/root
[root@master ~]# ls -a
.   anaconda-ks.cfg  .bash_history  .bash_profile  .cshrc  .tcshrc
..  .ansible         .bash_logout   .bashrc        .ssh    .viminfo[root@master ~]# ansible --version  //所以找的是默认配置文件
ansible [core 2.13.3]config file = /etc/ansible/ansible.cfg  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']ansible python module location = /usr/lib/python3.9/site-packages/ansibleansible collection location = /root/.ansible/collections:/usr/share/ansible/collectionsexecutable location = /usr/bin/ansiblepython version = 3.9.16 (main, Dec  8 2022, 00:00:00) [GCC 11.3.1 20221121 (Red Hat 11.3.1-4)]jinja version = 3.1.2libyaml = True
[root@master ~]# touch ansible.cfg  //在当前目录下创建一个ansible.cfg的配置文件
[root@master ~]# ls
anaconda-ks.cfg  ansible.cfg
[root@master ~]# ansible --version   //找的就是当前目录下的ansible.cfg的配置文件
ansible [core 2.13.3]config file = /root/ansible.cfgconfigured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']ansible python module location = /usr/lib/python3.9/site-packages/ansibleansible collection location = /root/.ansible/collections:/usr/share/ansible/collectionsexecutable location = /usr/bin/ansiblepython version = 3.9.16 (main, Dec  8 2022, 00:00:00) [GCC 11.3.1 20221121 (Red Hat 11.3.1-4)]jinja version = 3.1.2libyaml = True[root@master ~]# rm -rf ansible.cfg  //删除掉当前目录下的ansible.cfg的配置文件
[root@master ~]# ls
anaconda-ks.cfg
[root@master ~]# touch .ansible.cfg  //在用户的家目录下创建一个隐藏的.ansible.cfg的配置文件
[root@master ~]# ansible --version  //找的就是用户的家目录下创建一个隐藏的.ansible.cfg的配置文件
ansible [core 2.13.3]config file = /root/.ansible.cfgconfigured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']ansible python module location = /usr/lib/python3.9/site-packages/ansibleansible collection location = /root/.ansible/collections:/usr/share/ansible/collectionsexecutable location = /usr/bin/ansiblepython version = 3.9.16 (main, Dec  8 2022, 00:00:00) [GCC 11.3.1 20221121 (Red Hat 11.3.1-4)]jinja version = 3.1.2libyaml = True
[root@master ~]# touch ansible.cfg
[root@master ~]# ls -a   
//如果既有当前目录下的ansible.cfg的配置文件,又有用户的家目录下隐藏的.ansible.cfg的配置文件
.   anaconda-ks.cfg  .ansible.cfg  .bash_history  .bash_profile  .cshrc  .tcshrc
..  .ansible         ansible.cfg   .bash_logout   .bashrc        .ssh    .viminfo
[root@master ~]# ansible --version  //找的就是当前目录下的ansible.cfg的配置文件
ansible [core 2.13.3]config file = /root/ansible.cfgconfigured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']ansible python module location = /usr/lib/python3.9/site-packages/ansibleansible collection location = /root/.ansible/collections:/usr/share/ansible/collectionsexecutable location = /usr/bin/ansiblepython version = 3.9.16 (main, Dec  8 2022, 00:00:00) [GCC 11.3.1 20221121 (Red Hat 11.3.1-4)]jinja version = 3.1.2libyaml = True

注意:

剧本里定义的优先级比配置文件定义的优先级要高,所以当剧本的定义和配置文件的定义发生冲突时,我们首先考虑剧本里面的定义(但仅限于执行此剧本)

三、主配置文件/etc/ansible/ansible.cfg解析

[defaults] 默认配置

#inventory = /etc/ansible/hosts #主机列表配置文件

#remote_tmp = ~/.ansible/tmp #临时py命令文件存放在远程主机目录

#forks = 5 #默认并发数 (在Linux中因为任务是在受控主机里面执行所以没有影响,在网络设备中因为是在节点里面执行,所以存在影响,值不能过大)

#remote_port = 22 #远程端口号

#remote_user = root ----连接的时候使用什么用户进行连接

#roles_path = /etc/ansible/roles

#host_key_checking = False

#collections_path = 定义集合的路径,第三方模块通常安装在此目录下

[privilege_escalation] 定义对受管主机执行特权升级,默认普通用户是没有权限来执行ansible任务的,但是我们可以给普通用户提权,让它有权限去执行ansible任务

become = true //开启提权

become_method = sudo //提权方式sudo

become_user = root //将普通用户提权成为root用户

become_ask_pass = false //提权时不需要输入密码

[paramiko_connection]、[ssh_connection]、[accelerate]用于优化与受管主机的连接

[selinux] 定义如何配置selinux交互

四、主机清单

清单定义ansible将要管理的一批主机。(写了/etc/hosts可以解析受控主机的别名,没有则可以写对应IP地址)

这些主机也可以分配到组中,以进行集中管理。组可以包含子组,主机也可以是多个组的成员。清单还可以设置应用到它所定义的主机和组的变量。

例:

​ 创建名为/home/student/ansible/inventory的静态清单文件, 以满足以下需求:

​ node1是dev主机组的成员

​ node2是test主机组的成员

​ node3是prod主机组的成员

​ prod组是webservers主机组的成员

[student@master ~]$ cd /home/student/ansible/
[student@master ansible]$ ls
ansible.cfg  collections  inventory  roles
[student@master ansible]$ vim inventory 
[student@master ansible]$ cat inventory
[dev]
node1[test]
node2[prod]
node3[webservers:children]
prod
[student@master ansible]$ ansible all -i inventory --list-hostshosts (3):node1node2node3
[student@master ansible]$ ansible dev -i inventory --list-hostshosts (1):node1

在这里插入图片描述

http://www.dtcms.com/a/443136.html

相关文章:

  • 浅谈高校图书馆网站建设公司装修费分几年摊销
  • 从工具到语境:Anthropic 双文启示下的 AI 代理工程实践心得
  • 做5173这样的网站要多少人5 网站建设进度表
  • 广东专业的网站制作江门cms模板建站
  • 教育机构网站制作模板宁波seo外包代运营
  • 网站建设的作用和用途做网站 学什么
  • 成都网站推广优化公司形容网站做的好处
  • Java学习笔记Day15
  • 湘潭自助建站系统展览馆设计公司排名
  • 电子商务网站规划建设方案网络销售的方法和技巧
  • 阿里巴巴网站的营销策略专用主机网站建设
  • 网站设计制作程序网站策划选题
  • 长沙手机网站公司开发项目的流程
  • 初识MYSQL —— 库和表的操作
  • 怎样做网站推广自己网站建设要维护
  • 常州网站建设公司报价网站安全监测
  • 网站建设的中期报告网页qq登陆聊天
  • 什么网站做执法仪商业网站开发设计报告
  • 海南省建设局网站搜索咋样做班级主页网站
  • 成品网站源码1688体验区网站图片列表怎么做
  • 网站建站网站设计以绿色为主的网站
  • 嘉兴免费网站建站模板化工类 网站模板
  • 网站建设整个流程图威联通怎么建设网站
  • Spring AI 从入门到实战-目录
  • 为什么没有人做像58一样的网站湖南城市建设网站
  • C++进阶(6)——lambda表达式
  • 数据结构(2)-------- 线性表
  • 网站建设 源代码asp.net 做网站
  • C++ :std::bind 还能用吗?它和 Lambda 有什么区别?
  • 优秀网站特点广告制作安装工