
概述
有谁知道ansible是怎么读的
什么是ansible
简单的介绍一下这个东西,首先这个东西是用python写的
说一下我的环境
我的是四台虚拟机,centos系统,然后的话是安装了k8s的分别是
- k8s-master
- k8s-slave1
- k8s-slave2
- k8s-slave3
- k8s-slave4
但是这个都不管,我们主要是用来做ansible的实验,还有如果文章中没有说明,那么一切操作都是在k8s-master节点上操作
安装
安装直接使用包管理器安装就好了
yum install epel-release
yum install ansible
给机器添加秘钥
首先在k8s-master节点生成秘钥
ssh-keygen -t rsa
之后一路回车
之后把秘钥导入到每一台机器中
ssh-copy-id root@192.168.1.151
ssh-copy-id root@192.168.1.156
ssh-copy-id root@192.168.1.148
ssh-copy-id root@192.168.1.139
配置ansible
下面有几个配置文件要注意 一下
首先是
vim /etc/ansible/hosts
里面定义的是集群中的主机,比如我的
[k8s-server]192.168.1.151192.168.1.139192.168.1.148192.168.1.156[k8s-master]192.168.1.139[k8s-slave]192.168.1.148192.168.1.156192.168.1.151上面这样是一组主机,如果我要在这一组主机里面去执行一个命令如下所示
[root@bboysoul-k8s-master ~]# ansible k8s-server -m shell -a "hostname"192.168.1.151 | SUCCESS | rc=0 >>bboysoul-k8s-slave1192.168.1.156 | SUCCESS | rc=0 >>bboysoul-k8s-slave3192.168.1.148 | SUCCESS | rc=0 >>bboysoul-k8s-slave2192.168.1.139 | SUCCESS | rc=0 >>bboysoul-k8s-masterk8s-server表示在这个组主机里面执行命令,-m表示要使用的模块,-a就是模块里面的参数
又如下面这样
[root@bboysoul-k8s-master ~]# ansible k8s-master -m shell -a "hostname"192.168.1.139 | SUCCESS | rc=0 >>bboysoul-k8s-master或者你想要在所有主机下执行这个命令
[root@bboysoul-k8s-master ~]# ansible all -m shell -a "hostname"192.168.1.139 | SUCCESS | rc=0 >>bboysoul-k8s-master192.168.1.151 | SUCCESS | rc=0 >>bboysoul-k8s-slave1192.168.1.148 | SUCCESS | rc=0 >>bboysoul-k8s-slave2192.168.1.156 | SUCCESS | rc=0 >>bboysoul-k8s-slave3可能你觉得ansible执行某些命令会很慢,所以你可以加上-f来fork出多个子进程来执行,但是要值得注意的是如果你执行的是一些简单的命令就不要加了,因为fork进程也是需要时间的
ansible中的模块
ansible中有很多模块
我们可以使用
ansible-doc -l
来查看ansible中包含的一些模块
当然我们可以这样去搜索模块
ansible-doc -l |grep copy
asnible-doc这个命令是用来获取各个模块的帮助信息的,比如我要查看copy模块的帮助信息
ansible-doc -s copy
ansible的一些常用模块
- copy
这个模块就是用来把本地的文件分发到远程主机上的,比如
首先我们先建立一个目录
ansible all -m shell -a "mkdir /root/bboysoul"
之后我们在本地下载一个小文件
wget http://mirrors.ustc.edu.cn/alpine/v3.8/releases/x86_64/alpine-standard-3.8.0_rc8-x86_64.iso
之后使用copy模块分发
[root@bboysoul-k8s-master ~]# time ansible all -m copy -a "src=/root/alpine-standard-3.8.0_rc8-x86_64.iso dest=/root/bboysoul/alpine.iso"192.168.1.139 | SUCCESS => { "changed": true, "checksum": "01bb2a8206073ecd789367405854765236456737", "dest": "/root/bboysoul/alpine.iso", "gid": 0, "group": "root", "md5sum": "640c9ccc23034a8a3237f5ca920cf339", "mode": "0644", "owner": "root", "secontext": "system_u: _r:admin_home_t:s0", "size": 109051904, "src": "/root/.ansible/tmp/ansible-tmp-1531285839.13-230038764878103/source", "state": "file", "uid": 0}192.168.1.151 | SUCCESS => { "changed": true, "checksum": "01bb2a8206073ecd789367405854765236456737", "dest": "/root/bboysoul/alpine.iso", "gid": 0, "group": "root", "md5sum": "640c9ccc23034a8a3237f5ca920cf339", "mode": "0644", "owner": "root", "secontext": "system_u: _r:admin_home_t:s0", "size": 109051904, "src": "/root/.ansible/tmp/ansible-tmp-1531285839.14-272099530710321/source", "state": "file", "uid": 0}192.168.1.156 | SUCCESS => { "changed": true, "checksum": "01bb2a8206073ecd789367405854765236456737", "dest": "/root/bboysoul/alpine.iso", "gid": 0, "group": "root", "md5sum": "640c9ccc23034a8a3237f5ca920cf339", "mode": "0644", "owner": "root", "secontext": "system_u: _r:admin_home_t:s0", "size": 109051904, "src": "/root/.ansible/tmp/ansible-tmp-1531285839.14-236085238208838/source", "state": "file", "uid": 0}192.168.1.148 | SUCCESS => { "changed": true, "checksum": "01bb2a8206073ecd789367405854765236456737", "dest": "/root/bboysoul/alpine.iso", "gid": 0, "group": "root", "md5sum": "640c9ccc23034a8a3237f5ca920cf339", "mode": "0644", "owner": "root", "secontext": "system_u: _r:admin_home_t:s0", "size": 109051904, "src": "/root/.ansible/tmp/ansible-tmp-1531285839.12-36460981766787/source", "state": "file", "uid": 0}real 0m17.358suser 0m1.401ssys 0m0.516s为了计算时间我使用了time命令
关于这个模块还要说的是,src= 路径后面带/ 表示带里面的所有内容复制到目标目录下,不带/是目录递归复制过去
- shell
这个不多解释了,就是执行shell命令的
- cron
这个模块是用来创建计划任务的
比如创建一个每1分钟ping一次百度的计划任务
之前是没有的
[root@bboysoul-k8s-master ~]# ansible all -m shell -a "crontab -l"192.168.1.151 | FAILED | rc=1 >>no crontab for rootnon-zero return code192.168.1.148 | FAILED | rc=1 >>no crontab for rootnon-zero return code192.168.1.156 | FAILED | rc=1 >>no crontab for rootnon-zero return code192.168.1.139 | FAILED | rc=1 >>no crontab for rootnon-zero return code创建任务
ansible all -m cron -a "minute=*/1 job='ping baidu.com' name=ping"
之后查看任务
[root@bboysoul-k8s-master ~]# ansible all -m shell -a "crontab -l"192.168.1.151 | SUCCESS | rc=0 >>#Ansible: ping*/1 * * * * ping baidu.com192.168.1.148 | SUCCESS | rc=0 >>#Ansible: ping*/1 * * * * ping baidu.com192.168.1.156 | SUCCESS | rc=0 >>#Ansible: ping*/1 * * * * ping baidu.com192.168.1.139 | SUCCESS | rc=0 >>#Ansible: ping*/1 * * * * ping baidu.com这个就是把本地的脚本上传到远端去执行
首先新建一个脚本
[root@bboysoul-k8s-master ~]# cat test.sh#!/bin/bashecho "ansible test ok"之后使用这个模块执行
ansible all -m -a "./test.sh"
关于模块的总结
说真的模块太多了,不可能每个都知道都会使用的,如果你不会那么
ansible-doc -s 模块名
关于playbook
前面废话说完了,下面进入正题playbook,如果说ansible的精髓是什么那就是playbook了
我们使用一个实例去入门这个playbook
就是使用playbook去安装nmap
首先新建一个文件
vim playbook.yml
之后写入
- hosts: all remote_user: root tasks: - name: install nmap yum: name=nmap state=latest - name: install vim yum: name=vim state=latest - name: install whois yum: name=whois state=latest - name: whois bboysoul shell: whois bboysoul.com检查一下语法
ansible-playbook --syntax-check playbook.yml
查看一下涉及到的主机
[root@bboysoul-k8s-master ~]# ansible-playbook --list-hosts playbook.yml playbook: playbook.yml play #1 (all): all TAGS: [] pattern: [u'all'] hosts (4): 192.168.1.139 192.168.1.151 192.168.1.148 192.168.1.156之后查看一下可能会发生的改变
ansible-playbook --check playbook.yml
[root@bboysoul-k8s-master ~]# ansible-playbook --check playbook.yml PLAY [all] ********************************************************************************************************************************************************************************************************TASK [Gathering Facts] ********************************************************************************************************************************************************************************************ok: [192.168.1.148]ok: [192.168.1.151]ok: [192.168.1.156]ok: [192.168.1.139]TASK [install nmap] ***********************************************************************************************************************************************************************************************changed: [192.168.1.156]changed: [192.168.1.151]changed: [192.168.1.148]changed: [192.168.1.139]TASK [install vim] ************************************************************************************************************************************************************************************************changed: [192.168.1.156]ok: [192.168.1.139]changed: [192.168.1.148]changed: [192.168.1.151]TASK [install whois] **********************************************************************************************************************************************************************************************changed: [192.168.1.156]changed: [192.168.1.148]changed: [192.168.1.151]changed: [192.168.1.139]TASK [whois bboysoul] *********************************************************************************************************************************************************************************************skipping: [192.168.1.156]skipping: [192.168.1.151]skipping: [192.168.1.148]skipping: [192.168.1.139]PLAY RECAP ********************************************************************************************************************************************************************************************************192.168.1.139 : ok=4 changed=2 unreachable=0 failed=0 192.168.1.148 : ok=4 changed=3 unreachable=0 failed=0 192.168.1.151 : ok=4 changed=3 unreachable=0 failed=0 192.168.1.156 : ok=4 changed=3 unreachable=0 failed=0 注意,这个时候其实命令是没有被执行的,只是检查一下命令是不是正确而已
最后执行
[root@bboysoul-k8s-master ~]# ansible-playbook playbook.yml PLAY [all] ********************************************************************************************************************************************************************************************************TASK [Gathering Facts] ********************************************************************************************************************************************************************************************ok: [192.168.1.156]ok: [192.168.1.148]ok: [192.168.1.151]ok: [192.168.1.139]TASK [install nmap] ***********************************************************************************************************************************************************************************************changed: [192.168.1.156]changed: [192.168.1.151]changed: [192.168.1.148]changed: [192.168.1.139]TASK [install vim] ************************************************************************************************************************************************************************************************changed: [192.168.1.156]ok: [192.168.1.139]changed: [192.168.1.151]changed: [192.168.1.148]TASK [install whois] **********************************************************************************************************************************************************************************************changed: [192.168.1.156]changed: [192.168.1.148]changed: [192.168.1.151]changed: [192.168.1.139]TASK [whois bboysoul] *********************************************************************************************************************************************************************************************fatal: [192.168.1.151]: FAILED! => {"changed": true, "cmd": "whois bboysoul.com", "delta": "0:00:00.436371", "end": "2018-07-11 16:24:41.250469", "msg": "non-zero return code", "rc": 1, "start": "2018-07-11 16:24:40.814098", "stderr": "", "stderr_lines": [], "stdout": " Domain Name: BBOYSOUL.COM
Registry Domain ID: 2154086731_DOMAIN_COM-VRSN
Registrar WHOIS Server: grs-whois.hichina.com
Registrar URL: http://www.net.cn
Updated Date: 2018-04-24T01:30:46Z
Creation Date: 2017-08-16T18:06:53Z
Registry Expiry Date: 2018-08-16T18:06:53Z
Registrar: HiChina Zhicheng Technology Ltd.
Registrar IANA ID: 420
Registrar Abuse Contact Email: DomainAbuse@service.aliyun.com
Registrar Abuse Contact Phone: +86.95187
Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited
Name Server: DNS17.HICHINA.COM
Name Server: DNS18.HICHINA.COM
DNSSEC: unsigned
URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/
>>> Last update of whois data : 2018-07-11T08:24:27Z <<<
For more information on Whois status codes, please visit https://icann.org/epp
NOTICE: The expiration date displayed in this record is the date the
registrar's sponsorship of the domain name registration in the registry is
currently set to expire. This date does not necessarily reflect the expiration
date of the domain name registrant's agreement with the sponsoring
registrar. Users may consult the sponsoring registrar's Whois data to
view the registrar's reported date of expiration for this registration.
TERMS OF USE: You are not authorized to access or query our Whois
data through the use of electronic processes that are high-volume and
automated except as reasonably necessary to register domain names or
modify existing registrations; the Data in VeriSign Global Registry
Services' ("VeriSign") Whois data is provided by VeriSign for
information purposes only, and to assist persons in obtaining information
about or related to a domain name registration record. VeriSign does not
guarantee its accuracy. By submitting a Whois query, you agree to abide
by the following terms of use: You agree that you may use this Data only
for lawful purposes and that under no circumstances will you use this Data
to: (1) allow, enable, or otherwise support the transmission of mass
unsolicited, commercial advertising or solicitations via e-mail, telephone,
or facsimile; or (2) enable high volume, automated, electronic processes
that apply to VeriSign (or its computer systems). The compilation,
repackaging, dissemination or other use of this Data is expressly
prohibited without the prior written consent of VeriSign. You agree not to
use electronic processes that are automated and high-volume to access or
query the Whois data except as reasonably necessary to register
domain names or modify existing registrations. VeriSign reserves the right
to restrict your access to the Whois data in its sole discretion to ensure
operational stability. VeriSign may restrict or terminate your access to the
Whois data for failure to abide by these terms of use. VeriSign
reserves the right to modify these terms at any time.
The Registry data contains ONLY .COM, .NET, .EDU domains and
Registrars.", "stdout_lines": [" Domain Name: BBOYSOUL.COM", " Registry Domain ID: 2154086731_DOMAIN_COM-VRSN", " Registrar WHOIS Server: grs-whois.hichina.com", " Registrar URL: http://www.net.cn", " Updated Date: 2018-04-24T01:30:46Z", " Creation Date: 2017-08-16T18:06:53Z", " Registry Expiry Date: 2018-08-16T18:06:53Z", " Registrar: HiChina Zhicheng Technology Ltd.", " Registrar IANA ID: 420", " Registrar Abuse Contact Email: DomainAbuse@service.aliyun.com", " Registrar Abuse Contact Phone: +86.95187", " Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited", " Name Server: DNS17.HICHINA.COM", " Name Server: DNS18.HICHINA.COM", " DNSSEC: unsigned", " URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/", ">>> Last update of whois data : 2018-07-11T08:24:27Z <<<", "", "For more information on Whois status codes, please visit https://icann.org/epp", "", "NOTICE: The expiration date displayed in this record is the date the", "registrar's sponsorship of the domain name registration in the registry is", "currently set to expire. This date does not necessarily reflect the expiration", "date of the domain name registrant's agreement with the sponsoring", "registrar. Users may consult the sponsoring registrar's Whois data to", "view the registrar's reported date of expiration for this registration.", "", "TERMS OF USE: You are not authorized to access or query our Whois", "data through the use of electronic processes that are high-volume and", "automated except as reasonably necessary to register domain names or", "modify existing registrations; the Data in VeriSign Global Registry", "Services' ("VeriSign") Whois data is provided by VeriSign for", "information purposes only, and to assist persons in obtaining information", "about or related to a domain name registration record. VeriSign does not", "guarantee its accuracy. By submitting a Whois query, you agree to abide", "by the following terms of use: You agree that you may use this Data only", "for lawful purposes and that under no circumstances will you use this Data", "to: (1) allow, enable, or otherwise support the transmission of mass", "unsolicited, commercial advertising or solicitations via e-mail, telephone,", "or facsimile; or (2) enable high volume, automated, electronic processes", "that apply to VeriSign (or its computer systems). The compilation,", "repackaging, dissemination or other use of this Data is expressly", "prohibited without the prior written consent of VeriSign. You agree not to", "use electronic processes that are automated and high-volume to access or", "query the Whois data except as reasonably necessary to register", "domain names or modify existing registrations. VeriSign reserves the right", "to restrict your access to the Whois data in its sole discretion to ensure", "operational stability. VeriSign may restrict or terminate your access to the", "Whois data for failure to abide by these terms of use. VeriSign", "reserves the right to modify these terms at any time.", "", "The Registry data contains ONLY .COM, .NET, .EDU domains and", "Registrars."]}fatal: [192.168.1.156]: FAILED! => {"changed": true, "cmd": "whois bboysoul.com", "delta": "0:00:00.695995", "end": "2018-07-11 16:24:41.399184", "msg": "non-zero return code", "rc": 1, "start": "2018-07-11 16:24:40.703189", "stderr": "", "stderr_lines": [], "stdout": " Domain Name: BBOYSOUL.COM
Registry Domain ID: 2154086731_DOMAIN_COM-VRSN
Registrar WHOIS Server: grs-whois.hichina.com
Registrar URL: http://www.net.cn
Updated Date: 2018-04-24T01:30:46Z
Creation Date: 2017-08-16T18:06:53Z
Registry Expiry Date: 2018-08-16T18:06:53Z
Registrar: HiChina Zhicheng Technology Ltd.
Registrar IANA ID: 420
Registrar Abuse Contact Email: DomainAbuse@service.aliyun.com
Registrar Abuse Contact Phone: +86.95187
Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited
Name Server: DNS17.HICHINA.COM
Name Server: DNS18.HICHINA.COM
DNSSEC: unsigned
URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/
>>> Last update of whois data : 2018-07-11T08:24:27Z <<<
For more information on Whois status codes, please visit https://icann.org/epp
NOTICE: The expiration date displayed in this record is the date the
registrar's sponsorship of the domain name registration in the registry is
currently set to expire. This date does not necessarily reflect the expiration
date of the domain name registrant's agreement with the sponsoring
registrar. Users may consult the sponsoring registrar's Whois data to
view the registrar's reported date of expiration for this registration.
TERMS OF USE: You are not authorized to access or query our Whois
data through the use of electronic processes that are high-volume and
automated except as reasonably necessary to register domain names or
modify existing registrations; the Data in VeriSign Global Registry
Services' ("VeriSign") Whois data is provided by VeriSign for
information purposes only, and to assist persons in obtaining information
about or related to a domain name registration record. VeriSign does not
guarantee its accuracy. By submitting a Whois query, you agree to abide
by the following terms of use: You agree that you may use this Data only
for lawful purposes and that under no circumstances will you use this Data
to: (1) allow, enable, or otherwise support the transmission of mass
unsolicited, commercial advertising or solicitations via e-mail, telephone,
or facsimile; or (2) enable high volume, automated, electronic processes
that apply to VeriSign (or its computer systems). The compilation,
repackaging, dissemination or other use of this Data is expressly
prohibited without the prior written consent of VeriSign. You agree not to
use electronic processes that are automated and high-volume to access or
query the Whois data except as reasonably necessary to register
domain names or modify existing registrations. VeriSign reserves the right
to restrict your access to the Whois data in its sole discretion to ensure
operational stability. VeriSign may restrict or terminate your access to the
Whois data for failure to abide by these terms of use. VeriSign
reserves the right to modify these terms at any time.
The Registry data contains ONLY .COM, .NET, .EDU domains and
Registrars.", "stdout_lines": [" Domain Name: BBOYSOUL.COM", " Registry Domain ID: 2154086731_DOMAIN_COM-VRSN", " Registrar WHOIS Server: grs-whois.hichina.com", " Registrar URL: http://www.net.cn", " Updated Date: 2018-04-24T01:30:46Z", " Creation Date: 2017-08-16T18:06:53Z", " Registry Expiry Date: 2018-08-16T18:06:53Z", " Registrar: HiChina Zhicheng Technology Ltd.", " Registrar IANA ID: 420", " Registrar Abuse Contact Email: DomainAbuse@service.aliyun.com", " Registrar Abuse Contact Phone: +86.95187", " Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited", " Name Server: DNS17.HICHINA.COM", " Name Server: DNS18.HICHINA.COM", " DNSSEC: unsigned", " URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/", ">>> Last update of whois data : 2018-07-11T08:24:27Z <<<", "", "For more information on Whois status codes, please visit https://icann.org/epp", "", "NOTICE: The expiration date displayed in this record is the date the", "registrar's sponsorship of the domain name registration in the registry is", "currently set to expire. This date does not necessarily reflect the expiration", "date of the domain name registrant's agreement with the sponsoring", "registrar. Users may consult the sponsoring registrar's Whois data to", "view the registrar's reported date of expiration for this registration.", "", "TERMS OF USE: You are not authorized to access or query our Whois", "data through the use of electronic processes that are high-volume and", "automated except as reasonably necessary to register domain names or", "modify existing registrations; the Data in VeriSign Global Registry", "Services' ("VeriSign") Whois data is provided by VeriSign for", "information purposes only, and to assist persons in obtaining information", "about or related to a domain name registration record. VeriSign does not", "guarantee its accuracy. By submitting a Whois query, you agree to abide", "by the following terms of use: You agree that you may use this Data only", "for lawful purposes and that under no circumstances will you use this Data", "to: (1) allow, enable, or otherwise support the transmission of mass", "unsolicited, commercial advertising or solicitations via e-mail, telephone,", "or facsimile; or (2) enable high volume, automated, electronic processes", "that apply to VeriSign (or its computer systems). The compilation,", "repackaging, dissemination or other use of this Data is expressly", "prohibited without the prior written consent of VeriSign. You agree not to", "use electronic processes that are automated and high-volume to access or", "query the Whois data except as reasonably necessary to register", "domain names or modify existing registrations. VeriSign reserves the right", "to restrict your access to the Whois data in its sole discretion to ensure", "operational stability. VeriSign may restrict or terminate your access to the", "Whois data for failure to abide by these terms of use. VeriSign", "reserves the right to modify these terms at any time.", "", "The Registry data contains ONLY .COM, .NET, .EDU domains and", "Registrars."]}fatal: [192.168.1.148]: FAILED! => {"changed": true, "cmd": "whois bboysoul.com", "delta": "0:00:00.691615", "end": "2018-07-11 16:24:41.729534", "msg": "non-zero return code", "rc": 1, "start": "2018-07-11 16:24:41.037919", "stderr": "", "stderr_lines": [], "stdout": " Domain Name: BBOYSOUL.COM
Registry Domain ID: 2154086731_DOMAIN_COM-VRSN
Registrar WHOIS Server: grs-whois.hichina.com
Registrar URL: http://www.net.cn
Updated Date: 2018-04-24T01:30:46Z
Creation Date: 2017-08-16T18:06:53Z
Registry Expiry Date: 2018-08-16T18:06:53Z
Registrar: HiChina Zhicheng Technology Ltd.
Registrar IANA ID: 420
Registrar Abuse Contact Email: DomainAbuse@service.aliyun.com
Registrar Abuse Contact Phone: +86.95187
Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited
Name Server: DNS17.HICHINA.COM
Name Server: DNS18.HICHINA.COM
DNSSEC: unsigned
URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/
>>> Last update of whois data : 2018-07-11T08:24:27Z <<<
For more information on Whois status codes, please visit https://icann.org/epp
NOTICE: The expiration date displayed in this record is the date the
registrar's sponsorship of the domain name registration in the registry is
currently set to expire. This date does not necessarily reflect the expiration
date of the domain name registrant's agreement with the sponsoring
registrar. Users may consult the sponsoring registrar's Whois data to
view the registrar's reported date of expiration for this registration.
TERMS OF USE: You are not authorized to access or query our Whois
data through the use of electronic processes that are high-volume and
automated except as reasonably necessary to register domain names or
modify existing registrations; the Data in VeriSign Global Registry
Services' ("VeriSign") Whois data is provided by VeriSign for
information purposes only, and to assist persons in obtaining information
about or related to a domain name registration record. VeriSign does not
guarantee its accuracy. By submitting a Whois query, you agree to abide
by the following terms of use: You agree that you may use this Data only
for lawful purposes and that under no circumstances will you use this Data
to: (1) allow, enable, or otherwise support the transmission of mass
unsolicited, commercial advertising or solicitations via e-mail, telephone,
or facsimile; or (2) enable high volume, automated, electronic processes
that apply to VeriSign (or its computer systems). The compilation,
repackaging, dissemination or other use of this Data is expressly
prohibited without the prior written consent of VeriSign. You agree not to
use electronic processes that are automated and high-volume to access or
query the Whois data except as reasonably necessary to register
domain names or modify existing registrations. VeriSign reserves the right
to restrict your access to the Whois data in its sole discretion to ensure
operational stability. VeriSign may restrict or terminate your access to the
Whois data for failure to abide by these terms of use. VeriSign
reserves the right to modify these terms at any time.
The Registry data contains ONLY .COM, .NET, .EDU domains and
Registrars.", "stdout_lines": [" Domain Name: BBOYSOUL.COM", " Registry Domain ID: 2154086731_DOMAIN_COM-VRSN", " Registrar WHOIS Server: grs-whois.hichina.com", " Registrar URL: http://www.net.cn", " Updated Date: 2018-04-24T01:30:46Z", " Creation Date: 2017-08-16T18:06:53Z", " Registry Expiry Date: 2018-08-16T18:06:53Z", " Registrar: HiChina Zhicheng Technology Ltd.", " Registrar IANA ID: 420", " Registrar Abuse Contact Email: DomainAbuse@service.aliyun.com", " Registrar Abuse Contact Phone: +86.95187", " Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited", " Name Server: DNS17.HICHINA.COM", " Name Server: DNS18.HICHINA.COM", " DNSSEC: unsigned", " URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/", ">>> Last update of whois data : 2018-07-11T08:24:27Z <<<", "", "For more information on Whois status codes, please visit https://icann.org/epp", "", "NOTICE: The expiration date displayed in this record is the date the", "registrar's sponsorship of the domain name registration in the registry is", "currently set to expire. This date does not necessarily reflect the expiration", "date of the domain name registrant's agreement with the sponsoring", "registrar. Users may consult the sponsoring registrar's Whois data to", "view the registrar's reported date of expiration for this registration.", "", "TERMS OF USE: You are not authorized to access or query our Whois", "data through the use of electronic processes that are high-volume and", "automated except as reasonably necessary to register domain names or", "modify existing registrations; the Data in VeriSign Global Registry", "Services' ("VeriSign") Whois data is provided by VeriSign for", "information purposes only, and to assist persons in obtaining information", "about or related to a domain name registration record. VeriSign does not", "guarantee its accuracy. By submitting a Whois query, you agree to abide", "by the following terms of use: You agree that you may use this Data only", "for lawful purposes and that under no circumstances will you use this Data", "to: (1) allow, enable, or otherwise support the transmission of mass", "unsolicited, commercial advertising or solicitations via e-mail, telephone,", "or facsimile; or (2) enable high volume, automated, electronic processes", "that apply to VeriSign (or its computer systems). The compilation,", "repackaging, dissemination or other use of this Data is expressly", "prohibited without the prior written consent of VeriSign. You agree not to", "use electronic processes that are automated and high-volume to access or", "query the Whois data except as reasonably necessary to register", "domain names or modify existing registrations. VeriSign reserves the right", "to restrict your access to the Whois data in its sole discretion to ensure", "operational stability. VeriSign may restrict or terminate your access to the", "Whois data for failure to abide by these terms of use. VeriSign", "reserves the right to modify these terms at any time.", "", "The Registry data contains ONLY .COM, .NET, .EDU domains and", "Registrars."]}fatal: [192.168.1.139]: FAILED! => {"changed": true, "cmd": "whois bboysoul.com", "delta": "0:00:01.107660", "end": "2018-07-11 16:24:41.693555", "msg": "non-zero return code", "rc": 1, "start": "2018-07-11 16:24:40.585895", "stderr": "", "stderr_lines": [], "stdout": " Domain Name: BBOYSOUL.COM
Registry Domain ID: 2154086731_DOMAIN_COM-VRSN
Registrar WHOIS Server: grs-whois.hichina.com
Registrar URL: http://www.net.cn
Updated Date: 2018-04-24T01:30:46Z
Creation Date: 2017-08-16T18:06:53Z
Registry Expiry Date: 2018-08-16T18:06:53Z
Registrar: HiChina Zhicheng Technology Ltd.
Registrar IANA ID: 420
Registrar Abuse Contact Email: DomainAbuse@service.aliyun.com
Registrar Abuse Contact Phone: +86.95187
Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited
Name Server: DNS17.HICHINA.COM
Name Server: DNS18.HICHINA.COM
DNSSEC: unsigned
URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/
>>> Last update of whois data : 2018-07-11T08:24:27Z <<<
For more information on Whois status codes, please visit https://icann.org/epp
NOTICE: The expiration date displayed in this record is the date the
registrar's sponsorship of the domain name registration in the registry is
currently set to expire. This date does not necessarily reflect the expiration
date of the domain name registrant's agreement with the sponsoring
registrar. Users may consult the sponsoring registrar's Whois data to
view the registrar's reported date of expiration for this registration.
TERMS OF USE: You are not authorized to access or query our Whois
data through the use of electronic processes that are high-volume and
automated except as reasonably necessary to register domain names or
modify existing registrations; the Data in VeriSign Global Registry
Services' ("VeriSign") Whois data is provided by VeriSign for
information purposes only, and to assist persons in obtaining information
about or related to a domain name registration record. VeriSign does not
guarantee its accuracy. By submitting a Whois query, you agree to abide
by the following terms of use: You agree that you may use this Data only
for lawful purposes and that under no circumstances will you use this Data
to: (1) allow, enable, or otherwise support the transmission of mass
unsolicited, commercial advertising or solicitations via e-mail, telephone,
or facsimile; or (2) enable high volume, automated, electronic processes
that apply to VeriSign (or its computer systems). The compilation,
repackaging, dissemination or other use of this Data is expressly
prohibited without the prior written consent of VeriSign. You agree not to
use electronic processes that are automated and high-volume to access or
query the Whois data except as reasonably necessary to register
domain names or modify existing registrations. VeriSign reserves the right
to restrict your access to the Whois data in its sole discretion to ensure
operational stability. VeriSign may restrict or terminate your access to the
Whois data for failure to abide by these terms of use. VeriSign
reserves the right to modify these terms at any time.
The Registry data contains ONLY .COM, .NET, .EDU domains and
Registrars.", "stdout_lines": [" Domain Name: BBOYSOUL.COM", " Registry Domain ID: 2154086731_DOMAIN_COM-VRSN", " Registrar WHOIS Server: grs-whois.hichina.com", " Registrar URL: http://www.net.cn", " Updated Date: 2018-04-24T01:30:46Z", " Creation Date: 2017-08-16T18:06:53Z", " Registry Expiry Date: 2018-08-16T18:06:53Z", " Registrar: HiChina Zhicheng Technology Ltd.", " Registrar IANA ID: 420", " Registrar Abuse Contact Email: DomainAbuse@service.aliyun.com", " Registrar Abuse Contact Phone: +86.95187", " Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited", " Name Server: DNS17.HICHINA.COM", " Name Server: DNS18.HICHINA.COM", " DNSSEC: unsigned", " URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/", ">>> Last update of whois data : 2018-07-11T08:24:27Z <<<", "", "For more information on Whois status codes, please visit https://icann.org/epp", "", "NOTICE: The expiration date displayed in this record is the date the", "registrar's sponsorship of the domain name registration in the registry is", "currently set to expire. This date does not necessarily reflect the expiration", "date of the domain name registrant's agreement with the sponsoring", "registrar. Users may consult the sponsoring registrar's Whois data to", "view the registrar's reported date of expiration for this registration.", "", "TERMS OF USE: You are not authorized to access or query our Whois", "data through the use of electronic processes that are high-volume and", "automated except as reasonably necessary to register domain names or", "modify existing registrations; the Data in VeriSign Global Registry", "Services' ("VeriSign") Whois data is provided by VeriSign for", "information purposes only, and to assist persons in obtaining information", "about or related to a domain name registration record. VeriSign does not", "guarantee its accuracy. By submitting a Whois query, you agree to abide", "by the following terms of use: You agree that you may use this Data only", "for lawful purposes and that under no circumstances will you use this Data", "to: (1) allow, enable, or otherwise support the transmission of mass", "unsolicited, commercial advertising or solicitations via e-mail, telephone,", "or facsimile; or (2) enable high volume, automated, electronic processes", "that apply to VeriSign (or its computer systems). The compilation,", "repackaging, dissemination or other use of this Data is expressly", "prohibited without the prior written consent of VeriSign. You agree not to", "use electronic processes that are automated and high-volume to access or", "query the Whois data except as reasonably necessary to register", "domain names or modify existing registrations. VeriSign reserves the right", "to restrict your access to the Whois data in its sole discretion to ensure", "operational stability. VeriSign may restrict or terminate your access to the", "Whois data for failure to abide by these terms of use. VeriSign", "reserves the right to modify these terms at any time.", "", "The Registry data contains ONLY .COM, .NET, .EDU domains and", "Registrars."]} to retry, use: --limit @/root/playbook.retryPLAY RECAP ********************************************************************************************************************************************************************************************************192.168.1.139 : ok=4 changed=2 unreachable=0 failed=1 192.168.1.148 : ok=4 changed=3 unreachable=0 failed=1 192.168.1.151 : ok=4 changed=3 unreachable=0 failed=1 192.168.1.156 : ok=4 changed=3 unreachable=0 failed=1 没错,你看到有一步是出错的,其实并没有出错,你可以看到whois信息还是出来的
关于playbook,详细的可以看文档
http://ansible-tran.readthedocs.io/en/latest/docs/playbooks_intro.html
说真的,有了ansible,妈妈再也不用担心我要在不同的主机上执行相同的命令,就连ddos也变得方便起来
欢迎关注Bboysoul的博客www.bboysoul.com
Have Fun
继续阅读与本文标签相同的文章
说说React组件的State
Redis Cluster(集群)的搭建
-
从零学习Spring MVC框架「环境搭建和MVC架构」
2026-06-02栏目: 教程
-
造芯”热 为何一定要造芯
2026-06-02栏目: 教程
-
你所不知道的 Typescript 与 Redux 类型优化
2026-06-02栏目: 教程
-
MSSQL · 最佳实践 · RDS SDK实现数据库迁移上阿里云RDS SQL Server
2026-06-02栏目: 教程
-
工业机器人市场持续增长 国产品牌堪忧
2026-06-02栏目: 教程
