首先看下目录结构
nginx.conf.j2是模板配置文件,里面只改了一个配置worker_processes,单纯为了测试用,文件可以根据自己需求去改
[root@python playbook]# grep -Ev '^[[:space:]].*#|^#|^$' templates/nginx.conf.j2
user nginx;
worker_processes {
{
ansible_processor_vcpus }}; #工作线程数等同cpu数
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_