diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..723ef36 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..36bbf62 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,29 @@ +--- +language: python +python: "2.7" + +# Use the new container infrastructure +sudo: false + +# Install ansible +addons: + apt: + packages: + - python-pip + +install: + # Install ansible + - pip install ansible + + # Check ansible version + - ansible --version + + # Create ansible.cfg with correct roles_path + - printf '[defaults]\nroles_path=../' >ansible.cfg + +script: + # Basic role syntax check + - ansible-playbook tests/test.yml -i tests/inventory --syntax-check + +notifications: + webhooks: https://galaxy.ansible.com/api/v1/notifications/ \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..b25e80c --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,10 @@ +# Change Log +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/) +and this project adheres to [Semantic Versioning](http://semver.org/). + + +## [1.0.0] +### Changed +- initial commit \ No newline at end of file diff --git a/LICENSE b/LICENSE index 406c798..77a2629 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ -MIT License +The MIT License (MIT) -Copyright (c) 2017 Jeff Tunessen +Copyright (c) 2016 Jeff Tunessen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 5211bdc..78ab9ac 100644 --- a/README.md +++ b/README.md @@ -1 +1,36 @@ -# ansible-role-docker-compose \ No newline at end of file +# Ansible Role - Docker Compose + +[![Build Status](https://travis-ci.org/elnebuloso/ansible-role-docker-compose.svg?branch=master)](https://travis-ci.org/elnebuloso/ansible-role-docker-compose) + +## Requirements + +This role requires Ansible 2.0 or higher, and platform requirements are listed in the metadata file. + +## Supported Distributions + +- ubuntu14 +- ubuntu16 + +## Role Variables + +- [`defaults/main.yml`](https://github.com/elnebuloso/ansible-role-docker-compose/blob/master/defaults/main.yml) + +## Example Playbook + +``` +- hosts: localhost + roles: + - role: elnebuloso.docker-compose +``` + +## Dependencies + +None. + +## License + +MIT + +## Author Information + +This role was created in 2016 by [elnebuloso](https://github.com/elnebuloso/) \ No newline at end of file diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..afaf360 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +1.0.0 \ No newline at end of file diff --git a/defaults/main.yml b/defaults/main.yml new file mode 100644 index 0000000..0065784 --- /dev/null +++ b/defaults/main.yml @@ -0,0 +1,2 @@ +--- +docker_compose_version: "1.17.1" \ No newline at end of file diff --git a/meta/main.yml b/meta/main.yml new file mode 100644 index 0000000..7375bdb --- /dev/null +++ b/meta/main.yml @@ -0,0 +1,16 @@ +galaxy_info: + author: elnebuloso + description: docker compose + license: license (MIT) + + min_ansible_version: 2.0 + + platforms: + - name: Ubuntu + versions: + - trusty + - xenial + + galaxy_tags: [] + +dependencies: [] \ No newline at end of file diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..506e4aa --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,44 @@ +--- +- name: "check for installed docker-compose binary" + stat: path=/usr/local/bin/docker-compose + register: docker_compose_check_bin + changed_when: false + +- name: "check for installation" + set_fact: docker_compose_installed_version="no version installed" + changed_when: false + +- name: "check if docker-compose {{docker_compose_version}} is installed" + command: docker-compose --version + register: docker_compose_check_installed + when: docker_compose_check_bin.stat.exists == true + changed_when: false + +- name: "check docker-compose version" + set_fact: docker_compose_installed_version="{{docker_compose_check_installed.stdout}}" + when: docker_compose_check_installed.stdout is defined + changed_when: false + +- name: "check docker-compose version" + debug: + msg: "{{docker_compose_installed_version}}" + +- name: "check kernel (system) for correct docker-compose installation" + shell: echo $(uname -s) + register: docker_compose_uname_kernel_system + changed_when: false + when: 'docker_compose_version not in docker_compose_installed_version' + +- name: "check kernel (machine) for correct docker-compose installation" + shell: echo $(uname -m) + register: docker_compose_uname_kernel_machine + changed_when: false + when: 'docker_compose_version not in docker_compose_installed_version' + +- name: "install docker-compose" + get_url: + url: "https://github.com/docker/compose/releases/download/{{docker_compose_version}}/docker-compose-{{docker_compose_uname_kernel_system.stdout}}-{{docker_compose_uname_kernel_machine.stdout}}" + dest: /usr/local/bin/docker-compose + mode: 0755 + force: yes + when: 'docker_compose_version not in docker_compose_installed_version' \ No newline at end of file diff --git a/tests/inventory b/tests/inventory new file mode 100644 index 0000000..d18580b --- /dev/null +++ b/tests/inventory @@ -0,0 +1 @@ +localhost \ No newline at end of file diff --git a/tests/test.yml b/tests/test.yml new file mode 100644 index 0000000..697bf32 --- /dev/null +++ b/tests/test.yml @@ -0,0 +1,5 @@ +--- +- hosts: localhost + remote_user: root + roles: + - role: ansible-role-docker-compose \ No newline at end of file