Debug

Display subsystems

Limit the execution of the playbook by the tag -t lp_debug to the tasks stored in the file tasks/debug.yml and enable the debug output either in the configuration,

lp_debug: true

, or in the command by setting the extra variable

shell> ansible-playbook lp.yml -e lp_debug=true -t lp_debug

The above command will run the single debug task and display selected variables. There are more sections in the output:

  • (4-10) The facts collected by setup.

  • (12-15) The parameters that control the collection of OS specific variables.

  • {19-22) The parameters that control the installation of packages (19-20), backup of changed files (21), and list of managed services.

  • (25-26) See the next section Display lists of subsystems

  • (28-49) The sorted list of tasks

  • (51-70) The sorted list of single services lp_<name>_service

  • (72-80) The sorted list of multiple services lp_<name>_services

  • (82-86) Others

The first variables in the blocks of the tasks and services enable that particular subsystem. See tasks/main.yml on how to enable particular imports. Some tasks need non-empty list only. For example non-empty lists lp_users or lp_users_groups iterate the user module in tasks/users.yml. Not all tasks are listed in this debug output.

 1TASK [vbotka.linux_postinstall : Debug] *******************************************************
 2ok: [srv.example.com] => 
 3  msg: |-
 4    ansible_architecture: x86_64
 5    ansible_os_family: Debian
 6    ansible_distribution: Ubuntu
 7    ansible_distribution_major_version: 20
 8    ansible_distribution_version: 20.04
 9    ansible_distribution_release: focal
10    ansible_python_version: 3.8.5
11  
12    lp_vars_distro: incremental
13    lp_vars_distro_firstfound_skip: True
14    lp_vars_flavors: firstfound
15    lp_flavors_enable: False
16    my_release:
17      []
18  
19    lp_package_state: present
20    lp_package_state_remove: absent
21    lp_backup_conf: True
22    lp_service:
23      []
24  
25    lp_tasks_enabled: Disabled
26    lp_tasks_disabled: Disabled
27  
28    lp_acpi: True
29    lp_aliases: True
30    lp_apt: False
31    lp_debsums: True, lp_debsums_install: False
32    lp_gpg: True, lp_gpg_install: True
33    lp_grub: True
34    lp_iptables: True
35    lp_kvm: True, lp_kvm_install: False
36    lp_latex: True, lp_latex_install: True
37    lp_lid: True
38    lp_logrotate: True, lp_logrotate_install: True
39    lp_netplan: True
40    lp_packages_autoremove: True
41    lp_passwords: True
42    lp_pm: True
43    lp_rc_local: True
44    lp_reboot: False
45    lp_ssh: True
46    lp_swap: True, lp_swap_enable: True
47    lp_systemd: False, lp_systemd_install: True
48    lp_timezone: True
49    lp_wpagui: True, lp_wpagui_install: True
50  
51    lp_apparmor: True, lp_apparmor_install: False, lp_apparmor_enable: False, lp_apparmor_service: apparmor,
52    lp_auto_upgrades: True, lp_auto_upgrades_install: UNDEFINED, lp_auto_upgrades_enable: False, lp_auto_upgrades_service: unattended-upgrades,
53    lp_autofs: True, lp_autofs_install: False, lp_autofs_enable: False, lp_autofs_service: autofs,
54    lp_bluetooth: True, lp_bluetooth_install: UNDEFINED, lp_bluetooth_enable: True, lp_bluetooth_service: bluetooth,
55    lp_chrony: True, lp_chrony_install: True, lp_chrony_enable: True, lp_chrony_service: chrony,
56    lp_dnsmasq: False, lp_dnsmasq_install: False, lp_dnsmasq_enable: False, lp_dnsmasq_service: dnsmasq,
57    lp_gpsd: True, lp_gpsd_install: True, lp_gpsd_enable: False, lp_gpsd_service: gpsd,
58    lp_libvirt: False, lp_libvirt_install: False, lp_libvirt_enable: UNDEFINED, lp_libvirt_service: UNDEFINED,
59    lp_modemmanager: True, lp_modemmanager_install: UNDEFINED, lp_modemmanager_enable: False, lp_modemmanager_service: ModemManager,
60    lp_networkd: True, lp_networkd_install: False, lp_networkd_enable: True, lp_networkd_service: systemd-networkd.service,
61    lp_nfsd: True, lp_nfsd_install: True, lp_nfsd_enable: False, lp_nfsd_service: UNDEFINED,
62    lp_nm: True, lp_nm_install: False, lp_nm_enable: False, lp_nm_service: UNDEFINED,
63    lp_postfix: True, lp_postfix_install: True, lp_postfix_enable: True, lp_postfix_service: postfix,
64    lp_resolvconf: True, lp_resolvconf_install: True, lp_resolvconf_enable: True, lp_resolvconf_service: resolvconf,
65    lp_smart: True, lp_smart_install: True, lp_smart_enable: True, lp_smart_service: smartmontools,
66    lp_speechd: True, lp_speechd_install: UNDEFINED, lp_speechd_enable: False, lp_speechd_service: speech-dispatcher,
67    lp_sshd: True, lp_sshd_install: UNDEFINED, lp_sshd_enable: True, lp_sshd_service: ssh,
68    lp_timesyncd: False, lp_timesyncd_install: UNDEFINED, lp_timesyncd_enable: False, lp_timesyncd_service: systemd-timesyncd.service,
69    lp_udev: True, lp_udev_install: UNDEFINED, lp_udev_enable: True, lp_udev_service: udev,
70    lp_ufw: True, lp_ufw_install: False, lp_ufw_enable: True, lp_ufw_service: ufw,
71  
72    lp_tlp: True, lp_tlp_install: False, lp_tlp_enable: True,
73    services:
74    - tlp
75    lp_virtualbox: False, lp_virtualbox_install: False, lp_virtualbox_enable: False,
76    services:
77    - vboxautostart-service
78    - vboxballoonctrl-service
79    - vboxdrv.service
80    - vboxweb-service
81  
82    lp_wpasupplicant: True, lp_wpasupplicant_install: True
83    lp_xen: True lp_xen_install: True
84    lp_zeitgeist: False, lp_zeitgeist_install: True
85    lp_zfs: True, lp_zfs_install: False
86    [WIP] lp_snap: False, lp_snap_install: False, lp_snap_enable: False

Note

The debug output of this role is optimized for the yaml callback plugin. Set this plugin, for example, in the environment shell> export ANSIBLE_STDOUT_CALLBACK=yaml.

Display lists of subsystems

If you enable the variables below either in the configuration or in the command

lp_tasks_enabled_print: true
lp_tasks_disabled_print: true

the output will include the lists of enabled and disabled subsystems. By default, all subsystems are disabled

TASK [vbotka.linux_postinstall : Debug] ******************************
ok: [srv.example.com] => 
  msg: |-

    ...
    
    lp_tasks_enabled: []
    lp_tasks_disabled: ['lp_acpi', 'lp_aliases', 'lp_apparmor',
    'lp_apt', 'lp_auto_upgrades', 'lp_autofs', 'lp_bluetooth',
    'lp_chrony', 'lp_debsums', 'lp_dnsmasq', 'lp_gpg', 'lp_gpsd',
    'lp_grub', 'lp_iptables', 'lp_kvm', 'lp_latex', 'lp_libvirt',
    'lp_lid', 'lp_logrotate', 'lp_modemmanager', 'lp_netplan',
    'lp_networkd', 'lp_nfsd', 'lp_packages_auto', 'lp_passwords',
    'lp_postfix', 'lp_rc_local', 'lp_reboot', 'lp_resolvconf',
    'lp_smart', 'lp_snap', 'lp_speechd', 'lp_ssh', 'lp_sshd',
    'lp_swap', 'lp_systemd', 'lp_timesyncd', 'lp_timezone', 'lp_tlp',
    'lp_udev', 'lp_ufw', 'lp_virtualbox', 'lp_wpagui',
    'lp_wpasupplicant', 'lp_xen', 'lp_xorg', 'lp_zeitgeist', 'lp_zfs']

    ...

Note

See the defaults of the variables lp_tasks_* in the file defaults/main/common.yml.

Debug subsystems

Most of the subsystems will display additional information when debug is enabled. For example, enable both the sshd subsystem and its debug output either in the configuration,

lp_sshd: true
lp_sshd_debug: true

, or in the command by setting the extra variables

shell> ansible-playbook lp.yml -e lp_sshd=true -e lp_sshd_debug=true -t lp_sshd_debug

The above command, limited by the tag -t lp_sshd_debug, will run the single task and display the values of the lp_sshd_* variables

TASK [vbotka.linux_postinstall : sshd: Debug] ************************
ok: [srv.example.com] => 
  msg: |-
    lp_sshd_enable: False
    lp_sshd_config_remove_duplicates: False
    lp_sshd_config:
      []