Created
December 17, 2014 19:19
-
-
Save carlossg/f90ad5de5ef56ca4f5ec to your computer and use it in GitHub Desktop.
ansible maven
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ansible/centos7-ansible:stable | |
# or, for example, FROM ansible/ubuntu14.04-ansible:stable | |
RUN yum install -y tar | |
RUN ansible-galaxy install geerlingguy.java | |
RUN ansible-galaxy install https://github.com/silpion/ansible-maven.git | |
# Add playbooks to the Docker image | |
COPY site.yml / | |
# Run Ansible to configure the Docker image | |
RUN ansible-playbook site.yml -c local | |
COPY mvn.yml / | |
# cache Maven repo files | |
RUN mvn org.apache.maven.plugins:maven-dependency-plugin:get || true | |
# The maven execution | |
RUN ansible-playbook -v mvn.yml -c local |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- hosts: localhost | |
vars: | |
mvn_artifacts: | |
- id: org.apache.maven:maven-core:2.2.1:jar:sources | |
dest: /tmp/test.jar | |
# repos: | |
# - http://repo1.maven.apache.org/maven2 | |
tasks: | |
- name: copy maven artifacts | |
command: mvn org.apache.maven.plugins:maven-dependency-plugin:get -Dartifact={{ item.id }} -Ddest={{ item.dest }} -Dtransitive=false -Pansible-maven -DremoteRepositories={{ item.repos | default(['http://repo1.maven.apache.org/maven2']) | join(",") }} | |
with_items: mvn_artifacts | |
register: mvn |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- hosts: localhost | |
roles: | |
- { role: ansible-maven } | |
- { role: geerlingguy.java } | |
vars: | |
java_packages: | |
- java-1.7.0-openjdk |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment