Skip to content

Commit

Permalink
Merge pull request #7 from migibert/use_package_module
Browse files Browse the repository at this point in the history
Use package module
  • Loading branch information
migibert authored Aug 27, 2019
2 parents 7a8e657 + 8e47c20 commit e4cc4c6
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 37 deletions.
28 changes: 28 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: 2

jobs:
build:
environment:
TEST_DIR: terraform-role/tests

machine:
image: ubuntu-1604:201903-01

steps:
- checkout
- run: cp -r tests ~/tests
- run: mkdir ~/tests/roles
- run: sudo ln -s $(pwd) ~/tests/roles/migibert.terraform
- run: sudo pip install ansible
- run:
command: ansible-playbook --syntax-check -i inventory example.yml
working_directory: ~/tests
- run:
command: ansible-playbook --list-tasks -i inventory example.yml
working_directory: ~/tests
- run:
command: sudo ansible-playbook --connection=local -i inventory example.yml
working_directory: ~/tests
- run:
command: "sudo ansible-playbook --connection=local -i inventory example.yml | grep -q 'changed=0.*failed=0'"
working_directory: ~/tests
19 changes: 0 additions & 19 deletions circle.yml

This file was deleted.

2 changes: 1 addition & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
# defaults file for terraform-role
terraform_version: 0.6.11
terraform_version: 0.12.7
terraform_dir: /opt/terraform
terraform_user: terraform
terraform_user_password: $6$uoCgixKJL4cFyIT$U7FisaA6GAdosBpGde.4NS00vaAg4tGmR63eBQQMsd8LiHUjetq6HDXG10719JwbNmQUSLzvG6zq8DOVOggIw1
25 changes: 17 additions & 8 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,23 @@ galaxy_info:
author: Mikael Gibert
description: Terraform installation
license: MIT
min_ansible_version: 1.2
min_ansible_version: 2.0
platforms:
- name: Ubuntu
versions:
- all
- name: Debian
versions:
- all
- name: EL
versions:
- all
- name: Fedora
versions:
- all
- name: Debian
versions:
- all
- name: Ubuntu
versions:
- all
- name: GenericUNIX
versions:
- all
categories:
- cloud
dependencies: []
dependencies: []
6 changes: 3 additions & 3 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
register: terraform_directory

- name: Check terraform version
shell: "terraform --version 2>&1 | head -n 1 | grep {{terraform_version}}"
shell: "terraform version 2>&1 | head -n 1 | grep -q {{terraform_version}}"
failed_when: false
changed_when: false
register: terraform_versions_match
Expand All @@ -22,7 +22,7 @@
when: terraform_versions_match.rc != 0

- name: Install unzip to unarchive terraform
apt:
package:
name: unzip
state: present

Expand All @@ -31,7 +31,7 @@
src: /tmp/terraform-{{terraform_version}}.zip
dest: "{{terraform_dir}}"
copy: no
when: terraform_versions_match.rc != 0 or terraform_directory | changed
when: terraform_versions_match.rc != 0 or terraform_directory is changed

- name: Make terraform_user terraform directory owner
file:
Expand Down
5 changes: 0 additions & 5 deletions tests/ansible.cfg

This file was deleted.

2 changes: 1 addition & 1 deletion tests/example.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
- hosts: localhost

vars:
terraform_version: 0.6.11
terraform_version: 0.12.7
terraform_dir: /opt

roles:
Expand Down

0 comments on commit e4cc4c6

Please sign in to comment.