N46030-段鹏-第十二周作业

1、通过ansible Roles编排实现 httpd 角色的部署

1.创建角色相关目录
mkdir -pv /etc/ansible/roles/httpd/{tasks,handlers,files}
cd /etc/ansible/roles/httpd/
2.创建入口文件
vim tasks/main.yml
- include: group.yml
- include: user.yml
- include: install.yml
- include: config.yml
- include: index.yml
- include: service.yml
3.编写各模块yml文件
vim tasks/group.yml
- name: create apache group
  group: name=apache system=yes gid=80

vim tasks/user.yml
- name: create apache user
  user: name=apache system=yes shell=/sbin/nologin home=/var/www/ uid=80 group=apache

vim tasks/install.yml
- name: install apache
  yum: name=httpd

vim tasks/config.yml
- name: config file
  copy: src=httpd.conf dest=/etc/httpd/conf/ backup=yes
  notify: restart

vim tasks/index.html
- name: index.html
  copy: src=index.html dest=/var/www/html/

vim tasks/service.yml
- name: start service
  service: name=httpd state=started enabled=yes
4.编写handlers的主程序
vim handlers/main.yml
- name: restart
  service: name=httpd state=restarted
5.在files文件下准备模板文件httpd.conf和index.html
6.在playbook中调用角色
vim /etc/ansible/role_httpd.yml
---
- hosts: websrvs
  remote_user: root
  roles:
    - httpd
7.运行playbook
#ansible-playbook /etc/ansible/role_httpd.yml

2、简述 MySQL 数据库访问的执行过程。

 用户访问数据需要从数据库中取数据时,通过程序接口调用函数,访问数据库中数据,并格式化返回。

3、S E L E C T 语句的完整语法较复杂,但至少包括的部分是 (B )

A.仅 S E L E C T

B.S E L E C T ,F R O M

C.S E L E C T ,G R O U P

D.S E L E C T ,I N T O

4、一张表的主键个数为 ( C)

A.至多 3 个    B.没有限制

C.至多 1 个    D.至多 2 个

posted @ 2020-08-17 14:32  duanpeng123  阅读(77)  评论(0)    收藏  举报