零基礎學習Puppet自動化配置管理系列文檔html
注意:本實驗是在離線狀況下安裝的,因此須要在本地建立本身的yum倉庫,建立方法可參考《如何根據版本製做屬於本身的puppet yum源》,如何你實在是比較懶或者搞不定rpm包之間的依賴關係,那就去個人github上下載吧:https://github.com/kisspuppet/foreman-repomysql
更多安裝細節請參考官網:http://theforeman.org/manuals/1.5/index.html#Releasenotesfor1.5.4linux
如下all-in-one安裝方式跟官方安裝的有所區別,官方安裝可能只須要一條命令就能夠安裝成功,在我測試下來發現會出現有時候成功,有時候不 成功的現象,因此改爲了如下方式安裝,並且每次都能成功,條例也比較清晰,爲後面拆分puppetmaster可以提供很好的幫助。git
puppet-server 3.6.2github
puppet 3.6.2sql
facter 2.0.2數據庫
mcollective 2.2.4apache
rabbitmq-server 3.2.4vim
foreman 1.5.3瀏覽器
foreman-proxy 1.5.4
系統版本:
[root@foreman02 yum.repos.d]# cat /etc/redhat-release Red Hat Enterprise Linux Server release 6.5 (Santiago)
網絡參數:
[root@foreman02 yum.repos.d]# ip addr 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:50:56:a6:5c:70 brd ff:ff:ff:ff:ff:ff inet 192.168.10.159/24 brd 192.168.10.255 scope global eth0 inet6 fe80::250:56ff:fea6:5c70/64 scope link valid_lft forever preferred_lft forever
主機名稱:
[root@foreman02 yum.repos.d]# hostname -f foreman02.kisspuppet.com [root@foreman02 yum.repos.d]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.10.159 foreman02.kisspuppet.com foreman02
平臺環境:
[root@foreman02 yum.repos.d]# uname -r 2.6.32-431.el6.x86_64
yum倉庫:
[root@foreman02 yum.repos.d]# cat foreman153.repo [foreman] name=Foreman baseurl=ftp://192.168.10.254/blog/foreman enabled=1 gpgcheck=0 [puppet] name=puppet baseurl=ftp://192.168.10.254/blog/puppet-el6 enabled=1 gpgcheck=0 [rhel] name=RHEL baseurl=ftp://192.168.10.254/rhel6.5 enabled=1 gpgcheck=0
網絡安全環境:
[root@foreman02 ~]# /etc/init.d/iptables status iptables: Firewall is not running. [root@foreman02 ~]# getenforce Disabled
3.一、安裝puppetmaster,並生成CA和證書
[root@foreman02 ~]# yum install foreman-installer [root@foreman02 ~]# yum install puppet-server puppet facter [root@foreman02 ~]# vim /etc/puppet/puppet.conf [master] certname = foreman02.kisspuppet.com [root@foreman02 ~]# /etc/init.d/puppetmaster start Starting puppetmaster: [ OK ] [root@foreman02 ~]# puppet cert --list --all + "foreman02.kisspuppet.com" (SHA256) 1D:7E:90:F5:16:7D:01:67:77:37:EE:31:3F:46:AD:0A:47:80:B6:DF:6A:5E:25:A8:DE:BA:78:45:C9:09:D6:BD (alt names: "DNS:foreman02.kisspuppet.com", "DNS:puppet", "DNS:puppet.kisspuppet.com") [root@foreman02 ~]# /etc/init.d/puppetmaster stop Stopping puppetmaster: [ OK ]
3.二、安裝foreman及依賴包
[root@foreman02 ~]# yum install foreman mod_passenger mod_ssl ruby193-rubygem-passenger-native mysql mysql-server foreman-mysql2
3.三、經過foreman-installer安裝foreman
foreman默認安裝選擇的數據庫爲postgresql,這裏選用mysql進行安裝。
[root@foreman02 ~]# foreman-installer --foreman-db-adapter mysql2 --foreman-db-type mysql --no-enable-puppet --no-enable-foreman-proxy --foreman-configure-epel-repo=false Installing Done [100%] [...................] Success! * Foreman is running at https://foreman02.kisspuppet.com Default credentials are 'admin:changeme' The full log is at /var/log/foreman-installer/foreman-installer.log
安裝完成以後,經過火狐或者谷歌瀏覽器訪問看是否安裝成功https://192.168.10.159
3.四、安裝foreman-proxy及依賴包
[root@foreman02 ~]# yum install tftp-server syslinux foreman-proxy
3.五、安裝foreman-proxy,並經過foreman-installer從新安裝foreman和puppetmaster
注意:如下方式是安裝後會代理TFTP, DNS, DHCP, Puppet, and Puppet CA,而且puppetmaster會以apache+passenger的方式安裝運行。
[root@foreman02 ~]# foreman-installer --enable-foreman --enable-foreman-proxy --enable-puppet --puppet-server=true --foreman-proxy-puppetrun=true --foreman-proxy-puppetca=true --foreman-proxy-dhcp=true --foreman-proxy-tftp=true --foreman-proxy-dns=true --foreman-proxy-dns-interface=eth0 --foreman-proxy-dns-zone=kisspuppet.com --foreman-proxy-dns-reverse=10.168.192.in-addr.arpa --foreman-proxy-dns-forwarders=8.8.8.8 --foreman-proxy-dns-forwarders=8.8.4.4 --foreman-configure-epel-repo=false --foreman-proxy-register-in-foreman=false Installing Done [100%] [...................] Success! * Foreman is running at https://foreman02.kisspuppet.com Default credentials are 'admin:changeme' * Foreman Proxy is running at https://foreman02.kisspuppet.com:8443 * Puppetmaster is running at port 8140 The full log is at /var/log/foreman-installer/foreman-installer.log
若是隻代理puppet和puppetCA,能夠經過如下方式安裝
[root@foreman02 ~]# foreman-installer --enable-foreman --enable-foreman-proxy --enable-puppet --puppet-server=true --foreman-proxy-puppetrun=true --foreman-proxy-puppetca=true --foreman-configure-epel-repo=false --foreman-proxy-register-in-foreman=false
[root@foreman02 ~]# /etc/init.d/httpd status httpd (pid 25433) is running... [root@foreman02 ~]# /etc/init.d/foreman-proxy status foreman-proxy (pid 25605) is running... [root@foreman02 ~]# netstat -naltp | grep 8443 tcp 0 0 0.0.0.0:8443 0.0.0.0:* LISTEN 25605/ruby [root@foreman02 ~]# netstat -naltp | grep 80 tcp 0 0 :::80 :::* LISTEN 25433/httpd [root@foreman02 ~]# netstat -naltp | grep 8140 tcp 0 0 :::8140 :::* LISTEN 25433/httpd
若是要管理puppet、puppetca等軟件,是須要經過foreman-proxy去代理纔可以正常使用的,關於代理的開啓和關閉能夠修改它的配置文件/etc/foreman-proxy/settings.yml
關於如何設置和使用foreman,請關注後續文章....
@KissPuppet
2014年10月28號 上海
微信公衆號:puppet2014,可微信搜索加入,也能夠掃描如下二維碼進行加入
QQ交流羣:296934942