Set up nginx for poudriere.
This commit is contained in:
parent
ab0ab17201
commit
b30182060f
@ -63,6 +63,7 @@
|
|||||||
- fstab
|
- fstab
|
||||||
- portshaker
|
- portshaker
|
||||||
- poudriere
|
- poudriere
|
||||||
|
- poudrierenginx
|
||||||
|
|
||||||
- hosts: mrmanager
|
- hosts: mrmanager
|
||||||
vars:
|
vars:
|
||||||
|
@ -74,7 +74,7 @@ USE_TMPFS=all
|
|||||||
# How much memory to limit tmpfs size to for *each builder* in GiB
|
# How much memory to limit tmpfs size to for *each builder* in GiB
|
||||||
# (default: none)
|
# (default: none)
|
||||||
#TMPFS_LIMIT=8
|
#TMPFS_LIMIT=8
|
||||||
TMPFS_LIMIT=16
|
TMPFS_LIMIT=32
|
||||||
|
|
||||||
# How much memory to limit jail processes to for *each builder*
|
# How much memory to limit jail processes to for *each builder*
|
||||||
# in GiB (default: none)
|
# in GiB (default: none)
|
||||||
|
12
ansible/roles/poudrierenginx/files/headers.include
Normal file
12
ansible/roles/poudrierenginx/files/headers.include
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# Enable HTTP Strict Transport Security (HSTS) to force clients to
|
||||||
|
# always connect via HTTPS (do not use if only testing)
|
||||||
|
add_header Strict-Transport-Security "max-age=31536000;" always;
|
||||||
|
# Enable cross-site filter (XSS) and tell browser to block detected
|
||||||
|
# attacks
|
||||||
|
add_header X-XSS-Protection "1; mode=block" always;
|
||||||
|
# Prevent some browsers from MIME-sniffing a response away from the
|
||||||
|
# declared Content-Type
|
||||||
|
add_header X-Content-Type-Options "nosniff" always;
|
||||||
|
# Disallow the site to be rendered within a frame (clickjacking
|
||||||
|
# protection)
|
||||||
|
add_header X-Frame-Options "DENY" always;
|
2
ansible/roles/poudrierenginx/files/newsyslog.conf
Normal file
2
ansible/roles/poudrierenginx/files/newsyslog.conf
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num]
|
||||||
|
/var/log/nginx/*.log 640 5 1000 @T00 GYC /var/run/nginx.pid SIGUSR1
|
34
ansible/roles/poudrierenginx/files/nginx.conf
Normal file
34
ansible/roles/poudrierenginx/files/nginx.conf
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
worker_processes auto;
|
||||||
|
user www www;
|
||||||
|
|
||||||
|
events {
|
||||||
|
worker_connections 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
include mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
|
||||||
|
sendfile on;
|
||||||
|
tcp_nopush on;
|
||||||
|
tcp_nodelay on;
|
||||||
|
gzip on;
|
||||||
|
|
||||||
|
include conf.d/headers.include;
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 8080 default;
|
||||||
|
listen [::]:8080;
|
||||||
|
server_name freebsdpkg.fizz.buzz;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
root /usr/local/share/poudriere/html;
|
||||||
|
index index.html index.htm;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /data {
|
||||||
|
alias /usr/local/poudriere/data/logs/bulk;
|
||||||
|
autoindex on;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
1
ansible/roles/poudrierenginx/files/rc.conf
Normal file
1
ansible/roles/poudrierenginx/files/rc.conf
Normal file
@ -0,0 +1 @@
|
|||||||
|
nginx_enable="YES"
|
15
ansible/roles/poudrierenginx/tasks/common.yaml
Normal file
15
ansible/roles/poudrierenginx/tasks/common.yaml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
- import_tasks: tasks/freebsd.yaml
|
||||||
|
when: 'os_flavor == "freebsd"'
|
||||||
|
|
||||||
|
- import_tasks: tasks/linux.yaml
|
||||||
|
when: 'os_flavor == "linux"'
|
||||||
|
|
||||||
|
- include_tasks:
|
||||||
|
file: tasks/peruser.yaml
|
||||||
|
apply:
|
||||||
|
become: yes
|
||||||
|
become_user: "{{ initialize_user }}"
|
||||||
|
when: users is defined
|
||||||
|
loop: "{{ users | dict2items | community.general.json_query('[?value.initialize==`true`].key') }}"
|
||||||
|
loop_control:
|
||||||
|
loop_var: initialize_user
|
53
ansible/roles/poudrierenginx/tasks/freebsd.yaml
Normal file
53
ansible/roles/poudrierenginx/tasks/freebsd.yaml
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
- name: Create www group
|
||||||
|
group:
|
||||||
|
name: www
|
||||||
|
|
||||||
|
- name: Create www user
|
||||||
|
user:
|
||||||
|
name: www
|
||||||
|
home: /srv/http
|
||||||
|
createhome: false
|
||||||
|
group: www
|
||||||
|
|
||||||
|
- name: Install packages
|
||||||
|
package:
|
||||||
|
name:
|
||||||
|
- nginx
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Create root directories
|
||||||
|
file:
|
||||||
|
name: "{{ item }}"
|
||||||
|
state: directory
|
||||||
|
mode: 0755
|
||||||
|
owner: root
|
||||||
|
group: wheel
|
||||||
|
loop:
|
||||||
|
- /srv
|
||||||
|
- /usr/local/etc/nginx/conf.d
|
||||||
|
|
||||||
|
# validate fails because nginx config relies on a local mime.types
|
||||||
|
- name: Install Configuration
|
||||||
|
copy:
|
||||||
|
src: "files/{{ item.src }}"
|
||||||
|
dest: "{{ item.dest }}"
|
||||||
|
mode: 0644
|
||||||
|
owner: root
|
||||||
|
group: wheel
|
||||||
|
loop:
|
||||||
|
- src: rc.conf
|
||||||
|
dest: /etc/rc.conf.d/nginx
|
||||||
|
- src: nginx.conf
|
||||||
|
dest: /usr/local/etc/nginx/nginx.conf
|
||||||
|
- src: headers.include
|
||||||
|
dest: /usr/local/etc/nginx/conf.d/headers.include
|
||||||
|
# - name: Install newsyslog configuration
|
||||||
|
# copy:
|
||||||
|
# src: "files/{{ item.src }}"
|
||||||
|
# dest: "{{ item.dest }}"
|
||||||
|
# mode: 0600
|
||||||
|
# owner: root
|
||||||
|
# group: wheel
|
||||||
|
# loop:
|
||||||
|
# - src: newsyslog.conf
|
||||||
|
# dest: /usr/local/etc/newsyslog.conf.d/nginx.conf
|
29
ansible/roles/poudrierenginx/tasks/linux.yaml
Normal file
29
ansible/roles/poudrierenginx/tasks/linux.yaml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
# - name: Build aur packages
|
||||||
|
# register: buildaur
|
||||||
|
# become_user: "{{ build_user.name }}"
|
||||||
|
# command: "aurutils-sync --no-view {{ item }}"
|
||||||
|
# args:
|
||||||
|
# creates: "/var/cache/pacman/custom/{{ item }}-*.pkg.tar.*"
|
||||||
|
# loop:
|
||||||
|
# - foo
|
||||||
|
|
||||||
|
# - name: Update cache
|
||||||
|
# when: buildaur.changed
|
||||||
|
# pacman:
|
||||||
|
# name: []
|
||||||
|
# state: present
|
||||||
|
# update_cache: true
|
||||||
|
|
||||||
|
# - name: Install packages
|
||||||
|
# package:
|
||||||
|
# name:
|
||||||
|
# - foo
|
||||||
|
# state: present
|
||||||
|
|
||||||
|
# - name: Enable services
|
||||||
|
# systemd:
|
||||||
|
# enabled: yes
|
||||||
|
# name: "{{ item }}"
|
||||||
|
# daemon_reload: yes
|
||||||
|
# loop:
|
||||||
|
# - foo.service
|
2
ansible/roles/poudrierenginx/tasks/main.yaml
Normal file
2
ansible/roles/poudrierenginx/tasks/main.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
- import_tasks: tasks/common.yaml
|
||||||
|
# when: foo is defined
|
29
ansible/roles/poudrierenginx/tasks/peruser.yaml
Normal file
29
ansible/roles/poudrierenginx/tasks/peruser.yaml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
- include_role:
|
||||||
|
name: per_user
|
||||||
|
|
||||||
|
# - name: Create directories
|
||||||
|
# file:
|
||||||
|
# name: "{{ account_homedir.stdout }}/{{ item }}"
|
||||||
|
# state: directory
|
||||||
|
# mode: 0700
|
||||||
|
# owner: "{{ account_name.stdout }}"
|
||||||
|
# group: "{{ group_name.stdout }}"
|
||||||
|
# loop:
|
||||||
|
# - ".config/foo"
|
||||||
|
|
||||||
|
# - name: Copy files
|
||||||
|
# copy:
|
||||||
|
# src: "files/{{ item.src }}"
|
||||||
|
# dest: "{{ account_homedir.stdout }}/{{ item.dest }}"
|
||||||
|
# mode: 0600
|
||||||
|
# owner: "{{ account_name.stdout }}"
|
||||||
|
# group: "{{ group_name.stdout }}"
|
||||||
|
# loop:
|
||||||
|
# - src: foo.conf
|
||||||
|
# dest: .config/foo/foo.conf
|
||||||
|
|
||||||
|
- import_tasks: tasks/peruser_freebsd.yaml
|
||||||
|
when: 'os_flavor == "freebsd"'
|
||||||
|
|
||||||
|
- import_tasks: tasks/peruser_linux.yaml
|
||||||
|
when: 'os_flavor == "linux"'
|
Loading…
x
Reference in New Issue
Block a user