中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當前位置: 首頁 > news >正文

冠縣網(wǎng)站建設做百度推廣需要什么條件

冠縣網(wǎng)站建設,做百度推廣需要什么條件,jsp網(wǎng)站開發(fā)的mvc,如何做鏡框 網(wǎng)站自動化運維 ansible----自動化運維工具 特點: 部署簡單,使用ssh管理 管理端與被管理端不需要啟動服務 配置簡單、功能強大,擴展性強 一、ansible環(huán)境搭建 準備四臺機器 安裝步驟 mo服務器: #下載epel [rootmo ~]# yum -y i…

自動化運維

ansible----自動化運維工具

特點:

部署簡單,使用ssh管理

管理端與被管理端不需要啟動服務

配置簡單、功能強大,擴展性強

一、ansible環(huán)境搭建

準備四臺機器

安裝步驟

mo服務器:

#下載epel
[root@mo ~]# yum -y install epel-release.noarch?
#安裝ansible
[root@mo ~]# yum -y install ansible
#查看ansible版本
[root@mo ~]# ansible --version

進行免密登錄

[root@mo ~]# ssh-copy-id -i 192.168.1.25
[root@mo ~]# ssh-copy-id -i 192.168.1.26

編輯配置文件

[root@mo ~]# vim /etc/ansible/hosts?
[group01]
192.168.1.25
192.168.1.26

[group02]
192.168.1.25
192.168.1.26
192.168.1.27

測試連接性

[root@mo ~]# ?ansible 192.168.1.25 -m ping
192.168.1.25 | SUCCESS => {
? ? "ansible_facts": {
? ? ? ? "discovered_interpreter_python": "/usr/bin/python"
? ? },?
? ? "changed": false,?
? ? "ping": "pong"
}

設置別名分組

[root@mo ~]# vim /etc/ansible/hosts?
[group01]
192.168.1.25
192.168.1.26

other ansible_ssh_host=192.168.1.27 ansible_ssh_port=22 ansible_ssh_user=root ansible_ssh_pass=1

[group02]
192.168.1.25
192.168.1.26
other

再次測試連通性

group01:

[root@mo ~]# ?ansible group01 -m ping
192.168.1.26 | SUCCESS => {
? ? "ansible_facts": {
? ? ? ? "discovered_interpreter_python": "/usr/bin/python"
? ? },?
? ? "changed": false,?
? ? "ping": "pong"
}
192.168.1.25 | SUCCESS => {
? ? "ansible_facts": {
? ? ? ? "discovered_interpreter_python": "/usr/bin/python"
? ? },?
? ? "changed": false,?
? ? "ping": "pong"
}
other | SUCCESS => {
? ? "ansible_facts": {
? ? ? ? "discovered_interpreter_python": "/usr/bin/python"
? ? },?
? ? "changed": false,?
? ? "ping": "pong"
}

group02:


[root@mo ~]# ansible group02 -m ping
192.168.1.26 | SUCCESS => {
? ? "ansible_facts": {
? ? ? ? "discovered_interpreter_python": "/usr/bin/python"
? ? },?
? ? "changed": false,?
? ? "ping": "pong"
}
192.168.1.25 | SUCCESS => {
? ? "ansible_facts": {
? ? ? ? "discovered_interpreter_python": "/usr/bin/python"
? ? },?
? ? "changed": false,?
? ? "ping": "pong"
}
other | SUCCESS => {
? ? "ansible_facts": {
? ? ? ? "discovered_interpreter_python": "/usr/bin/python"
? ? },?
? ? "changed": false,?
? ? "ping": "pong"
}

other:

[root@mo ~]# ansible other -m ping
other | SUCCESS => {
? ? "ansible_facts": {
? ? ? ? "discovered_interpreter_python": "/usr/bin/python"
? ? },?
? ? "changed": false,?
? ? "ping": "pong"
}

更改group02的名字

[root@mo ~]# ansible group02 -m hostname -a 'name=dd'

二、file模塊

file模塊?于對?件相關(guān)的操作(創(chuàng)建, 刪除, 軟硬鏈接等)

1.創(chuàng)建目錄

[root@mo ~]# ansible group01 -m file -a 'path=/tmp/abc state=directory'

查看

2.創(chuàng)建文件

[root@mo ~]# ansible group02 -m file -a 'path=/tmp/abc/def state=touch'

查看

3.遞歸修改

[root@mo ~]# ansible group02 -m file -a 'path=/tmp/abc recurse=yes owner=bin group=daemon mode=1777'

查看

[root@s0 ~]# ll /tmp/abc/

總用量 0-rwxrwxrwt 1 bin daemon 0 8月 16 14:08 def

4.修改文件

[root@mo ~]# ansible group02 -m file -a 'path=/tmp/abc state=absent'

[root@mo ~]# ansible group02 -m file -a 'path=/tmp/aaaa state=touch owner=bin group=de=1777'

查看

[root@s0 ~]# ls -l /tmp/

總用量 0-rwxrwxrwt 1 bin daemon 0 8月 16 14:21 aaaa

5.刪除文件

[root@mo ~]# ansible group02 -m file -a 'path=/tmp/aaaa state=absent'

6.創(chuàng)建鏈接文件

創(chuàng)建軟連接

[root@mo ~]# ansible group02 -m file -a 'src=/etc/fstab path=/tmp/xxx state=link'

創(chuàng)建硬鏈接

[root@mo ~]# ansible group02 -m file -a 'src=/etc/fstab path=/tmp/xxx2 state=hard'

查看

[root@s0 ~]# ll /tmp/

lrwxrwxrwx 1 root root 10 8月 16 14:31 xxx -> /etc/fstab

-rw-r--r--. 2 root root 502 5月 25 18:31 xxx2

7.獲取文件統(tǒng)計信息

[root@mo ~]# ansible group02 -m stat -a 'path=/etc/fstab'

三、copy模塊

copy模塊?于對?件的遠程拷?操作(如把本地的?件拷?到遠程 的機器上)

使?content參數(shù)直接往遠程?件?寫內(nèi)容(會覆蓋原內(nèi)容)

使?force參數(shù)控制是否強制覆蓋

使?backup參數(shù)控制是否備份?件

copy模塊拷?時要注意拷??錄后?是否帶"/"符號

沒有"/"把表示拷貝目錄,有"/"表示拷貝目錄下的文件

用于遠程拷貝文件

給虛擬機傳mysql包

[root@mo ~]# rz -E
rz waiting to receive.

查看

[root@mo ~]# ls
anaconda-ks.cfg ?mysql-5.7.44-linux-glibc2.12-x86_64.tar.gz

改名

[root@mo ~]# mv mysql-5.7.44-linux-glibc2.12-x86_64.tar.gz mysql57.tar.gz

復制

將當前目錄下的mysql57.tar.gz文件復制到group02組內(nèi)所有機器的用戶主目錄中?

[root@mo ~]# ansible group02 -m copy -a 'src=./mysql57.tar.gz dest=~'


查看

[root@s0 ~]# ls -lh
總用量 663M
-rw-------. 1 root root 1.4K 5月 ?25 16:47 anaconda-ks.cfg
-rw-r--r-- ?1 root root 663M 8月 ?16 15:07 mysql57.tar.gz

[root@s1 ~]# ls -lh
總用量 663M
-rw-------. 1 root root 1.4K 5月 ?25 16:47 anaconda-ks.cfg
-rw-r--r-- ?1 root root 663M 8月 ?16 15:07 mysql57.tar.gz

[root@s2 ~]# ls -lh
總用量 663M
-rw-------. 1 root root 1.4K 5月 ?25 16:47 anaconda-ks.cfg
-rw-r--r-- ?1 root root 663M 8月 ?16 15:07 mysql57.tar.gz

寫入內(nèi)容

[root@mo ~]# ansible group02 -m copy -a 'content="wo shi dd chao ji wu di yu zhou bao long zhan shen" dest=~/tst'

查看

[root@s0 ~]# ls
anaconda-ks.cfg ?mysql57.tar.gz ?tst
[root@s0 ~]# cat tst
wo shi dd chao ji wu di yu zhou bao long zhan shen
?

四、user模塊

user模塊?于管理?戶賬號和?戶屬性。

創(chuàng)建aaa?戶,默認為普通?戶,創(chuàng)建家?錄

ansible group1 -m user -a ‘name=aaa state=present’

創(chuàng)建bbb系統(tǒng)?戶,并且登錄shell環(huán)境為/sbin/nologin

ansible group1 -m user -a ‘name=bbb state=present system=yes shell="/sbin/nologin"’

創(chuàng)建ccc?戶, 使?uid參數(shù)指定uid, 使?password參數(shù)傳密碼

echo 123456 | openssl passwd -1 -stdin

$1$DpcyhW2G$Kb/y1f.lyLI4MpRlHU9oq0

下?句命令注意?下格式,密碼要?雙引號引起來,單引號的話驗證時會密碼不正確

ansible group1 -m user -a 'name=ccc uid=2000 state=present password="$1$DpcyhW2G$Kb/y1f.lyLI4MpRlHU9oq0"'

創(chuàng)建?個普通?戶叫hadoop,并產(chǎn)?空密碼密鑰對

ansible group1 -m user -a 'name=hadoop generate_ssh_key=yes'

刪除aaa?戶,但家?錄默認沒有刪除

ansible group1 -m user -a 'name=aaa state=absent'

刪除bbb?戶,使?remove=yes參數(shù)讓其刪除?戶的同時也刪除家?錄

ansible group1 -m user -a 'name=bbb state=absent remove=yes'

五、group模塊

group模塊?于管理?戶組和?戶組屬性。

創(chuàng)建組

ansible group1 -m group -a 'name=groupa gid=3000 state=present'

刪除組(如果有?戶的gid為此組,則刪除不了)

ansible group1 -m group -a 'name=groupa state=absent'

六、cron模塊

cron模塊?于管理周期性時間任務。

創(chuàng)建?個cron任務,不指定user的話,默認就是root

如果minute,hour,day,month,week不指定的話,默認都為*

ansible group1 -m cron -a 'name="test cron1" user=root job="touch /tmp/111" minute=*/2'

刪除cron任務

ansible group1 -m cron -a 'name="test cron1" state=absent'

七、yum模塊

yum模塊?于使?yum命令來實現(xiàn)軟件包的安裝與卸載。

使?yum安裝?個軟件(前提:group1的機器上的yum配置都已經(jīng)OK)

ansible group1 -m yum -a 'name=vsftpd state=present'

使?yum安裝httpd,httpd-devel軟件,state=latest表示安裝最新版本

ansible group1 -m yum -a 'name=httpd,httpd-devel state=latest'

使?yum卸載httpd,httpd-devel軟件

ansible group1 -m yum -a 'name=httpd,httpddevel state=absent'

八、service模塊

service模塊?于控制服務的啟動,關(guān)閉,開機?啟動等。

啟動vsftpd服務,并設為開機?動啟動

ansible group1 -m service -a 'name=vsftpd state=started enabled=on'

關(guān)閉vsftpd服務,并設為開機不?動啟動

ansible group1 -m service -a 'name=vsftpd state=stopped enabled=false'

九、其他模塊

hostname模塊

hostname模塊?于修改主機名(注意: 它不能修改/etc/hosts?件)

stat模塊

stat模塊類似linux的stat命令,?于獲取?件的狀態(tài)信息。

template模塊

template模塊?先使?變量渲染jinja2模板?件成普通?件,然后再復制過去.?copy模塊不?持.(jinja2是?個基于python的模板引擎)

template模塊不能拷??錄

fetch模塊

fetch模塊與copy模塊類似,但作?相反。?于把遠程機器的?件拷?到本地。

注意: fetch模塊不能從遠程拷??錄到本地

yum_repository模塊

yum_repository模塊?于配置yum倉庫。

增加?個/etc/yum.repos.d/local.repo配置?件

ansible group1 -m yum_repository -a "name=local description=localyum baseurl=file:///mnt/ enabled=yes gpgcheck=no"

注意:此模塊只幫助配置yum倉庫,但如果倉庫?沒有軟件包,安裝? 樣會失敗。所以可以?動去掛載光驅(qū)到/mnt?錄

# mount /dev/cdrom /mnt

刪除/etc/yum.repos.d/local.repo配置?件

ansible group1 -m yum_repository -a "name=local state=absent"

script模塊

script模塊?于在遠程機器上執(zhí)?本地腳本。

在master上準備?個腳本

?vim /tmp/1.sh

#!/bin/bash

mkdir /tmp/haha touch /tmp/haha/{1..10}

在group1的遠程機器?都執(zhí)?master上的/tmp/1.sh腳本

(此腳本 不?給執(zhí)?權(quán)限)

ansible group1 -m script -a '/tmp/1.sh'

command與shell模塊

兩個模塊都是?于執(zhí)?linux命令的,這對于命令熟悉的?程師來說,?起來?常high。

shell模塊與command模塊差不多

(command模塊不能執(zhí)??些類似$HOME,>,等符號,但shell可以)

注意: shell模塊并不是百分之百任何命令都可以,?如vim或ll別名就不可以。

http://www.risenshineclean.com/news/3991.html

相關(guān)文章:

  • 深圳小企業(yè)網(wǎng)站建設設計制作seo 推廣服務
  • 長安網(wǎng)站建設百度官網(wǎng)首頁登錄入口
  • minify wordpressseo信息優(yōu)化
  • 廣州網(wǎng)站制作怎么選百度網(wǎng)站怎么做
  • 吉林沈陽網(wǎng)站建設手機網(wǎng)站模板建站
  • 不會代碼可以做網(wǎng)站維護嗎quark搜索引擎入口
  • 網(wǎng)站刷流量對網(wǎng)站有影響嗎推廣之家官網(wǎng)
  • 維護一個網(wǎng)站的費用美國疫情最新消息
  • 小學網(wǎng)站建設方案書seo網(wǎng)絡推廣怎么做
  • 網(wǎng)站的反鏈要怎么做百度首頁推薦關(guān)不掉嗎
  • 怎么把dw做的網(wǎng)站分享給別怎么投稿各大媒體網(wǎng)站
  • 閔行區(qū)網(wǎng)站建設深圳全網(wǎng)信息流推廣公司
  • 鄭州做網(wǎng)站的專業(yè)公司騰訊廣告聯(lián)盟
  • 網(wǎng)站對固定ip轉(zhuǎn)向怎么做整站優(yōu)化服務
  • 最好的微網(wǎng)站建設公司推薦滬深300指數(shù)基金
  • 站點的幾種推廣方式鄭州百度搜索優(yōu)化
  • 帝國cms做中英文網(wǎng)站網(wǎng)站設計需要什么
  • 上傳網(wǎng)站的軟件推廣平臺怎么做
  • 網(wǎng)站建設要代碼有什么好處推廣什么軟件可以長期賺錢
  • 網(wǎng)站設計需要考慮的基本原則化妝品軟文推廣范文
  • 北大青鳥教網(wǎng)站開發(fā)嗎百度企業(yè)推廣
  • 成都有哪些做公司網(wǎng)站的公司怎么寫軟文推廣
  • 合肥網(wǎng)站制作公司有哪些公司寧波seo企業(yè)網(wǎng)絡推廣
  • 我做網(wǎng)站了圓通淘寶的17種免費推廣方法
  • 裝修設計師培訓班百度快速排名優(yōu)化工具
  • 醫(yī)療網(wǎng)站備案要怎么做 需要準備什么材料seo優(yōu)化文章網(wǎng)站
  • 網(wǎng)盤做網(wǎng)站服務器網(wǎng)絡推廣營銷方案100例
  • 在線做視頻網(wǎng)站如何建立自己的網(wǎng)站
  • 網(wǎng)站做編輯賺錢seo系統(tǒng)是什么
  • 做優(yōu)秀網(wǎng)站seo待遇