Tags

The tags provide the user with a powerful tool to run selected groups of tasks. Use the command below to display available tags.

shell> ansible-playbook playbook.yml --list-tags

playbook: playbook.yml

play #1 (test_14.example.com): test_14.example.com   TAGS: []

    TASK TAGS: [always, fp_aliases, fp_apcupsd, fp_apcupsd_conf,
    fp_apcupsd_rcconf, fp_apcupsd_service, fp_authorized_key,
    fp_cloud_proividers, fp_copy, fp_copy_debug, fp_copy_sync_default,
    fp_copy_sync_optional, fp_copy_unarch_default, fp_copy_unarch_optional,
    fp_cron, fp_cron_debug, fp_cron_rename_entries,
    fp_cron_rename_entries_system, fp_cron_tab, fp_cron_tab_system,
    fp_cron_var, fp_cron_var_system, fp_debug, fp_devfs, fp_devfs_conf,
    fp_devfs_debug, fp_devfs_rcconf, fp_devfs_rcvar, fp_devfs_rules,
    fp_devfs_service, fp_dhclient, fp_dhclient_conf_blocks,
    fp_dhclient_conf_create, fp_dhclient_conf_defaults, fp_dhclient_debug,
    fp_dhclient_ifn_leases, fp_dhclient_ifn_rcconf, fp_dhclient_sanity,
    fp_do, fp_do_debug, fp_do_defaul_user_remove, fp_do_hostname_rcconf,
    fp_do_rcconf, fp_freebsd_update, fp_freebsd_update_conf,
    fp_freebsd_update_conf_orig, fp_freebsd_update_debug,
    fp_freebsd_update_protect_keyprint, fp_freebsd_update_sanity, fp_fstab,
    fp_gitserver, fp_gitserver_dir, fp_gitserver_group, fp_gitserver_owner,
    fp_groups, fp_groups_conf, fp_groups_debug, fp_groupwrappers,
    fp_groupwrappers_dir, fp_groupwrappers_groupadd,
    fp_groupwrappers_groupdel, fp_groupwrappers_groupmod, fp_hostapd,
    fp_hostapd_conf, fp_hostapd_rcconf, fp_hostapd_service, fp_hostname,
    fp_hosts, fp_hosts_conf, fp_hosts_debug, fp_hosts_sanity, fp_inetd,
    fp_inetd_conf_orig, fp_inetd_debug, fp_inetd_hosts_allow,
    fp_inetd_hosts_allow_orig, fp_inetd_logfile, fp_inetd_rcconf,
    fp_inetd_service, fp_inetd_syslogd, fp_inetd_syslogd_newconfd, fp_libmap,
    fp_linux, fp_linux_debug, fp_linux_fstab, fp_linux_lib_copy,
    fp_linux_lib_dir, fp_linux_lib_link, fp_linux_rcconf, fp_loader,
    fp_loader_conf, fp_loader_conf_file_backup_orig, fp_loader_debug,
    fp_loader_load_modules, fp_loader_tuneables_warning, fp_login, fp_make,
    fp_make_conf, fp_make_debug, fp_motd, fp_motd_create, fp_motd_rcconf,
    fp_mount_img, fp_mount_img_debug, fp_mount_iso, fp_mount_iso_debug,
    fp_nfs, fp_nfs_debug, fp_nfs_disable, fp_nfs_enable, fp_nfs_services,
    fp_nfsd, fp_nfsd_debug, fp_nfsd_disable, fp_nfsd_enable, fp_nfsd_exports,
    fp_nfsd_services, fp_ntp, fp_ntp_conf, fp_ntp_rcconf, fp_ntp_service,
    fp_ntpdate, fp_packages, fp_packages_links, fp_passwords,
    fp_passwords_debug, fp_passwords_passwordstore, fp_periodic,
    fp_periodic_conf_local, fp_periodic_debug, fp_procmail, fp_procmail_dir,
    fp_procmail_forwarders, fp_procmail_includerc, fp_procmail_procmailrc,
    fp_procmail_rc, fp_qemu, fp_qemu_rcconf, fp_qemu_service, fp_resolv_conf,
    fp_resolv_conf_absent, fp_resolvconf, fp_resolvconf_conf,
    fp_resolvconf_conf_absent, fp_sanity_debug, fp_sanity_tags, fp_smartd,
    fp_smartd_conf, fp_smartd_rcconf, fp_smartd_service, fp_snmpd,
    fp_snmpd_conf, fp_snmpd_rcconf, fp_snmpd_service, fp_ssh, fp_ssh_config,
    fp_ssh_debug, fp_sshd, fp_sshd_config, fp_sshd_debug, fp_sshd_rcconf,
    fp_sshd_service, fp_sudoers, fp_swap, fp_swap_debug, fp_swap_disable,
    fp_swap_enable, fp_sysctl, fp_sysctl_conf, fp_sysctl_debug,
    fp_sysctl_tuneables_warning, fp_syslogd, fp_syslogd_conf,
    fp_syslogd_debug, fp_syslogd_newconfd, fp_syslogd_rcconf,
    fp_syslogd_service, fp_timezone, fp_timezone_debug, fp_tmpmfs,
    fp_tmpmfs_debug, fp_tmpmfs_rcconf, fp_users, fp_users_debug, fp_vars,
    fp_vars_default_versions, fp_wpasupplicant, fp_wpasupplicant_conf,
    fp_wpasupplicant_conf_file_link, fp_wpasupplicant_conf_rc,
    fp_wpasupplicant_debug, fp_wpasupplicant_rcconf]

For example,

  • enable debug and display the list of the control variables and their values

shell> ansible-playbook playbook.yml -t fp_debug -e fp_debug=true
  • See what packages will be installed

shell> ansible-playbook playbook.yml -t fp_packages -e fp_install=true --check
  • Install the packages

shell> ansible-playbook playbook.yml -t fp_packages -e fp_install=true

Validity

The role is testing the tags validity. The tests are enabled by default

fp_sanity: true
fp_sanity_tags_fatal: true

The role will fail if you use unknown tag. For example,

shell> ansible-playbook playbook.yml -t unknown_tag
...
TASK [vbotka.freebsd_postinstall : Sanity: Unknown run tags] ************************************
fatal: [test_14.example.com]: FAILED! => changed=false
msg: '[ERR] Unknown run tag(s): [''unknown_tag'']'

Note

The list of all tags fp_sanity_tags is stored in defaults/main/sanity_tags.yml. The file is generated by the playbook .configure.yml. If you modify the tags feel free to update fp_sanity_tags.