From 0642260b3448eeee5ec8be12d922c6875675c4a0 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 --- contrib/ansible/roles/raspbian/tasks/main.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/contrib/ansible/roles/raspbian/tasks/main.yml b/contrib/ansible/roles/raspbian/tasks/main.yml index 189ef90d15..ba0d2804aa 100644 --- a/contrib/ansible/roles/raspbian/tasks/main.yml +++ b/contrib/ansible/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") )