Skip to content

Commit

Permalink
Merge pull request #17 from idealista/develop
Browse files Browse the repository at this point in the history
v1.1.0 to master
  • Loading branch information
José Noguera authored Jan 14, 2019
2 parents f0a0134 + f184713 commit 87634f8
Show file tree
Hide file tree
Showing 34 changed files with 388 additions and 151 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
build:
docker:
- image: circleci/python:2.7.15-stretch
working_directory: ~/jira-role
working_directory: ~/jira_role

steps:
- checkout
Expand All @@ -16,4 +16,4 @@ jobs:
- run:
name: run tests
command: |
molecule test --driver docker
molecule test
7 changes: 3 additions & 4 deletions .circleci/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
ansible==2.4.3.0
molecule==1.25.0
ansible-lint==3.4.20
docker
ansible==2.4.5.0
molecule==2.10.1
docker-py==1.10.6
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
Have you read Idealista's Code of Conduct? By filling an Issue, you are expected to comply with it,
including treating everyone with respect: https://github.com/idealista/idealista/blob/master/CODE_OF_CONDUCT.md
including treating everyone with respect: https://github.com/idealista/jira_role/blob/master/.github/CODE_OF_CONDUCT.md
-->

Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
*.molecule
*.cache
*.vagrant

# Pipenv
Pipfile*
16 changes: 16 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
extends: default

rules:
braces:
max-spaces-inside: 1
level: error
brackets:
max-spaces-inside: 1
level: error
line-length: disable
# NOTE(retr0h): Templates no longer fail this lint rule.
# Uncomment if running old Molecule templates.
# truthy: disable

ignore: |
tests/
25 changes: 19 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,23 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a changelog](https://github.com/olivierlacan/keep-a-changelog).

## [Unreleased](https://github.com/idealista/jira-role/tree/develop)
## [Unreleased](https://github.com/idealista/jira_role/tree/develop)

## [1.1.0](https://github.com/idealista/jira_role/tree/1.1.0)
[Full Changelog](https://github.com/idealista/jira_role/compare/1.0.2...1.1.0)

### Added
- [#4](https://github.com/idealista/jira_role/issues/4) *Ability to configure and use a different DB engine than Oracle / Oracle10g. Full example provided for MySQL* @mmolinac

### Changed
- *[#11](https://github.com/idealista/jira_role/issues/11) Molecule v2 upgrade* @jperera

### Fixed
- *[#5](https://github.com/idealista/jira_role/issues/5) Using new Idealista's Java Role version to avoid 404 Java installation issue* @jperera

## [1.0.2](https://github.com/idealista/jira_role/tree/1.0.2)
[Full Changelog](https://github.com/idealista/jira_role/compare/1.0.1...1.0.2)

## [1.0.2](https://github.com/idealista/jira-role/tree/1.0.2)
[Full Changelog](https://github.com/idealista/jira-role/compare/1.0.1...1.0.2)
### Added
- *Added CircleCI integration* @jnogol

Expand All @@ -16,10 +29,10 @@ This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a ch
### Fixed
- *Using new Idealista's Java Role version to avoid 404 Java installation issue* @jnogol

## [1.0.1](https://github.com/idealista/jira-role/tree/1.0.1)
[Full Changelog](https://github.com/idealista/jira-role/compare/1.0.0...1.0.1)
## [1.0.1](https://github.com/idealista/jira_role/tree/1.0.1)
[Full Changelog](https://github.com/idealista/jira_role/compare/1.0.0...1.0.1)
### Fixed
- *Using new Idealista's Java Role version to avoid 404 Java installation issue* @jnogol

## [1.0.0](https://github.com/idealista/jira-role/tree/1.0.0)
## [1.0.0](https://github.com/idealista/jira_role/tree/1.0.0)
- *First version*
31 changes: 13 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![Logo](https://raw.githubusercontent.com/idealista/jira-role/master/logo.gif)
![Logo](https://raw.githubusercontent.com/idealista/jira_role/master/logo.gif)

[![Build Status](https://travis-ci.org/idealista/jira-role.png)](https://travis-ci.org/idealista/jira-role)
[![CircleCI](https://circleci.com/gh/idealista/jira_role.svg?style=svg)](https://circleci.com/gh/idealista/jira_role)

# Jira Ansible role

Expand All @@ -23,17 +23,17 @@ These instructions will get you a copy of the role for your Ansible playbook. On

### Prerequisities

Ansible 2.3.1.0 version installed.
Ansible 2.4.5.0 version installed.
Inventory destination should be a Debian environment.

For testing purposes, [Molecule](https://molecule.readthedocs.io/) (version 1.25) with [Vagrant](https://www.vagrantup.com/) as driver (with [landrush](https://github.com/vagrant-landrush/landrush) plugin) and [VirtualBox](https://www.virtualbox.org/) or [Docker](https://www.docker.com/) as provider.
For testing purposes, [Molecule](https://molecule.readthedocs.io/) with [Docker](https://www.docker.com/) as driver.

### Installing

Create or add to your roles dependency file (e.g requirements.yml):

``` yml
- src: idealista.jira-role
- src: idealista.jira_role
version: 1.0.0
name: jira
```
Expand All @@ -57,39 +57,34 @@ Use in a playbook:
Look to the [defaults](defaults/main.yml) properties file to see the possible configuration properties.
## Testing
There are some variables in [vars](vars) folder that help with the database configuration. Overriding them could be a bit difficult due to [Ansible variable precedence](https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html#variable-precedence-where-should-i-put-a-variable) so, in case you need to set new values, our recommendation is to have a `vars` folder in your playbook folder, put there a vars file with your preferred values and include them in your main playbook with [include_vars](https://docs.ansible.com/ansible/latest/modules/include_vars_module.html).

### Using Vagrant as provider
```
molecule test
```
## Testing

### Using Docker as provider
```
molecule test --driver docker
```sh
$ pipenv install -r test-requirements.txt --python 2.7
$ pipenv run molecule test
```

See molecule.yml to check possible testing platforms. As a reminder, our tests are just compatible with Molecule 1.x

## Built With

![Ansible](https://img.shields.io/badge/ansible-2.3.1.0-green.svg)

## Versioning

For the versions available, see the [tags on this repository](https://github.com/idealista/jira-role/tags).
For the versions available, see the [tags on this repository](https://github.com/idealista/jira_role/tags).

Additionaly you can see what change in each version in the [CHANGELOG.md](CHANGELOG.md) file.

## Authors

* **Idealista** - *Work with* - [idealista](https://github.com/idealista)

See also the list of [contributors](https://github.com/idealista/jira-role/contributors) who participated in this project.
See also the list of [contributors](https://github.com/idealista/jira_role/contributors) who participated in this project.

## License

![Apache 2.0 Licence](https://img.shields.io/hexpm/l/plug.svg)
![Apache 2.0 License](https://img.shields.io/hexpm/l/plug.svg)

This project is licensed under the [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0) license - see the [LICENSE](LICENSE) file for details.

Expand Down
9 changes: 9 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ jira_database_configuration: false
# - {src: files/your_file.properties, dest: jira_home/your_file.properties, mode: 0644}
# Sample jira_extra_template_files:
# - {src: templates/your_template.properties, dest: jira_home/your_template.properties, mode: 0644}
# Sample MySQL JDBC configuration:
# jira_database_configuration: true
# jira_database_type: 'mysql'
# jira_database_driver_class: 'com.mysql.jdbc.Driver'
# jira_database_username: 'jirauser'
# jira_database_password: 'XXXXXX'
# jira_database_host: 'localhost'
# jira_database_port: 3306
# jira_database_name: 'jiradb'

# Service
jira_service_name: jira
Expand Down
2 changes: 1 addition & 1 deletion meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
galaxy_info:
company: Idealista S.A.U.
description: Jira role
min_ansible_version: 2.3.1.0
min_ansible_version: 2.4.5.0
license: Apache 2.0
platforms:
- name: Debian
Expand Down
79 changes: 0 additions & 79 deletions molecule.yml

This file was deleted.

13 changes: 13 additions & 0 deletions molecule/default/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Molecule managed

{% if item.registry is defined %}
FROM {{ item.registry.url }}/{{ item.image }}
{% else %}
FROM {{ item.image }}
{% endif %}

RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && zypper install -y python sudo bash python-xml && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; fi
16 changes: 16 additions & 0 deletions molecule/default/INSTALL.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
*******
Install
*******

Requirements
============

* Docker Engine
* docker-py

Install
=======

.. code-block:: bash
$ sudo pip install docker-py
69 changes: 69 additions & 0 deletions molecule/default/create.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
- name: Create
hosts: localhost
connection: local
gather_facts: false
no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}"
vars:
molecule_file: "{{ lookup('env', 'MOLECULE_FILE') }}"
molecule_ephemeral_directory: "{{ lookup('env', 'MOLECULE_EPHEMERAL_DIRECTORY') }}"
molecule_scenario_directory: "{{ lookup('env', 'MOLECULE_SCENARIO_DIRECTORY') }}"
molecule_yml: "{{ lookup('file', molecule_file) | molecule_from_yaml }}"
tasks:
- name: Create Dockerfiles from image names
template:
src: "{{ molecule_scenario_directory }}/Dockerfile.j2"
dest: "{{ molecule_ephemeral_directory }}/Dockerfile_{{ item.image | regex_replace('[^a-zA-Z0-9_]', '_') }}"
with_items: "{{ molecule_yml.platforms }}"
register: platforms

- name: Discover local Docker images
docker_image_facts:
name: "molecule_local/{{ item.item.name }}"
with_items: "{{ platforms.results }}"
register: docker_images

- name: Build an Ansible compatible image
docker_image:
path: "{{ molecule_ephemeral_directory }}"
name: "molecule_local/{{ item.item.image }}"
dockerfile: "{{ item.item.dockerfile | default(item.invocation.module_args.dest) }}"
force: "{{ item.item.force | default(true) }}"
with_items: "{{ platforms.results }}"
when: platforms.changed or docker_images.results | map(attribute='images') | select('equalto', []) | list | count >= 0

- name: Create docker network(s)
docker_network:
name: "{{ item }}"
state: present
with_items: "{{ molecule_yml.platforms | molecule_get_docker_networks }}"

- name: Create molecule instance(s)
docker_container:
name: "{{ item.name }}"
hostname: "{{ item.name }}"
image: "molecule_local/{{ item.image }}"
state: started
recreate: false
log_driver: json-file
command: "{{ item.command | default('bash -c \"while true; do sleep 10000; done\"') }}"
privileged: "{{ item.privileged | default(omit) }}"
volumes: "{{ item.volumes | default(omit) }}"
capabilities: "{{ item.capabilities | default(omit) }}"
exposed_ports: "{{ item.exposed_ports | default(omit) }}"
published_ports: "{{ item.published_ports | default(omit) }}"
ulimits: "{{ item.ulimits | default(omit) }}"
networks: "{{ item.networks | default(omit) }}"
dns_servers: "{{ item.dns_servers | default(omit) }}"
register: server
with_items: "{{ molecule_yml.platforms }}"
async: 7200
poll: 0

- name: Wait for instance(s) creation to complete
async_status:
jid: "{{ item.ansible_job_id }}"
register: docker_jobs
until: docker_jobs.finished
retries: 300
with_items: "{{ server.results }}"
Loading

0 comments on commit 87634f8

Please sign in to comment.