Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

ansible set hostname from facts

- name: Set proper hostname
  hostname:
    #name: hostvars[inventory_hostname].ansible_host
    name: "{{ hostvars[inventory_hostname].ansible_host }}"
  become: yes
  when:
    - ansible_facts['os_family'] == 'Suse'
 
PREVIOUS NEXT
Tagged: #ansible #set #hostname #facts
ADD COMMENT
Topic
Name
3+9 =