fernandrone.intellij
Ansible Role: IntelliJ
This Ansible Role helps you download, install, and configure the IntelliJ IDEA Integrated Development Environment (IDE). You can find more about IntelliJ IDEA at JetBrains.
Note: If you want to install specific IntelliJ plugins conditionally, check our related role: fernandrone.intellij-plugins.
Requirements
- Ansible version 2.8 or higher
- One of the following Linux distributions:
- Debian Family (e.g., Ubuntu 18.04 or 20.04)
- RedHat Family (e.g., Rocky Linux 8)
- macOS (Intel or M1)
- Java Development Kit (JDK)
- You need to install both the JDK and its source.
- If using Java version greater than 9, you must also install the jmods.
- Apache Maven
Role Variables
Here are some important variables you can use to customize the role:
intellij_version: '2021.2.3' # Version of IntelliJ IDEA
intellij_mirror: 'http://download.jetbrains.com/idea' # Where to download IntelliJ from
intellij_edition: community # Choose 'community' or 'ultimate'
intellij_force: true # If set to false, skips installation if already installed
intellij_install_dir: /opt/idea/idea-{{ intellij_edition }}-{{ intellij_version }} # Installation directory
intellij_default_maven_home: '{{ ((((ansible_local | default(dict())).maven | default(dict())).general | default(dict())).home | default(None)) }}' # Default Maven location
intellij_plugin_manager_url: 'https://plugins.jetbrains.com/pluginManager/' # URL for plugin manager
users: [] # List of users to configure
intellij_download_dir: "{{ x_ansible_download_dir | default(ansible_env.HOME + '~/.ansible/tmp/downloads') }}" # Download directory
intellij_idea_download_timeout_seconds: 600 # Download timeout
Users Configuration
You define users with configurations such as specific JDKs, disabled plugins, and code styles:
users:
- username: # User's Unix name
intellij_group: # Optional group name for user files
intellij_jdks: # JDKs for the user
- name: # JDK name
home: # JDK home path
intellij_default_jdk: # Default JDK for new projects
intellij_disabled_plugins: # List of plugin IDs to disable
intellij_codestyles: # Code styles for the user
- name: # Name of the code style
url: # URL to codestyle XML
intellij_default_codestyle: # Default codestyle name
intellij_inspection_profiles: # Inspection profiles for the user
- name: # Name of the profile
url: # URL to inspection profile XML
intellij_default_inspection_profile: # Default inspection profile name
intellij_plugins: # List of plugin IDs to install
intellij_license_key_path: # Path to IntelliJ license key for Ultimate Edition
Warning: The method for installing additional plugins is still experimental.
Supported IntelliJ Versions
This role works with the following IntelliJ IDEA versions without extra setup:
2021.2.3
2021.2.2
2021.2.1
- Various other versions down to
2016.1.1
.
Advanced Configuration
If you want to use a version of IntelliJ not listed, you need to specify the SHA256 checksum for its redistributable package.
IntelliJ Plugin IDs
To find available plugin IDs, perform the following:
- Open IntelliJ and navigate to
File > Settings > Plugins > Browse repositories...
. Save the XML file. - Install XmlStarlet on your system.
- Run a command in the terminal to extract plugin names and IDs from the XML file.
Example Playbooks
Here's a simple playbook to set up IntelliJ:
- hosts: servers
roles:
- role: fernandrone.intellij
And here's a more detailed example with user-specific configurations:
- hosts: servers
roles:
- role: fernandrone.intellij
intellij_default_maven_home: '/opt/maven/apache-maven-3.3.9'
users:
- username: vagrant
intellij_jdks:
- name: '1.8'
home: '/usr/lib/jvm/java-8-openjdk-amd64'
intellij_default_jdk: '1.8'
intellij_disabled_plugins:
- org.jetbrains.plugins.gradle
intellij_plugins:
- CheckStyle-IDEA
Role Facts
This role makes several facts available for other roles, such as installation paths and user config directories.
More Roles
For more roles, check Ansible Galaxy.
Development & Testing
This project uses Molecule for development and testing with Ansible. Make sure to install necessary packages like Docker, Python, and Ansible.
To test the role, run:
./moleculew test
License
MIT License
Author Information
John Freeman
GantSign Ltd. (Company No. 06109112 in England)
Role for installing the IntelliJ IDEA IDE.
ansible-galaxy install fernandrone.intellij