hosts

How to put wildcard entry into /etc/hosts?

这一生的挚爱 提交于 2019-11-27 17:39:56
I recently wanted to point all subdomains for a test domain, let's say example.com to the localhost. Is there a way to point all requests on *.example.com to resolve to 127.0.0.1 aamir It happens that /etc/hosts file doesn't support wild card entries. You'll have to use other services like dnsmasq. To enable it in dnsmasq, just edit dnsmasq.conf and add the following line: address=/example.com/127.0.0.1 Here is the configuration for those trying to accomplish the original goal (wildcards all pointing to same codebase -- install nothing, dev environment ie, XAMPP) hosts file (add an entry) file

Force fact-gathering on all hosts

。_饼干妹妹 提交于 2019-11-27 17:18:01
问题 I'm sitting in front of a fairly complex Ansible project that we're using to set up our local development environments (multiple VMs) and there's one role that uses the facts gathered by Ansible to set up the /etc/hosts file on every VM. Unfortunately, when you want to run the playbook for one host only (using the -limit parameter) the facts from the other hosts are (obviously) missing. Is there a way to force Ansible to gather facts on all hosts, even if you limit the playbook to one

How to add more than one machine to the trusted hosts list using winrm

北慕城南 提交于 2019-11-27 17:09:43
To run powershell commands on a machine from a remote machine we have to add the remote machine to the trusted hosts list of the host machine. I am adding machine A to machine B's trusted hosts using the following command : winrm set winrm/config/client ‘@{TrustedHosts="machineA"}’ How to add more machines say machine C, machine D to trusted hosts list of machine B? I prefer to work with the PSDrive WSMan:\ . Get TrustedHosts Get-Item WSMan:\localhost\Client\TrustedHosts Set TrustedHosts provide a single, comma-separated, string of computer names Set-Item WSMan:\localhost\Client\TrustedHosts

Apache(基于主机名)

坚强是说给别人听的谎言 提交于 2019-11-27 16:44:33
1.配置hosts文件   (1).hosts文件作用是定义IP地址与主机名的映射关系, 即强制将某个主机名地址解析到指定的 IP地址 。   (2)输入命令“vi /etc/hosts”,打开hosts文件,输入如下内容      2.分别创建网站数据目录      (1)分别在网站目录中写入不同的首页文件        (2)用cat命令检查输入内容是否正确      3.在配置文件中描述基于主机名称的虚拟主机(配置文件:/etc/httpd/conf/httpd.conf)    4.重启Apache服务器,分别访问网站验证结果   (1)访问www.localprode.com        (2)访问bbs.localprode.com        (3)访问tech.localprode.com      来源: https://www.cnblogs.com/meng-yu37/p/11937806.html

linux批量管理工具之ansible

為{幸葍}努か 提交于 2019-11-27 15:48:31
准备(前戏) 安装 yum install ansible 查看与ansible相关的文件信息 rpm -ql ansible|less 命令与选项 hosts基本语法 主机与组 [webserver] www.exaple.com test.exaple.com [dbserver] one.example.com two.example.com 备注 :端口号不是默认的时候,可以表示为 www.exaple.com:5122 主机别名 如果有些静态IP地址,希望设置一些别名,但不是在系统的host文件中做解析 test_name ansible_ssh_port=5122 ansible_ssh_host=192.168.100.1 主机名扩展 可以像bash那样设置一组名称类似的主机 [webserver] web[01:50].example.com db-[a:f].example.com 自定连接 对于每一个host,还可以选择连接类型和连接用户名 [targets] other1.example.com ansible_connection=ssh ansible_ssh_user=sam other2.example.com ansible_connection=ssh ansible_ssh_user=mdehaan 主机变量 在hosts中给主机设置变量

linux ansible工具应用

泄露秘密 提交于 2019-11-27 15:45:13
ansible 是一款linux 集群自动化运维工具,具有非常强大的集群运维能力。下面就简单的运维命令进行记录 此次测试总共有三台机,分别如下: ansible服务器:10.0.0.20 client01:10.0.0.21 client02:10.0.0.22 一、安装ansible   1、 python版本需要2.6以上,不过通过centos7都会默认安装上python2.7.5,查看方法:python -V   3、 yum clean all   4、 安装ansible:yum install ansible -y 二、配置ansible   1、 使用ansible前需实现ansible服务器对另外两台机的ssh无密码访问,操作如下:     a、 输入命令:ssh-keygen,一直按回车,直至完成操作;     b、 命令:ssh-copy-id root@172.16.0.92 ,然后输入连接密码即可实现无密码访问,另外一台机的设置方式一样,不再赘述。   2、 添加ansible客户机组,命令:cat /etc/ansible/hosts,在最后面添加如下内容:     [hadoop]     172.16.0.91     172.16.0.92 172.16.0.93 [root@k8s-master ansible]# cat hosts # This

pssh

最后都变了- 提交于 2019-11-27 13:28:25
1、pssh 简介   PSSH提供OpenSSH和相关工具的并行版本。包括pssh,pscp,prsync,pnuke和pslurp。该项目包括psshlib,可以在自定义应用程序中使用。 pssh是python编写,可以并发在多台机器上批量执行命令的工具,用法可以媲美ansible的一些简单用法,执行起来速度比ansible快,支持文件并行复制,远程命令。 2、pssh安装 3、pssh包的命令介绍 pssh 在多个主机上并行运行命令 pscp 把文件并行复制到多个主机上 prsync 通过rsync协议把文件高效并行复制到多个主机上 pslurp 把文件并行地从多个远程主机复制到中心主机上 pnuke 并行地在多个远程主机上杀死进程 4、pssh包的命令参数说明及使用   为命令执行使用先准备一个主机列表文件,用于连接对应主机执行远程命令   内容可以是主机名,也可以直接填写IP, 格式"host[:port] [user]"   如:cat /home/pssh/pssh_hosts   192.168.1.122   xxx.xxx.xxx.xxx 1)pssh命令参数及使用:在多个主机上并行运行命令   pssh命令参数:  pssh Usage: pssh [OPTIONS] -h hosts.txt prog [arg0] .. -h --hosts 主机文件列表

Centos7搭建OpenNebula云平台

帅比萌擦擦* 提交于 2019-11-27 12:11:58
OpenNebula概述 OpenNebula是专门为云计算打造的开源系统,用户可以使用Xen、KVM、VMware等虚拟化软件一起打造企业云。利用OpenNebula可以轻松构建私有云、混合云、公开云。 OpenNebula提供丰富的接口和许多资源管理、预配置目录,可以快速、安全地构建富有弹性的云平台。 OpenNebula的工作机制相对比较简单,传输方式为SSH将虚拟化管理命令传输至各节点,这样做的好处是无需安装额外的服务或软件,降低了软件的复杂性。 主控端部署: 这里直接用hosts文件做DNS解析 [root@opennebula ~]# vim /etc/hosts [root@opennebula ~]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.1.5 master 192.168.1.16 node1 192.168.1.19 store 将所有主机上hosts文件进行替换: [root@opennebula ~]# scp /etc/hosts root@node1:

ansible安装

馋奶兔 提交于 2019-11-27 11:21:21
第一章 ansible产品简介 1.1 功能概述 ansible是新出现的自动化运维工具,基于Python开发,集合了众多运维工具(puppet、cfengine、chef、func、fabric)的优点,实现了批量系统配置、批量程序部署、批量运行命令等功能。 1.2 功能说明 ansible是基于模块工作的,本身没有批量部署的能力。真正具有批量部署的是ansible所运行的模块,ansible只是提供一种框架。主要包括: (1)、连接插件connection plugins:负责和被监控端实现通信; (2)、host inventory:指定操作的主机,是一个配置文件里面定义监控的主机; (3)、各种模块核心模块、command模块、自定义模块; (4)、借助于插件完成记录日志邮件等功能; (5)、playbook:剧本执行多个任务时,非必需可以让节点一次性运行多个任务。 1.3 部署说明 部署ansible需要跟被管理端开启免密登录(强烈不建议使用root用户),将普通用户赋予root用户权限,只允许一个ip登录。 1.3.1 免密登录 需要跟服务端开启免密登录,强烈不建议使用root用户,将普通用户赋予root用户权限,只允许一个ip登录,需要关闭selinux如若不关闭需安装yum install libselinux-python -y(建议安装)! 第二章

Windows Batch: How to add Host-Entries?

孤街浪徒 提交于 2019-11-27 11:15:13
I want to use this batch script to add new entries into my host file automatically by using windows batch. Unfortunately, the script just adds one single line to the hosts file , also when i run the script as a administrator, so what's wrong? @echo off set hostspath=%windir%\System32\drivers\etc\hosts echo 62.116.159.4 ns1.intranet.de >> %hostspath% echo 217.160.113.37 ns2.intranet.de >> %hostpath% echo 89.146.248.4 ns3.intranet.de >> %hostpath% echo 74.208.254.4 ns4.intranet.de >> %hostpath% exit I would do it this way, so you won't end up with duplicate entries if the script is run multiple