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

溫馨提示×

溫馨提示×

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

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

ansible之role

發布時間:2020-07-02 01:52:38 來源:網絡 閱讀:446 作者:何去何從_ie 欄目:云計算

注意三臺都需要聯網
我的是80.100、80.101、80.102
我是在80.100上操作的其他兩臺只要開著就行了不需要操作

yum install -y epel-release  //安裝epel源
yum install ansible -y

ansible --version          //查看ansible版本

yum install tree -y

cd /etc/ansible
vi hosts       //配置主機清單
最后一行添加
[web]
192.168.80.10[1:2]

ansible all --list-hosts    顯示所有已定義的主機

ssh-keygen -t rsa
ssh-copy-id root@192.168.80.101
ssh-copy-id root@192.168.80.102

ansible all -a 'systemctl stop firewalld'

ansible all -a 'setenforce 0'

mkdir -p /opt/roles/nginx/{tasks,templates}

cd /opt/roles/nginx/tasks/

vi epel.yml
- name: copy epel
  copy: src=/etc/yum.repos.d/  dest=/etc/yum.repos.d/

vi user.yml
- name: create user
  user: name=nginx  group=nginx system=yes shell=/sbin/nologin

vi group.yml
- name: create group
  group: name=nginx  system=yes

vi yum.yml
- name: install package
  yum: name=nginx

vi start.yml
- name: start service
  service: name=nginx state=restarted  enabled=true

vi restart.yml
- name: restart service
  service: name=nginx state=restarted

cd ../templates/

yum install -y nginx

cp /etc/nginx/nginx.conf nginx.conf.j2

vi nginx.conf.j2
worker_processes {{ ansible_processor_vcpus }};

cd ../tasks/

vi temp.yml
- name: copy conf file
  template: src=nginx.conf.j2 dest=/etc/nginx/nginx.conf

vi main.yml
- include: epel.yml
- include: group.yml
- include: user.yml
- include: yum.yml
- include: temp.yml
- include: start.yml

cd /etc/ansible/

vi nginx_role.yml
- hosts: web
  remote_user: root
  roles:
   - role: nginx

tree roles/

mkdir -p /etc/ansible/group_vars/

touch /etc/ansible/group_vars/all

mkdir -p /etc/ansible/roles/common

mkdir -p /etc/ansible/roles/httpd/{files,templates,tasks,handlers,vars,defaults,meta}

mkdir -p /etc/ansible/roles/mysql/{files,templates,tasks,handlers,vars,defaults,meta}

mkdir -p /etc/ansible/roles/php/{files,templates,tasks,handlers,vars,defaults,meta}

touch /etc/ansible/roles/httpd/{defaults,vars,tasks,meta,handlers}/main.yml

touch /etc/ansible/roles/mysql/{defaults,vars,tasks,meta,handlers}/main.yml

touch /etc/ansible/roles/php/{defaults,vars,tasks,meta,handlers}/main.yml

vi /etc/ansible/site.yml
- hosts: web
  remote_user: root
  roles:
   - httpd
   - mysql

cd /opt/

vi nginx.yml
- hosts: web
  remote_user: root
  roles:
   - role: nginx

ansible web -a "rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm"

ansible-playbook nginx.yml 
向AI問一下細節

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

AI

体育| 沂南县| 江口县| 封丘县| 景泰县| 德兴市| 平昌县| 威远县| 岗巴县| 四会市| 汝阳县| 繁昌县| 黎川县| 文水县| 华宁县| 伽师县| 阳泉市| 苏州市| 湘潭县| 县级市| 木里| 同德县| 津南区| 灯塔市| 临海市| 洪泽县| 柳林县| 永宁县| 泽普县| 攀枝花市| 婺源县| 宣武区| 珠海市| 灵璧县| 靖宇县| 惠来县| 定远县| 酒泉市| 南平市| 库尔勒市| 凌源市|