91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

dhcp和ansible

發布時間:2020-04-24 19:39:20 來源:網絡 閱讀:195 作者:不會運維 欄目:系統運維

一、搭建DHCP服務,為局域網內用戶提供10.1.1.0/24網段的IP,且租約期默認為48小時
1.安裝軟件包:
yum install -y dhcp*
2.配置服務:

[root@localhost dhcp]# vim dhcpd.conf 
option domain-name "example.org";
option domain-name-servers ns1.example.org, ns2.example.org;
default-lease-time 172800;
max-lease-time 172800;
log-facility local7;
subnet 10.1.1.0 netmask 255.255.255.0 {
        range 10.1.1.100 10.1.1.200;

3.啟動服務并驗證:

systemctl start dhcp
dhclient -d

二、在上述實驗基礎上,實現DHCP中繼:

# 開啟路由轉發功能
vim /etc/sysctl.conf
net.ipv4.ip-forward=1
sysctl -p
# 啟動dhcp中繼服務
dhcrelay dhcp_server_ip

中繼服務實際使用中,基本沒有必要使用。其他網絡的主機另外新建一個dhcp服務就好,沒有必要非得使用中繼

三、借助Ansible Playbook自動化搭建LNMP環境(可借助yum)
1.實驗主機:

ansible主機:172.20.10.6
webservers:172.20.10.3
appservers:172.20.10.4

2.ansible主機免密鑰認證
(1)

[root@localhost playbooks]# ssh-keygen  
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:LFUqZ3zNLyVoJzwgIo+LzGwHhd2YCnKh7kOl6IZQcZ4 root@localhost
The key's randomart image is:
+---[RSA 2048]----+
|  *o* . . .      |
|ooo@ + o = +     |
|+o+.E . * B = .  |
|*++.   * o + +   |
|=B..  . S   . .  |
|B .    .     .   |
|.=               |
|. .              |
|                 |
+----[SHA256]-----+

(2)

[root@localhost] ssh-copy-id 172.20.10.3
[root@localhost]# ssh-copy-id 172.20.10.4

3.ansible配置文件

[webservers]
172.20.10.3
[appservers]
172.20.10.4

4.定義playbook劇本:

[root@localhost playbooks]# vim lnmp.yml 
---
- hosts: webservers
  remote_user: root

  tasks:
    - name: install nginx
      yum:  name=nginx
    - name: config
      copy: src=/data/nginx.conf  dest=/etc/nginx/nginx.conf
      tags: conf
      notify: restart nginx
    - name: start nginx
      service: name=nginx state=started enabled=yes

  handlers:
    - name: restart nginx  
      service: name=nginx state=restarted

- hosts: appservers 
  remote_user: root

  tasks:
    - name: install services 
      yum: name={{ item }} 
      with_items:
        - mariadb
        - mariadb-server
        - php
        - php-fpm 
        - php-mysql
    - name:  php-fpm  config
      copy: src=/data/www.conf  dest=/etc/php-fpm.d/www.conf
      notify: restart php-fpm
    - name: start php-fpm
      service: name=php-fpm state=started enabled=yes
    - name : start mysql
      service: name=mariadb  state=started enabled=yes
    - name : config mysql
      shell: mysqladmin -uroot password "centos"
    - name: config php-index-file
      copy: src=/data/index.php  dest=/var/www/html/
    - name: config php-mysql-file
      copy: src=/data/mysql.php  dest=/var/www/html/

  handlers:
    - name: restart php-fpm
      service: name=php-fpm state=restart

(5)執行結果:
dhcp和ansible
(6)測試:
dhcp和ansible
dhcp和ansible
四、采用Ansible Role方式自動化搭建LNMP
1.實驗主機:

ansible主機:172.20.10.6
webservers:172.20.10.3
appservers:172.20.10.4

2.ansible主機roles目錄:
dhcp和ansible
3.執行結果為:
dhcp和ansible
4.訪問測試為:
dhcp和ansible
dhcp和ansible

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

清徐县| 咸阳市| 松溪县| 墨脱县| 靖西县| 德保县| 张掖市| 内江市| 潞城市| 绥芬河市| 阳高县| 鹿邑县| 塔城市| 霸州市| 长寿区| 姚安县| 隆德县| 高雄县| 渭南市| 水城县| 遂平县| 凤凰县| 武城县| 富顺县| 黄山市| 双城市| 邢台县| 康定县| 治县。| 连云港市| 称多县| 浦县| 榆社县| 南溪县| 房产| 日照市| 伊通| 木兰县| 遂溪县| 县级市| 新巴尔虎右旗|