ansible.builtin.alternatives (v2.9.27) — module

Manages alternative programs for common commands

| "added in version" 1.6 of ansible.builtin"

Authors: David Wittman (@DavidWittman), Gabe Mulley (@mulby)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.27

Description

Manages symbolic links using the 'update-alternatives' tool.

Useful when multiple programs are installed but provide similar functionality (e.g. different editors).


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Correct java version selected
  alternatives:
    name: java
    path: /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Alternatives link created
  alternatives:
    name: hadoop-conf
    link: /etc/hadoop/conf
    path: /etc/hadoop/conf.ansible
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Make java 32 bit an alternative with low priority
  alternatives:
    name: java
    path: /usr/lib/jvm/java-7-openjdk-i386/jre/bin/java
    priority: -10

Inputs

    
link:
    description:
    - The path to the symbolic link that should point to the real executable.
    - This option is always required on RHEL-based distributions. On Debian-based distributions
      this option is required when the alternative I(name) is unknown to the system.
    type: path

name:
    description:
    - The generic name of the link.
    required: true
    type: str

path:
    description:
    - The path to the real executable that the link should point to.
    required: true
    type: path

priority:
    default: 50
    description:
    - The priority of the alternative.
    type: int
    version_added: '2.2'
    version_added_collection: ansible.builtin