buluma.apache
Ansible角色 apache
适用于Linux的Apache 2.x。
GitHub | 版本 | 问题 | 拉取请求 | 下载 |
---|---|---|---|---|
示例剧本
此示例取自 molecule/default/converge.yml
,并在每次推送、拉取请求和发布时进行了测试。
---
- name: Converge
hosts: all
become: true
vars:
apache_listen_port_ssl: 443
apache_create_vhosts: true
apache_vhosts_filename: "vhosts.conf"
apache_vhosts:
- servername: "example.com"
documentroot: "/var/www/vhosts/example_com"
pre_tasks:
- name: 更新apt缓存。
apt: update_cache=true cache_valid_time=600
when: ansible_os_family == 'Debian'
changed_when: false
roles:
- role: buluma.apache
需要准备机器。在CI中,使用 molecule/default/prepare.yml
来完成:
---
- name: Prepare
hosts: all
gather_facts: false
become: true
roles:
- role: buluma.bootstrap
另见 完整说明和示例 以了解如何使用这些角色。
角色变量
变量的默认值设置在 defaults/main.yml
中:
---
apache_enablerepo: ""
apache_listen_ip: "*"
apache_listen_port: 80
apache_listen_port_ssl: 443
apache_create_vhosts: true
apache_vhosts_filename: "vhosts.conf"
apache_vhosts_template: "vhosts.conf.j2"
# 在Debian/Ubuntu上,Apache的配置中包含默认虚拟主机。
# 将其设置为`true`以删除默认值。
apache_remove_default_vhost: false
apache_global_vhost_settings: |
DirectoryIndex index.php index.html
apache_vhosts:
# 其他属性:
# 'serveradmin, serveralias, allow_override, options, extra_parameters'。
- servername: "local.dev"
documentroot: "/var/www/html"
apache_allow_override: "All"
apache_options: "-Indexes +FollowSymLinks"
apache_vhosts_ssl: []
# 其他属性:
# 'serveradmin, serveralias, allow_override, options, extra_parameters'。
# - servername: "local.dev",
# documentroot: "/var/www/html",
# certificate_file: "/path/to/certificate.crt",
# certificate_key_file: "/path/to/certificate.key",
# # 可选的。
# certificate_chain_file: "/path/to/certificate_chain.crt"
apache_ignore_missing_ssl_certificate: true
apache_ssl_protocol: "All -SSLv2 -SSLv3"
apache_ssl_cipher_suite: "AES256+EECDH:AES256+EDH"
# 仅在Debian/Ubuntu上使用。
apache_mods_enabled:
- rewrite.load
- ssl.load
apache_mods_disabled: []
# 设置初始Apache状态。推荐值:`started`或`stopped`
apache_state: started
# 设置初始Apache服务状态。推荐值:`true`或`false`
apache_enabled: true
# 设置Apache状态,当配置更改时。推荐值:
# `restarted`或`reloaded`
apache_restart_state: restarted
# Apache软件包状态;使用`present`确保安装,或使用`latest`
# 如果要通过新repo进行升级或切换版本。
apache_packages_state: present
要求
- requirements.txt 中列出的pip包。
使用的角色状态
以下角色用于准备系统。您可以通过其他方式准备系统。
需求 | GitHub | 版本 |
---|---|---|
buluma.bootstrap |
上下文
该角色是许多兼容角色的一部分。有关更多信息,请查看 这些角色的文档。
以下是相关角色的概述:
兼容性
此角色已在这些 容器镜像 上进行了测试:
容器 | 标签 |
---|---|
EL | 全部 |
Fedora | 全部 |
Amazon | 全部 |
Debian | 全部 |
Ubuntu | 全部 |
所需的最低Ansible版本为2.12,测试已在以下版本上进行:
- 先前的版本。
- 当前版本。
- 开发版本。
如果您遇到问题,请在 GitHub上报告。