Tags

The tags provide the user with a very useful 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_authorized_key, fp_authorized_key_debug,
    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_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_getconf, 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_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_syslogd, 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_debug, 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_ntpdate, fp_packages, fp_packages_debug, 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_qemu,
    fp_qemu_rcconf, fp_resolv_conf, fp_resolv_conf_absent,
    fp_resolvconf, fp_resolvconf_conf, fp_resolvconf_conf_absent,
    fp_sanity_debug, fp_smartd, fp_smartd_conf, fp_smartd_rcconf,
    fp_snmpd, fp_snmpd_conf, fp_snmpd_conf_copy, fp_snmpd_rcconf,
    fp_ssh, fp_ssh_config, fp_ssh_debug, fp_sshd, fp_sshd_config,
    fp_sshd_debug, fp_sshd_rcconf, fp_sudoers, fp_swap,
    fp_swap_debug, fp_sysctl, fp_syslogd, fp_syslogd_conf,
    fp_syslogd_conf_orig, fp_syslogd_confd, fp_syslogd_debug,
    fp_syslogd_newconf, fp_syslogd_newconf_orig,
    fp_syslogd_newconfd, fp_syslogd_rcconf, fp_timezone,
    fp_timezone_debug, fp_tmpmfs, fp_tmpmfs_debug,
    fp_tmpmfs_rcconf, fp_users, fp_users_debug, 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