Commit d81c77d4 authored by Daniel Müller's avatar Daniel Müller 💬
Browse files

Stabilize playbook

Changed the playbook to no longer perform unnecessary tasks.
This allows for consecutive reruns without changes.
This also allows for stable vm updates via ansible.
parent 36fb72b5
--- ---
- hosts: localhost - hosts: localhost
tasks: pre_tasks:
- name: Update packages - name: Update packages
become: true become: true
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
update_cache: true update_cache: true
force_apt_get: true force_apt_get: true
tasks:
- name: Install xfce desktop and associated programms - name: Install xfce desktop and associated programms
become: true become: true
apt: apt:
...@@ -82,6 +84,17 @@ ...@@ -82,6 +84,17 @@
pip: pip:
executable: pip3 executable: pip3
name: sshuttle name: sshuttle
- name: Get current mpstools hash
set_fact:
mpstools_curr_hash: "{{ lookup('file', '/opt/mpstools/checksum', errors='ignore') }}"
- name: Get new mpstools hash
stat:
path: files/mpstools.tgz
checksum_algorithm: sha1
get_checksum: true
register: mpstools_new
- name: Install toolchain - name: Install toolchain
become: true become: true
...@@ -91,14 +104,7 @@ ...@@ -91,14 +104,7 @@
src: files/mpstools.tgz src: files/mpstools.tgz
dest: /opt dest: /opt
keep_newer: true keep_newer: true
when: mpstools_curr_hash != mpstools_new.stat.checksum
- name: Add toolchain to PATH (for bash only)
become: true
become_user: fs
lineinfile:
path: ~/.bashrc
line: 'export PATH="/opt/mpstools/bin:$PATH"'
create: true
# This has worked while testing but it is not a good way to solve the issue. # This has worked while testing but it is not a good way to solve the issue.
# It basically forces the executables to use the newer version of libncurses # It basically forces the executables to use the newer version of libncurses
...@@ -111,6 +117,24 @@ ...@@ -111,6 +117,24 @@
- /opt/mpstools/bin/arm-v4t-eabi-gdb - /opt/mpstools/bin/arm-v4t-eabi-gdb
- /opt/mpstools/bin/arm-elf-insight - /opt/mpstools/bin/arm-elf-insight
- /opt/mpstools/bin/arm-elf-eabi-insight - /opt/mpstools/bin/arm-elf-eabi-insight
when: mpstools_curr_hash != mpstools_new.stat.checksum
- name: Set toolchain checksum
become: true
copy:
owner: root
group: root
dest: /opt/mpstools/checksum
content: "{{ mpstools_new.stat.checksum }}"
when: mpstools_curr_hash != mpstools_new.stat.checksum
- name: Add toolchain to PATH (for bash only)
become: true
become_user: fs
lineinfile:
path: ~/.bashrc
line: 'export PATH="/opt/mpstools/bin:$PATH"'
create: true
- name: Install xfce themes - name: Install xfce themes
become: true become: true
...@@ -170,7 +194,6 @@ ...@@ -170,7 +194,6 @@
src: files/conf/lightdm-gtk-greeter.conf src: files/conf/lightdm-gtk-greeter.conf
dest: /etc/lightdm dest: /etc/lightdm
# TODO: GEDIT THEME IS NOT APPLIED
- name: Install preconfigured config - name: Install preconfigured config
become: true become: true
copy: copy:
...@@ -178,14 +201,21 @@ ...@@ -178,14 +201,21 @@
group: fs group: fs
src: files/conf/home-conf/{{ item }} src: files/conf/home-conf/{{ item }}
dest: /home/fs dest: /home/fs
force: false
with_items: with_items:
- .config - .config
- .sn - .sn
- name: Create user home dirs - name: Check if user dirs exist
stat:
path: /home/fs/.config/user-dirs.dirs
register: user_dirs
- name: Create user dirs
become: true become: true
become_user: fs become_user: fs
shell: xdg-user-dirs-update shell: xdg-user-dirs-update
when: not user_dirs.stat.exists
# This is a critical step to check for security issues. The installed ca # This is a critical step to check for security issues. The installed ca
# comes from the DFN website: https://pki.pca.dfn.de/dfn-ca-global-g2/cgi-bin/pub/pki # comes from the DFN website: https://pki.pca.dfn.de/dfn-ca-global-g2/cgi-bin/pub/pki
...@@ -262,6 +292,7 @@ ...@@ -262,6 +292,7 @@
become_user: fs become_user: fs
shell: xdg-user-dir DESKTOP shell: xdg-user-dir DESKTOP
register: user_desktop register: user_desktop
changed_when: false
- name: Install desktop launchers - name: Install desktop launchers
become: true become: true
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment