Documentation

    PLEASE NOTE: This document applies to v2.18 version and not to the latest stable release v2.19

    Documentation for other releases can be found by using the version selector in the top right of any doc page.

    hostname

    Manage system hostname.

    Attributes

    check_mode:
      support: full
    

    Parameters

    Parameter Required Type Values Description
    name true string   Name of the host.
    use       Which strategy to use to update the hostname. If not set, auto-detects based on system capabilities.

    Example

    - name: Set hostname
      hostname:
        name: web01
    
    - name: Set hostname using systemd
      hostname:
        name: web01
        use: systemd
    
    - name: Set hostname from inventory
      hostname:
        name: "{{ inventory_hostname }}"