cups/tasks/main.yml

47 lines
1.7 KiB
YAML
Raw Permalink Normal View History

2019-04-10 18:24:45 +00:00
---
2019-04-11 11:55:04 +00:00
# tasks file for cups
- name: Install CUPS and associated utilities
pacman:
name:
- cups
- cups-pdf
- ghostscript
- gsfonts
become: yes
- name: Install brother Driver
aur:
name: brother-dcpl2530dw
2020-06-04 20:22:44 +00:00
state: present
2019-04-11 11:55:04 +00:00
- name: Add accounts to lpadmin group (CUPS admin)
user:
2019-04-11 16:53:38 +00:00
name: "{{ user.name }}"
2019-04-11 11:55:04 +00:00
append: yes
groups: "cups"
become: yes
- name: check printers
command: lpstat -p Brother_DCP-L2530DW_series
register: printers
ignore_errors: True
2019-04-11 16:53:38 +00:00
changed_when: printers.failed==true
2019-04-11 11:55:04 +00:00
2019-04-11 16:53:38 +00:00
- debug:
msg: "{{printers}}"
2019-04-11 11:55:04 +00:00
- name: copy printers.conf
copy:
dest: /etc/cups/ # required. Remote absolute path where the file should be copied to. If I(src) is a directory, this must be a directory too. If I(dest) is a nonexistent path and if either I(dest) ends with "/" or I(src) is a directory, I(dest) is created. If I(src) and I(dest) are files, the parent directory of I(dest) isn't created: the task fails if it doesn't already exist.
src: printers.conf # not required. Local path to a file to copy to the remote server; can be absolute or relative. If path is a directory, it is copied recursively. In this case, if path ends with "/", only inside contents of that directory are copied to destination. Otherwise, if it does not end with "/", the directory itself with all contents is copied. This behavior is similar to Rsync.
group: cups # not required. Name of the group that should own the file/directory, as would be fed to I(chown).
become: yes
2019-04-11 16:53:38 +00:00
notify: restart cups
when: printers.changed == true
2019-04-11 11:55:04 +00:00
- name: Enable and start CUPS service
service:
name: cups-browsed.service
enabled: True
state: started
become: yes