From 1a466f92de1ba2a9463b48bccead035975477f12 Mon Sep 17 00:00:00 2001 From: Marc Tamsky Date: Thu, 30 May 2019 01:30:31 -0700 Subject: [PATCH] Test for Raspbian before assuming --- roles/raspbian/tasks/main.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/roles/raspbian/tasks/main.yml b/roles/raspbian/tasks/main.yml index 189ef90..ba0d280 100644 --- a/roles/raspbian/tasks/main.yml +++ b/roles/raspbian/tasks/main.yml @@ -1,14 +1,24 @@ --- +- name: Test for Raspbian + stat: + path: /boot/cmdline.txt + register: cmdline + - name: Activating cgroup on Raspbian lineinfile: path: /boot/cmdline.txt regexp: '^(.*rootwait)$' line: '\1 cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory' backrefs: true - when: ( ansible_facts.architecture is search "arm" ) + when: ( cmdline.stat.path is defined ) + and + ( ansible_facts.architecture is search("arm") ) + register: boot_cmdline - name: Rebooting on Raspbian shell: reboot now ignore_errors: true - when: ( ansible_facts.architecture is search "arm" ) + when: ( boot_cmdline | changed ) + and + ( ansible_facts.architecture is search("arm") )