community / community.general / 8.5.0 / module / alternatives Manages alternative programs for common commands Authors: Marius Rieder (@jiuka), David Wittman (@DavidWittman), Gabe Mulley (@mulby)community.general.alternatives (8.5.0) — module
Install with ansible-galaxy collection install community.general:==8.5.0
collections: - name: community.general version: 8.5.0
Manages symbolic links using the 'update-alternatives' tool.
Useful when multiple programs are installed but provide similar functionality (e.g. different editors).
- name: Correct java version selected community.general.alternatives: name: java path: /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
- name: Alternatives link created community.general.alternatives: name: hadoop-conf link: /etc/hadoop/conf path: /etc/hadoop/conf.ansible
- 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
- name: Install Python 3.5 but do not select it community.general.alternatives: name: python path: /usr/bin/python3.5 link: /usr/bin/python state: present
- name: Install Python 3.5 and reset selection to auto community.general.alternatives: name: python path: /usr/bin/python3.5 link: /usr/bin/python state: auto
- name: keytool is a subcommand of java community.general.alternatives: name: java link: /usr/bin/java path: /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java subcommands: - name: keytool link: /usr/bin/keytool path: /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/keytool
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 O(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 state: choices: - present - selected - auto - absent default: selected description: - V(present) - install the alternative (if not already installed), but do not set it as the currently selected alternative for the group. - V(selected) - install the alternative (if not already installed), and set it as the currently selected alternative for the group. - V(auto) - install the alternative (if not already installed), and set the group to auto mode. Added in community.general 5.1.0. - V(absent) - removes the alternative. Added in community.general 5.1.0. type: str version_added: 4.8.0 version_added_collection: community.general priority: description: - The priority of the alternative. If no priority is given for creation V(50) is used as a fallback. type: int subcommands: aliases: - slaves description: - A list of subcommands. - Each subcommand needs a name, a link and a path parameter. - Subcommands are also named 'slaves' or 'followers', depending on the version of alternatives. elements: dict suboptions: link: description: - The path to the symbolic link that should point to the real subcommand executable. required: true type: path name: description: - The generic name of the subcommand. required: true type: str path: description: - The path to the real executable that the subcommand should point to. required: true type: path type: list version_added: 5.1.0 version_added_collection: community.general