ansibleを使って、Ubuntu(Linux + GNOME)に、Eclipse 4.5(Mars)をインストールして、必要なEclipseプラグインを自動インストールするサンプル。
Eclipseプラグインは、削ったり追加したりしてやってください。リポジトリ(Update Site)も、プラグイン自体も、カンマ区切りです。
もっと、綺麗に書こうとすれば、書けるとは思う…
ちなみに、インストール先は、/opt/eclipse/配下にバージョン毎にディレクトリを作って、alternativesで、デフォルトを切り替えてます。
yaml
- hosts: 127.0.0.1
connection: local
become: yes
tasks:
- apt_repository: repo='ppa:webupd8team/java'
- name: Autoaccept license for Java8
debconf: name='oracle-java8-installer' question='shared/accepted-oracle-license-v1-1' value='true' vtype='select'
- name: Install Java
apt: name={{item}} state=latest
with_items:
- oracle-java8-installer
- ca-certificates
- oracle-java8-set-default
- stat: path=/opt/eclipse/eclipse/eclipse
register: installed_eclipse
- get_url: url=http://ftp.jaist.ac.jp/pub/eclipse/eclipse/downloads/drops4/R-4.5-201506032000/eclipse-platform-4.5-linux-gtk-x86_64.tar.gz dest=/tmp/eclipse-platform-4.5-linux-gtk-x86_64.tar.gz
when: (not installed_eclipse.stat.exists)
- file: path=/opt/eclipse state=directory
- unarchive: src=/tmp/eclipse-platform-4.5-linux-gtk-x86_64.tar.gz dest=/tmp
when: (not installed_eclipse.stat.exists)
- command: mv /tmp/eclipse /opt/eclipse/4.5
when: (not installed_eclipse.stat.exists)
- alternatives: name=eclipse link=/opt/eclipse/eclipse path=/opt/eclipse/4.5
when: (not installed_eclipse.stat.exists)
- command: /opt/eclipse/4.5/eclipse -nosplash -application org.eclipse.equinox.p2.director -repository http://download.eclipse.org/releases/mars,http://download.eclipse.org/eclipse/updates/4.5/,http://download.eclipse.org/egit/updates,http://update.eclemma.org/,http://beust.com/eclipse,http://www.nodeclipse.org/updates/markdown/,http://download.eclipse.org/buildship/updates/e45/releases/1.0,http://dl.bintray.com/ajermakovics/jmockit/,http://basti1302.github.com/startexplorer/update/,http://download.scala-ide.org/sdk/lithium/e44/scala211/stable/site,http://repo1.maven.org/maven2/.m2e/connectors/m2eclipse-egit/0.14.0/N/LATEST/,http://dadacoalition.org/yedit,http://eclipse-cs.sf.net/update/,http://ermaster.sourceforge.net/update-site/ -installIU org.eclipse.jdt.feature.group,org.eclipse.epp.mpc.feature.group,org.eclipse.m2e.feature.feature.group,org.eclipse.m2e.logback.feature.feature.group,org.eclipse.jgit.feature.group,org.eclipse.egit.feature.group,com.mountainminds.eclemma.feature.feature.group,org.testng.eclipse.feature.group,markdown.editor.feature.feature.group,JMockit_Eclipse_Plugin.feature.group,de.bastiankrol.startexplorer.feature.feature.group,org.scala-ide.sbt.feature.feature.group,org.scala-ide.scala211.feature.feature.group,org.scala-ide.sdt.feature.feature.group,org.eclipse.buildship.feature.group,org.sonatype.m2e.egit.feature.feature.group,org.dadacoalition.yedit.feature.feature.group,org.insightech.er.feature.feature.group,com.github.sevntu.checkstyle.checks.feature.feature.group,net.sf.eclipsecs.feature.group,org.eclipse.epp.logging.aeri.feature.feature.group,org.eclipse.linuxtools.docker.feature.feature.group,org.eclipse.linuxtools.javadocs.feature.feature.group -profile SDKProfile -profileProperties org.eclipse.update.install.features=true -p2.os linux -p2.ws gtk -p2.arch x86 -roaming
args:
chdir: /opt/eclipse/4.5
- file: path=/opt/eclipse state=directory owner=vagrant group=vagrant recurse=true
ちなみに、Gnomeのデスクトップエントリーは、こんな感じ。
eclipse.desktop
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Name=Eclipse
Icon=eclipse.png
Path=/opt/eclipse/eclipse
Exec=/opt/eclipse/eclipse/eclipse
StartupNotify=false
StartupWMClass=Eclipse
OnlyShowIn=Unity;
X-UnityGenerated=true
#Categories=GTK;GNOME;Programming
Categories=Application;Development;Programming
多分、インストール先とかダウンロード元とかをansible_distributionで切り替えてやれば、色んなプラットフォームに応用出来ると思う