I am having issues formatting a role, I am trying to use register: and debug. Can anyone show the the formatting for debugging roles with register in ansible.
This is not working in a role:
-
name: Generate Hostnames for AD Group Names
-
debug:
msg: “before we run our role”
set_fact:
server_hostname: “{{ server_hostname }} + [ ‘{{ item.0.server_category + item.1.server_numbers + location.short + ‘V’ }}’ ]”
domain_controller_group: “{{ server_specs.0.win_domain|lower}}DC”
domain_controller: “{{ hostvars[groups[server_specs.0.win_domain|lower + ‘DC’][0]][‘ansible_host’] }}”
with_subelements: -
“{{ server_specs }}”
-
server_numbers_subnet
register: domain -
debug:
msg: “after we run our role”
var: domain
verbosity: 2