change variable username
This commit is contained in:
parent
f02a02ec9b
commit
7f5380a026
@ -1,2 +1,10 @@
|
|||||||
---
|
---
|
||||||
# handlers file for cups
|
# handlers file for cups
|
||||||
|
|
||||||
|
|
||||||
|
- name: restart cups
|
||||||
|
service:
|
||||||
|
name: cups-browsed.service
|
||||||
|
enabled: True
|
||||||
|
state: restarted
|
||||||
|
become: yes
|
@ -17,25 +17,27 @@
|
|||||||
|
|
||||||
- name: Add accounts to lpadmin group (CUPS admin)
|
- name: Add accounts to lpadmin group (CUPS admin)
|
||||||
user:
|
user:
|
||||||
name: "{{ username }}"
|
name: "{{ user.name }}"
|
||||||
append: yes
|
append: yes
|
||||||
groups: "cups"
|
groups: "cups"
|
||||||
become: yes
|
become: yes
|
||||||
|
|
||||||
- name: check printers
|
- name: check printers
|
||||||
tags: cups
|
|
||||||
command: lpstat -p Brother_DCP-L2530DW_series
|
command: lpstat -p Brother_DCP-L2530DW_series
|
||||||
register: printers
|
register: printers
|
||||||
ignore_errors: True
|
ignore_errors: True
|
||||||
changed_when: False
|
changed_when: printers.failed==true
|
||||||
|
|
||||||
|
- debug:
|
||||||
|
msg: "{{printers}}"
|
||||||
- name: copy printers.conf
|
- name: copy printers.conf
|
||||||
copy:
|
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.
|
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.
|
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).
|
group: cups # not required. Name of the group that should own the file/directory, as would be fed to I(chown).
|
||||||
become: yes
|
become: yes
|
||||||
when: printers.changed == "true"
|
notify: restart cups
|
||||||
|
when: printers.changed == true
|
||||||
|
|
||||||
- name: Enable and start CUPS service
|
- name: Enable and start CUPS service
|
||||||
service:
|
service:
|
||||||
|
Loading…
Reference in New Issue
Block a user