Useful shortcuts for vi editor

Wednesday 13 July 2022

How to add a user into "wheel" group?

For example, you have only a root user for the super-user activities, but you wanted to use a custom user for some specific purposes. To make this, you might use "wheel" user group which is a special one for the "sudo" operations. 

Action
sudo usermod -aG wheel alperadm

Check and Determine the Option:
$ sudo cat /etc/sudoers

## Allows people in group wheel to run all commands
# %wheel  ALL=(ALL)       ALL

## Same thing without a password
%wheel        ALL=(ALL)       NOPASSWD: ALL

$ cat /etc/group | grep wheel
wheel:x:10:root,alperadm

Test
$ cat /etc/sudoers
cat: /etc/sudoers: Permission denied

$ sudo cat /etc/sudoers
Worked!

Tuesday 24 May 2022

'ansible.utils.unsafe_proxy.AnsibleUnsafeText object' has no attribute 'stdout'

Action
ansible-playbook -i /etc/ansible/hosts /etc/ansible/example.yml -v

Error
'ansible.utils.unsafe_proxy.AnsibleUnsafeText object' has no attribute 'stdout'

Solution
Use the standard output of the variable before setting it as a fact
e.g.
- name: debug
  debug:
   msg: "Hello, {{ my_variable.stdout }}!"

- name: set fact the variable
  set_fact:
    fact_my_variable: "{{ my_variable.stdout }}"