You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Replace existing XFCE4 wallpaper. Setting the wallpaper seems to require an
2
+
# X-display, which seems overcomplicated.
3
+
- name: Download and set wallpaper.
4
+
get_url:
5
+
url={{ WALLPAPER_URL }}
6
+
force=yes
7
+
dest=/usr/share/backgrounds/xfce/xfce-blue.jpg
8
+
sudo: yes
9
+
10
+
- name: Set permissions of wallpaper.
11
+
file:
12
+
path=/usr/share/backgrounds/xfce/xfce-blue.jpg
13
+
owner=root
14
+
group=root
15
+
mode=644
16
+
sudo: yes
17
+
18
+
# Now we mark it, if it needs marking.
19
+
- name: Define background location.
20
+
set_fact:
21
+
background_dir: /usr/share/backgrounds/xfce
22
+
23
+
- name: Determine whether or not the image is already marked.
24
+
stat:
25
+
path: "{{ background_dir }}/marked "
26
+
register: marked
27
+
28
+
- name: Install ImageMagick (temporarily)
29
+
apt:
30
+
pkg=imagemagick
31
+
state=latest
32
+
update_cache=yes
33
+
cache_valid_time=86400
34
+
sudo: yes
35
+
when: not marked.stat.exists
36
+
37
+
- name: Obtain watermark text.
38
+
command: cat /vagrant/repository_version
39
+
register: text
40
+
when: not marked.stat.exists
41
+
42
+
# I am so sorry.
43
+
#
44
+
# First two converts create the stamp in two parts. The following composite
45
+
# combines the stamp, and the mogrify effectively crops it. The final composite
46
+
# applies the stamp to the wallpaper.
47
+
#
48
+
# At the end of this, a 'marked' placeholder file is added for idempotency.
49
+
- name: Add version watermark.
50
+
shell: |
51
+
convert -size 450x150 xc:grey30 -pointsize 60 -gravity center -draw "fill grey70 text 0,0 '{{ text.stdout }}'" stamp_fore.png
52
+
convert -size 450x150 xc:black -pointsize 60 -gravity center -draw "fill white text 2,2 '{{ text.stdout }}' text 0,0 '{{ text.stdout }}' fill white text -4,-4 '{{ text.stdout }}' fill black text -1,-1 '{{ text.stdout }}'" +matte stamp_mask.png
0 commit comments