change-wallpapers.yml 1.4 KB

1234567891011121314151617181920212223242526272829
  1. ---
  2. - hosts: kc41
  3. vars:
  4. release: focal
  5. winetricks_patch: /usr/bin
  6. prefix_dir: /usr/prefixes
  7. prefix_path: /usr/prefixes/msapps
  8. user_permission: student
  9. officepath: /home/vidikon/ANSIBLE/Office2013.tar.gz
  10. become: true
  11. gather_facts: no
  12. tasks:
  13. - name: Copy wallpaper
  14. ansible.builtin.copy:
  15. src: /home/vidikon/ANSIBLE/software-playbooks/files/wallpaper.jpg
  16. dest: /home/
  17. owner: "{{ user_permission }}"
  18. group: "{{ user_permission }}"
  19. #1000 для pc9, 1001 для остальных
  20. - name: Set wallpaper
  21. vars:
  22. DISPLAY: ":0"
  23. ansible.builtin.shell: "sudo -H -u student DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id {{ user_permission }} | awk -F '=' '{print $2}' | awk -F '(' '{print $1}')/bus DISPLAY=:0 gsettings set org.cinnamon.desktop.background picture-uri 'file:///home/wallpaper.jpg'"
  24. - name: Ensure a job that runs at 2 and 5 exists. Creates an entry like "0 5,2 * * ls -alh > /dev/null"
  25. ansible.builtin.cron:
  26. name: "check wallpaper"
  27. minute: "*/5"
  28. job: "sudo -H -u student DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id {{ user_permission }} | awk -F '=' '{print $2}' | awk -F '(' '{print $1}')/bus DISPLAY=:0 gsettings set org.cinnamon.desktop.background picture-uri 'file:///home/wallpaper.jpg'"