robertdebock.httpd
Ansible角色 httpd
在系统上安装和配置httpd。
GitHub | GitLab | 下载 | 版本 |
---|---|---|---|
示例剧本
此示例来自 molecule/default/converge.yml
,并在每次推送、拉取请求和发布时进行测试。
---
- name: 汇聚
hosts: all
become: true
gather_facts: true
vars_files:
- ../../vars/main.yml
- ../../defaults/main.yml
roles:
- role: robertdebock.httpd
# https_ssl_enable: true
httpd_port: 8080
httpd_ssl_port: 8443
httpd_locations:
- name: my_location
location: /my_location
backend_url: "http://localhost:8080/myapplication"
# httpd_vhosts:
# - name: my_vhost_docroot
# servername: www1.example.com
# documentroot: "{{ httpd_data_directory }}/www1.example.com"
# - name: my_vhost_backend_http
# servername: www2.example.com
# backend_url: "http://www.example.com/"
# serveralias:
# - example.com
# - www.example.com
# - name: my_vhost_remote
# servername: www3.example.com
# remote: "http://localhost:3128/"
# - name: my_vhost_backend_https
# servername: www4.example.com
# backend_url: "https://www.example.com/"
# - name: my_vhost_piratebay
# servername: piratebay.nl
# backend_url: "https://thepirate-bay.org/"
# proxy_preserve_host: Off
# proxy_requests: Off
# setenv:
# - name: force-proxy-request-1.0
# value: 1
# - name: proxy-nokeepalive
# value: 1
# - name: proxy-initial-not-pooled
# - name: proxy-sendchunks
# value: 1
# - name: no_doc_root
# servername: nodocroot.example.com
# documentroot: /var/www/html/nodocroot
# create_docroot: false
httpd_directories:
- name: my_directory
path: "{{ httpd_data_directory }}/my_directory"
# options:
# - Indexes
# - FollowSymLinks
allow_override: All
需要准备机器。在CI中,这可以通过 molecule/default/prepare.yml
完成:
---
- name: 准备
hosts: all
become: true
gather_facts: false
roles:
- role: robertdebock.bootstrap
- role: robertdebock.epel
- role: robertdebock.buildtools
- role: robertdebock.python_pip
- role: robertdebock.openssl
openssl_items:
- name: apache-httpd
common_name: "{{ ansible_fqdn }}"
有关如何使用这些角色的 详细说明和示例。
角色变量
变量的默认值设置在 defaults/main.yml
中:
---
# httpd的默认文件
# 使用的servername。
httpd_servername: "{{ ansible_fqdn }}"
# 使用的非SSL端口。
httpd_port: 80
# 启用(自签名证书)SSL?
https_ssl_enable: false
# 配置https时,设置要监听的主机名。
httpd_ssl_servername: "{{ ansible_fqdn }}"
# 对于SSL,需要一个TCP端口。
httpd_ssl_port: 443
# SSL证书:
httpd_openssl_crt: "{{ httpd_openssl_crt_directory }}/apache-httpd.crt"
# SSL密钥
httpd_openssl_key: "{{ httpd_openssl_key_directory }}/apache-httpd.key"
# 是否应该保留“它工作”的页面
httpd_remove_example: false
# 另外要安装的httpd模块
httpd_additionnal_modules: []
httpd_custom_modules_to_activate_with_command: []
apache_global_vhost_settings: |
DirectoryIndex index.php index.html
# 用于vhosts的模板。对覆盖conf以适应自己的设置很有用。
vhost_conf_template: vhost.conf.j2
default_vhost_conf: default_vhost.conf
要求
- requirements.txt 中列出的pip包。
使用的角色状态
以下角色用于准备系统。您可以以其他方式准备您的系统。
要求 | GitHub | GitLab |
---|---|---|
robertdebock.bootstrap | ||
robertdebock.buildtools | ||
robertdebock.epel | ||
robertdebock.openssl | ||
robertdebock.python_pip | ||
robertdebock.selinux |
上下文
此角色是许多兼容角色的一部分。有兴趣可以查看 这些角色的文档 以获取更多信息。
以下是相关角色的概述:
兼容性
此角色已在以下 容器镜像 上测试:
容器 | 标签 |
---|---|
EL | 9 |
Debian | 所有 |
Fedora | 所有 |
Ubuntu | 所有 |
所需的最小Ansible版本为2.12,测试已在以下版本上进行:
- 上一个版本。
- 当前版本。
- 开发版本。
如果您发现问题,请在 GitHub 上注册。
许可证
作者信息
请考虑 赞助我。
关于项目
Install and configure httpd on your system.
安装
ansible-galaxy install robertdebock.httpd
许可证
apache-2.0
下载
377.4k
拥有者
I know my way around (Linux) infrastructure, have a passion for automation, Docker, Ansible, Molecule and ci/cd.