Skip to content

Instantly share code, notes, and snippets.

@carlossg
Created December 17, 2014 19:19
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carlossg/f90ad5de5ef56ca4f5ec to your computer and use it in GitHub Desktop.
Save carlossg/f90ad5de5ef56ca4f5ec to your computer and use it in GitHub Desktop.
ansible maven
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
- 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
- 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