mirror of
https://github.com/iiab/iiab.git
synced 2025-02-13 19:52:06 +00:00
112 lines
3 KiB
YAML
112 lines
3 KiB
YAML
# Administer CUPS at http://box:631
|
|
# Above URL does NOT work over OpenVPN (ANYONE KNOW WHY?)
|
|
|
|
# TO DO:
|
|
# - validate input vars + prereqs
|
|
# - move ~7 top stanzas into install.yml
|
|
# - move ~7 next stanzas into enable-or-disable.yml
|
|
# - create /etc/nginx/conf.d/cups-nginx.conf as SHIM to Apache on port 8090 ?
|
|
# - deprecate ~2 F18 stanzas?
|
|
|
|
|
|
- name: "Set 'apache_install: True' and 'apache_enabled: True'"
|
|
set_fact:
|
|
apache_install: True
|
|
apache_enabled: True
|
|
|
|
- name: APACHE - run 'httpd' role
|
|
include_role:
|
|
name: httpd
|
|
|
|
|
|
- name: Install 'cups' package
|
|
package:
|
|
name: cups
|
|
state: present
|
|
|
|
- name: Install our own /etc/cups/cupsd.conf from template, to permit local LAN admin
|
|
template:
|
|
src: cupsd.conf
|
|
dest: /etc/cups/cupsd.conf
|
|
|
|
- name: Install /etc/{{ apache_conf_dir }}/cups.conf from template
|
|
template:
|
|
src: cups.conf
|
|
dest: "/etc/{{ apache_conf_dir }}/"
|
|
|
|
|
|
# RECORD CUPS AS INSTALLED
|
|
|
|
- name: "Set 'cups_installed: True'"
|
|
set_fact:
|
|
cups_installed: True
|
|
|
|
- name: "Add 'cups_installed: True' to {{ iiab_state_file }}"
|
|
lineinfile:
|
|
path: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml
|
|
regexp: '^cups_installed'
|
|
line: 'cups_installed: True'
|
|
|
|
|
|
- name: Enable http://box/cups via Apache (MIGHT NOT WORK?)
|
|
command: a2ensite cups.conf
|
|
when: cups_enabled | bool
|
|
|
|
- name: Disable http://box/cups via Apache
|
|
command: a2dissite cups.conf
|
|
when: not cups_enabled
|
|
|
|
- name: Enable & Start 'cups' and 'cups-browsed' systemd services (OS's other than Fedora 18)
|
|
service:
|
|
name: "{{ item }}"
|
|
state: started
|
|
enabled: yes
|
|
with_items:
|
|
- cups
|
|
- cups-browsed
|
|
when: cups_enabled and not is_F18
|
|
|
|
- name: Enable & Start 'cups' systemd service (Fedora 18, for XO laptops)
|
|
systemd:
|
|
name: cups
|
|
state: started
|
|
enabled: yes
|
|
when: cups_enabled and is_F18
|
|
|
|
- name: Permit headless admin of CUPS -- only works when CUPS daemon is running (if cups_enabled)
|
|
shell: "cupsctl --remote-admin"
|
|
when: cups_enabled | bool
|
|
|
|
- name: Disable & Stop 'cups' & 'cups-browsed' systemd services (OS's other than Fedora 18)
|
|
systemd:
|
|
name: "{{ item }}"
|
|
enabled: no
|
|
state: stopped
|
|
with_items:
|
|
- cups
|
|
- cups-browsed
|
|
when: not cups_enabled and not is_F18
|
|
|
|
- name: Disable & Stop 'cups' systemd service (Fedora 18, for XO laptops)
|
|
systemd:
|
|
name: cups
|
|
enabled: no
|
|
state: stopped
|
|
when: not cups_enabled and is_F18
|
|
|
|
|
|
- name: Add 'cups' variable values to {{ iiab_ini_file }}
|
|
ini_file:
|
|
path: "{{ iiab_ini_file }}"
|
|
section: cups
|
|
option: "{{ item.option }}"
|
|
value: "{{ item.value | string }}"
|
|
with_items:
|
|
- option: name
|
|
value: CUPS
|
|
- option: description
|
|
value: '"CUPS (Common UNIX Printing System) is a modular printing system that allows a computer to act as a print server. A computer running CUPS is a host that can accept print jobs from client computers, process them, and send them to the appropriate printer."'
|
|
- option: install
|
|
value: "{{ cups_install }}"
|
|
- option: enabled
|
|
value: "{{ cups_enabled }}"
|