diff --git a/README.md b/README.md index 1f318d7..72e58b9 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ For more information about variables marked with an asterisk please read the Cav | disable_banner | whether built-in nushell banner should be disabled | false | | nu_users | List of users for which config and plugins should be registered | [] | | add_hostname_to_prompt | Whether inventory hostname should be added to default prompt | false | +| nu_hostname | Hostname to add to prompt if `add_hostname_to_prompt` is true | inventory_hostname | | clear_login_file | Whether login.nu should be cleared of all non-commented lines | false | ## Plugin installation diff --git a/defaults/main.yml b/defaults/main.yml index bed10c8..0c40bb9 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -11,6 +11,7 @@ install_plugins: true install_configs: remote overwrite_configs: false add_hostname_to_prompt: false +nu_hostname: "{{ inventory_hostname }}" clear_login_file: false nu_plugins: - nu_plugin_custom_values diff --git a/tasks/configs.yml b/tasks/configs.yml index 40ebf20..d367647 100644 --- a/tasks/configs.yml +++ b/tasks/configs.yml @@ -133,7 +133,7 @@ ansible.builtin.lineinfile: path: "{{ item.homedir }}/{{ nushell_config_path }}/env.nu" regexp: "^.*PROMPT_INDICATOR.*$" - line: "{{ '$env.' if _nushell_version is version('0.83.0', '>=') else 'let-env ' }}PROMPT_INDICATOR = '({{ inventory_hostname }})〉'" + line: "{{ '$env.' if _nushell_version is version('0.83.0', '>=') else 'let-env ' }}PROMPT_INDICATOR = '({{ nu_hostname }})〉'" validate: "{{ nushell_binary_path }}/nu -n -c 'source %s; $env'" when: add_hostname_to_prompt|bool loop: "{{ home_dirs }}"