1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-15 04:32:11 +00:00
iiab/roles/cups/tasks/main.yml

113 lines
3 KiB
YAML
Raw Normal View History

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
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
- 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'
2020-01-30 09:00:00 +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
- 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"
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 }}"
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 }}"