refactoring
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Robert Kaussow 2019-08-13 22:05:48 +02:00
parent fd82137ee0
commit 7d59e38d63
12 changed files with 16 additions and 137 deletions

View File

@ -1,6 +1,11 @@
---
# not working currently
cups_version: 2.2.10
# Install dependencies or
# custom driver packages
cups_packages_extra: []
cups_admin_username: cupsadm
cups_admin_password: secure
@ -28,18 +33,3 @@ cups_open_ports:
-A OUTPUT -m state --state NEW -p tcp --dport 5353 -j ACCEPT
-A OUTPUT -m state --state NEW -p udp --dport 5353 -j ACCEPT
state: present
cups_tls_cert_source: mycert.pem
cups_tls_key_source: mykey.pem
cups_nginx_vhost_enabled: False
cups_nginx_server: localhost
cups_nginx_proxy_url: "{{ cups_bind_url[0] }}"
cups_nginx_vhost_dir: /etc/nginx/sites-available
cups_nginx_vhost_symlink: /etc/nginx/sites-enabled
cups_nginx_iptables_enabled: False
cups_nginx_tls_enabled: False
cups_nginx_tls_cert_file: cups-cert.pem
cups_nginx_tls_key_file: cups-key.pem
cups_custom_driver_packages: []

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -8,12 +8,3 @@
listen: __cupsd_restart
become: True
become_user: root
- name: Reload nginx
systemd:
state: reloaded
name: nginx
listen: __nginx_reload
delegate_to: "{{ cups_nginx_server }}"
become: True
become_user: root

View File

@ -1,23 +1,14 @@
---
- block:
- name: Copy cups rpms to destination host
copy:
src: "files/{{ item | basename }}"
dest: "{{ item }}"
owner: root
group: root
mode: 0640
loop: "{{ __cups_rpm_files }}"
- name: Install cups rpms
- name: Install cups
yum:
name: "{{ __cups_rpm_files }}"
name: "{{ cups_packages | deafult(__cups_packages) }}"
state: present
notify: __cupsd_restart
- name: Install custom driver packages
- name: Install extra packages
yum:
name: "{{ cups_custom_driver_packages }}"
name: "{{ cups_packages_extra }}"
state: present
notify: __cupsd_restart

View File

@ -3,6 +3,4 @@
- include_tasks: install.yml
- include_tasks: selinux.yml
when: ansible_selinux
- import_tasks: nginx.yml
when: cups_nginx_vhost_enabled
- include_tasks: post_tasks.yml

View File

@ -1,50 +0,0 @@
---
- block:
- name: Copy certs and private key to nginx proxy
copy:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
mode: "{{ item.mode }}"
with_items:
- { src: "{{ cups_tls_key_source }}", dest: '/etc/pki/tls/private/{{ cups_nginx_tls_key_file }}', mode: '0600' }
- { src: "{{ cups_tls_cert_source }}", dest: '/etc/pki/tls/certs/{{ cups_nginx_tls_cert_file }}', mode: '0750' }
loop_control:
label: "{{ item.dest }}"
notify: __nginx_reload
delegate_to: "{{ cups_nginx_server }}"
when: cups_nginx_tls_enabled
become: True
become_user: root
tags: tls_renewal
- block:
- name: Add vhost configuration file
template:
src: nginx/vhost.j2
dest: "{{ cups_nginx_vhost_dir }}/cups"
owner: root
group: root
mode: 0640
notify: __nginx_reload
- name: Enable cups vhost
file:
src: "{{ cups_nginx_vhost_dir }}/cups"
dest: "{{ cups_nginx_vhost_symlink }}/cups"
owner: root
group: root
state: link
notify: __nginx_reload
when: cups_nginx_vhost_symlink is defined
- name: Open ports in iptables
iptables_raw:
name: allow_cups_nginx_proxy
state: present
rules: '-A OUTPUT -m state --state NEW -p tcp -d {{ cups_nginx_proxy_url.split(":")[0] }} --dport {{ cups_nginx_proxy_url.split(":")[1] }} -j ACCEPT'
when:
- cups_nginx_iptables_enabled
- not cups_nginx_server == inventory_hostname
delegate_to: "{{ cups_nginx_server }}"
become: True
become_user: root

View File

@ -1,5 +1,5 @@
#jinja2: lstrip_blocks: True
# {{ ansible_managed }}
{{ ansible_managed | comment }}
#
# File/directory/user/group configuration file for the CUPS scheduler.
# See "man cups-files.conf" for a complete description of this file.

View File

@ -1,42 +0,0 @@
#jinja2: lstrip_blocks: True
# {{ ansible_managed }}
upstream backend_cups {
server {{ cups_nginx_proxy_url }};
}
server {
listen 80;
server_name {{ cups_listen_address }};
{% if cups_nginx_tls_enabled %}
return 301 https://$server_name$request_uri;
{% else %}
location / {
proxy_pass http://backend_cups;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
{% endif %}
}
{% if cups_nginx_tls_enabled %}
server {
listen 443 ssl;
server_name {{ cups_listen_address }};
location / {
proxy_pass http://backend_cups;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
ssl_certificate /etc/pki/tls/certs/{{ cups_nginx_tls_cert_file }};
ssl_certificate_key /etc/pki/tls/private/{{ cups_nginx_tls_key_file }};
}
{% endif %}

View File

@ -1,9 +1,10 @@
---
__cups_rpm_files:
- /var/tmp/cups-2.2.10-0.x86_64.rpm
- /var/tmp/cups-devel-2.2.10-0.x86_64.rpm
- /var/tmp/cups-libs-2.2.10-0.x86_64.rpm
- /var/tmp/cups-lpd-2.2.10-0.x86_64.rpm
__cups_download_url: https://gitea.rknet.org/xoxys/cups-rpm/releases/download/{{ cups_version }}
__cups_packages:
- "{{ __cups_download_url }}/var/tmp/cups-{{ cups_version }}-0.x86_64.rpm"
- "{{ __cups_download_url }}/var/tmp/cups-devel-{{ cups_version }}-0.x86_64.rpm"
- "{{ __cups_download_url }}/var/tmp/cups-libs-{{ cups_version }}-0.x86_64.rpm"
- "{{ __cups_download_url }}/var/tmp/cups-lpd-{{ cups_version }}-0.x86_64.rpm"
__pam_config:
- type: "auth"