Thanks Zolvaring! That works!

On Wednesday, September 4, 2019 at 9:36:08 PM UTC-5, Zolvaring wrote:
>
> I'm almost positive you'd have to register the SELinux task return to get 
> this to work, 'reboot_required' is not going to exist outside of that 
> scope, I think what you would need is:
>
> ---
> - name: Set SELinux to permissive mode.
>   selinux:
>     policy: targeted
>     state: permissive
>   register: set_selinux
>   when: ansible_selinux_python_present|bool
> - name: Reboot
>   selinux:
>   when: set_selinux.reboot_required|bool
>
> The return values for the selinux module are documented here 
> https://docs.ansible.com/ansible/latest/modules/selinux_module.html, and 
> reboot_required is among them. Hope this helps.
>
> On Wednesday, September 4, 2019 at 6:46:33 AM UTC-7, Keith Mills wrote:
>>
>> Hello All,
>>
>> I need to set SELinux to permissive mode and reboot. When I run my 
>> playbook I get an error.
>>
>> Playbook:
>>
>> ---
>> - name: Set SELinux to permissive mode.
>>   selinux:
>>     policy: targeted
>>     state: permissive
>>   when: ansible_selinux_python_present|bool
>> - name: Reboot
>>   selinux:
>>   when: reboot_required|bool
>>
>> Error:
>>
>> TASK [buildservers : Reboot] 
>> ************************************************************************************************************************************************
>> fatal: [abls15ex]: FAILED! => {"msg": "The conditional check 
>> 'reboot_required|bool' failed. The error was: error while evaluating 
>> conditional (reboot_required|bool): 'reboot_required' is undefined\n\nThe 
>> error appears to be in 
>> '/home/jamekeit/ds9/roles/buildservers/tasks/selinux.yaml': line 7, column 
>> 3, but may\nbe elsewhere in the file depending on the exact syntax 
>> problem.\n\nThe offending line appears to be:\n\n  when: 
>> ansible_selinux_python_present|bool\n- name: Reboot\n  ^ here\n"}
>>
>>
>> Can anyone help?
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/d37c76dd-bbfc-4040-a896-a1b81fed5fd1%40googlegroups.com.

Reply via email to