forked from dholt/bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdesktop-xubuntu.sh
46 lines (37 loc) · 936 Bytes
/
desktop-xubuntu.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env bash
# Ensure running as regular user
if [ $(id -u) -eq 0 ] ; then
echo "Please run as a regular user"
exit 1
fi
# Install newer version of Ansible
sudo apt-get -y install software-properties-common
sudo apt-add-repository -y ppa:ansible/ansible
sudo apt-get update
sudo apt-get -y install ansible
# Write playbook
f=$(mktemp)
cat <<EOF > $f
- hosts: all
become: true
become_method: sudo
tasks:
- name: desktop | install xubuntu-core
apt:
name: xubuntu-core
state: present
update_cache: yes
- name: desktop | enable auto-login
lineinfile:
path: /usr/share/lightdm/lightdm.conf.d/60-xubuntu.conf
line: "autologin-user={{ ansible_env.SUDO_USER }}"
- name: desktop | auto-login user
service:
name: lightdm
state: restarted
EOF
# Execute playbook
ansible-playbook -i "localhost," -c local $f
# cleanup
rm -f $f
exit