目录
目录结构、主机清单
【1】安装基础环境
【2】webserver - 安装nginx
【3】安装php环境
【4】lb-server
【5】redis安装
【6】 kodcloud
【7】wordpress-proxy 文章来源:https://www.toymoban.com/news/detail-514270.html
文章来源地址https://www.toymoban.com/news/detail-514270.html
ansible | 10.0.0.10 |
lb-server | 10.0.0.11 |
web01 | 10.0.0.15 |
web02 | 10.0.0.16 |
redis | 10.0.0.20 |
目录结构、主机清单
[root@ansible ~]# mkdir -p ansible/roles/
[root@ansible ~]# cd ansible/roles/
[root@ansible roles]# mkdir -p {nginx,php-fpm,redis}/{tasks,templates,handlers,file
[root@ansible roles]# mkdir -p basic/{tasks,templates,handlers,files}
[root@ansible roles]# mkdir group_vars
[root@ansible roles]# egrep "^[a-Z]" ansible.cfg
inventory = ./hosts
forks = 5
[root@ansible roles]# grep "^[^#]" hosts
[lb-server]
10.0.0.11
[webserver]
10.0.0.15
10.0.0.16
[redis]
10.0.0.20
【1】安装基础环境
[root@ansible roles]# cat basic/tasks/main.yml
- name: Install Nginx Repo
yum_repository:
name: ansible_nginx
description: ansible_nginx_repo
baseurl: http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck: no
gpgkey: https://nginx.org/keys/nginx_signing.key
when: ( ansible_hostname is match ("web*") or ansible_hostname is match ("lb*") )
- name: PHP Reop
yum_repository:
name: ansible_php
description: ansible_php_repo
baseurl: http://us-east.repo.webtatic.com/yum/el7/x86_64/
gpgcheck: no
when: ( ansible_hostname is match ("web*") )
- name: epel
yum:
name: epel-release.noarch
state: present
- name: Install Basices
yum:
name: "{
{ item }}"
state: present
loop:
- vim
- wget
- make
- automake
- lrzsz
- tree
- net-tools
- nfs-utils
- rsync
- ntpdate
- unzip
- zip
- name: Disabled Firewall
systemd:
name: firewalld
state: stopped
enabled: no
- name: Disabled Selinux
selinux:
state: disabled
- name: Create Group
group:
name: "{
{ group }}"
gid: "{
{ id }}"
- name: Create User
user:
name: "{
{ user }}"
uid: "{
{ id }}"
group: "{
到了这里,关于ansible - 安装 -【kodcloud教程】的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!