Skip to content

Commit

Permalink
Version 1.2.0
Browse files Browse the repository at this point in the history
add new code
  • Loading branch information
sbaerlocher authored Dec 22, 2019
2 parents 81e43a1 + ee4c16a commit 6082d0c
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 13 deletions.
5 changes: 5 additions & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
extends: default
rules:
line-length:
max: 120
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
and [human-readable changelog](https://keepachangelog.com/en/1.0.0/).

## 1.2.0

### Added

- Add new version automatically detected
- Add .yamllint rule

## 1.1.1

### Fixed
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@ ansible-galaxy install sbaerlocher.wmi_exporter

## Role Variables

### Version and Architecture
### Version

Version and architecture of the wmi exporter to be installed.
The latest version of the wmi_exporter is automatically calculated if 'wmi_exporter_version' no set.

### Architecture

Architecture of the wmi exporter to be installed.

```yml
wmi_exporter_version: 0.7.0
wmi_exporter_architecture: amd64
```
Expand Down
7 changes: 5 additions & 2 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
---
# defaults file for sbaerlocher.wmi_exporter

# Version and architecture of the wmi exporter to be installed.
wmi_exporter_version: 0.7.0
# The latest version of the wmi_exporter is automatically
# calculated if 'wmi_exporter_version' no set.
# wmi_exporter_version: 0.9.0

# Architecture of the wmi exporter to be installed.
wmi_exporter_architecture: amd64

# Windows installation parameters for the wmi_exporter.
Expand Down
2 changes: 2 additions & 0 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ driver:
name: docker
lint:
name: yamllint
options:
config-file: .yamllint.yml
platforms:
- name: instance
image: 'geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest'
Expand Down
3 changes: 2 additions & 1 deletion tasks/install/choco.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@
win_chocolatey:
name: prometheus-wmi-exporter.install
proxy_url: '{{ wmi_exporter_proxy }}'
params: "{{ arguments | default(omit) }}"
version: '{{ wmi_exporter_version | default(omit) }}'
params: '{{ arguments | default(omit) }}'
7 changes: 2 additions & 5 deletions tasks/install/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,9 @@
proxy_url: '{{ wmi_exporter_proxy }}'
validate_certs: '{{ wmi_exporter_validate_certs }}'
vars:
var_url: '{{ var_url_base }}/releases/download/{{ var_url_version }}'
var_url: '{{ var_url_base }}/releases/download//v{{ wmi_exporter_version }}/'
var_url_base: https://github.com/martinlindhe/wmi_exporter
var_url_version: '/v{{ wmi_exporter_version }}/'
var_url_file: '{{ var_url_file_prefix }}-{{ var_url_file_suffix }}'
var_url_file_prefix: 'wmi_exporter-{{ wmi_exporter_version }}'
var_url_file_suffix: '{{ wmi_exporter_architecture }}.msi'
var_url_file: 'wmi_exporter-{{ wmi_exporter_version }}-{{ wmi_exporter_architecture }}.msi'

- name: 'package : create package arguments'
set_fact:
Expand Down
9 changes: 7 additions & 2 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
# tasks file for sbaerlocher.wmi_exporter

- block:
- name: 'main : include version search'
include_tasks: version.yml
when: wmi_exporter_version is undefined

- name: 'main : check if choco exist'
win_stat:
path: "C:\\ProgramData\\Chocolatey\\bin\\choco.exe"
Expand All @@ -10,8 +14,9 @@
- name: 'main : set install type choco'
set_fact:
wmi_exporter_install_type: 'choco'
when: register_wmi_exporter_choco_check.stat.exists and
not wmi_exporter_force_package
when: >
register_wmi_exporter_choco_check.stat.exists and
not wmi_exporter_force_package
- name: 'main : include install type'
include_tasks: 'install/{{ var_filename }}.yml'
Expand Down
17 changes: 17 additions & 0 deletions tasks/version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
# tasks file for sbaerlocher.wmi_exporter

- name: 'version : search'
uri:
url: https://release-monitoring.org/api/project/58765
method: GET
return_content: true
status_code: 200
body_format: json
register: register_wmi_exporter_version
delegate_to: localhost

- name: 'version : set version {{ register_wmi_exporter_version.json.version | default(wmi_exporter_version) }}'
set_fact:
wmi_exporter_version: '{{ register_wmi_exporter_version.json.version }}'
delegate_to: localhost

0 comments on commit 6082d0c

Please sign in to comment.