community.general.alternatives (1.3.14) — module

Manages alternative programs for common commands

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

Install collection

Install with ansible-galaxy collection install community.general:==1.3.14


Add to requirements.yml

  collections:
    - name: community.general
      version: 1.3.14

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
  community.general.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
  community.general.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
  community.general.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