2020-01-30 09:00:00 +00:00
# Administer CUPS at http://box:631
# Above URL does NOT work over OpenVPN (ANYONE KNOW WHY?)
# TO DO:
# - validate input vars + prereqs
2020-05-20 23:38:09 +00:00
# - 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?
2020-05-16 22:22:55 +00:00
- 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
2020-01-30 09:00:00 +00:00
2019-02-03 00:36:59 +00:00
- name : Install 'cups' package
2017-12-08 11:58:15 +00:00
package :
2018-10-28 16:27:21 +00:00
name : cups
2017-12-08 11:58:15 +00:00
state : present
2017-10-19 06:33:02 +00:00
2018-10-31 18:59:28 +00:00
- name : Install our own /etc/cups/cupsd.conf from template, to permit local LAN admin
2017-12-08 11:58:15 +00:00
template :
src : cupsd.conf
dest : /etc/cups/cupsd.conf
2017-05-27 18:09:50 +00:00
2020-01-30 09:00:00 +00:00
- name : Install /etc/{{ apache_conf_dir }}/cups.conf from template
2017-12-08 11:58:15 +00:00
template :
src : cups.conf
2020-01-30 09:00:00 +00:00
dest : "/etc/{{ apache_conf_dir }}/"
# RECORD CUPS AS INSTALLED
- name : "Set 'cups_installed: True'"
set_fact :
cups_installed : True
2017-05-27 18:09:50 +00:00
2020-01-12 23:15:33 +00:00
- name : "Add 'cups_installed: True' to {{ iiab_state_file }}"
2020-01-12 22:06:24 +00:00
lineinfile :
2020-02-04 00:54:04 +00:00
path : "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml
2020-01-12 22:06:24 +00:00
regexp : '^cups_installed'
line: 'cups_installed : True '
2020-01-30 09:00:00 +00:00
2020-01-12 22:06:24 +00:00
- name : Enable http://box/cups via Apache (MIGHT NOT WORK?)
command : a2ensite cups.conf
2020-01-30 09:00:00 +00:00
when : cups_enabled | bool
- name : Disable http://box/cups via Apache
command : a2dissite cups.conf
when : not cups_enabled
2017-05-27 18:09:50 +00:00
2020-01-30 09:00:00 +00:00
- name : Enable & Start 'cups' and 'cups-browsed' systemd services (OS's other than Fedora 18)
2017-12-08 11:58:15 +00:00
service :
name : "{{ item }}"
state : started
enabled : yes
2017-05-27 18:09:50 +00:00
with_items :
- cups
- cups-browsed
when : cups_enabled and not is_F18
2020-01-30 09:00:00 +00:00
- name : Enable & Start 'cups' systemd service (Fedora 18, for XO laptops)
2018-10-31 05:54:27 +00:00
systemd :
2017-12-08 11:58:15 +00:00
name : cups
state : started
enabled : yes
2017-05-27 18:09:50 +00:00
when : cups_enabled and is_F18
2020-01-30 09:57:53 +00:00
- name : Permit headless admin of CUPS -- only works when CUPS daemon is running (if cups_enabled)
2017-05-27 18:09:50 +00:00
shell : "cupsctl --remote-admin"
2019-05-24 22:33:10 +00:00
when : cups_enabled | bool
2017-05-27 18:09:50 +00:00
2020-01-30 09:00:00 +00:00
- name : Disable & Stop 'cups' & 'cups-browsed' systemd services (OS's other than Fedora 18)
2018-10-31 05:54:27 +00:00
systemd :
2017-12-08 11:58:15 +00:00
name : "{{ item }}"
enabled : no
2020-01-30 09:00:00 +00:00
state : stopped
2017-05-27 18:09:50 +00:00
with_items :
- cups
- cups-browsed
when : not cups_enabled and not is_F18
2020-01-30 09:00:00 +00:00
- name : Disable & Stop 'cups' systemd service (Fedora 18, for XO laptops)
2018-10-31 05:54:27 +00:00
systemd :
2017-12-08 11:58:15 +00:00
name : cups
enabled : no
2020-01-30 09:00:00 +00:00
state : stopped
2017-05-27 18:09:50 +00:00
when : not cups_enabled and is_F18
2020-01-30 09:00:00 +00:00
2018-10-31 05:54:27 +00:00
- name : Add 'cups' variable values to {{ iiab_ini_file }}
2017-12-08 11:58:15 +00:00
ini_file :
2018-10-31 05:54:27 +00:00
path : "{{ iiab_ini_file }}"
2017-12-08 11:58:15 +00:00
section : cups
option : "{{ item.option }}"
2020-01-12 02:41:37 +00:00
value : "{{ item.value | string }}"
2017-05-27 18:09:50 +00:00
with_items :
- option : name
2017-12-08 11:58:15 +00:00
value : CUPS
2017-05-27 18:09:50 +00:00
- option : description
2020-01-29 14:25:23 +00:00
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."'
2020-01-30 09:00:00 +00:00
- option : install
2017-05-27 18:09:50 +00:00
value : "{{ cups_install }}"
2020-01-30 09:00:00 +00:00
- option : enabled
2017-05-27 18:09:50 +00:00
value : "{{ cups_enabled }}"