查看“Playbook”的源代码
←
Playbook
跳到导航
跳到搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
=简单例子= 在线playbook分享平台:https://galaxy.ansible.com <pre> ansible tree ansible-nginx ansible-nginx ├── files │ └── nginx.conf.j2 └── playbook.yml 1 directory, 2 files ➜ ansible-nginx cat files/nginx.conf.j2 server { listen 80; root /tmp/; index index.html index.htm; server_name a.com; location / { default_type "text/html"; try_files $uri.html $uri $uri/ =404; } } ➜ ansible-nginx cat playbook.yml --- - hosts: d11 name: playbook demo become: yes gather_facts: false remote_user: root become_user: root tasks: - name: Update apt cache and install Nginx apt: name: nginx state: latest update_cache: yes - name: Apply Nginx template template: src: files/nginx.conf.j2 dest: /etc/nginx/sites-available/default notify: Restart Nginx - name: Enable new site file: src: /etc/nginx/sites-available/default dest: /etc/nginx/sites-enabled/default state: link notify: Restart Nginx - name: Allow all access to tcp port 80 ufw: rule: allow port: '80' proto: tcp handlers: - name: Restart Nginx service: name: nginx state: restarted ansible-playbook -C playbook.yml ansible-playbook playbook.yml </pre> =galaxy.ansible= 找几个例子看看 https://galaxy.ansible.com/andrewrothstein/java-oracle-jdk https://galaxy.ansible.com/sansible/golang =refer= [https://blog.51cto.com/u_13630803/2154192 Ansible之Playbook详解、案例] [https://www.jianshu.com/p/c41427cf5264 通过ansible安装中间件(jdk,nginx,mysql,etcd集群)] [https://juejin.cn/post/6844903631066513421 (playbook ins zbx还不错) ansible自动化运维详细教程及playbook详解 ] [https://blog.devgenius.io/how-to-install-nginx-using-ansible-playbook-48e2aa74f944?gi=19b433cc3a8d How to Install Nginx using Ansible Playbook] [[category:devops]][[category:ansible]]
返回至
Playbook
。
导航菜单
个人工具
登录
名字空间
页面
讨论
变种
视图
阅读
查看源代码
查看历史
更多
搜索
导航
首页
我的导航
关于我
shell
python
ops
linuxchina.net
blog.linuxchina
最近更改
随机页面
帮助
工具
链入页面
相关更改
特殊页面
页面信息