Skip to content

Commit

Permalink
Merge pull request #1 from Oefenweb/initial-working-version
Browse files Browse the repository at this point in the history
Initial working version
  • Loading branch information
tersmitten authored Nov 29, 2017
2 parents ed45a6b + b1607bb commit f4915d7
Show file tree
Hide file tree
Showing 17 changed files with 360 additions and 92 deletions.
30 changes: 30 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
Icon?
ehthumbs.db
Thumbs.db

# IDE files #
#################
/.settings
/.buildpath
/.project
/nbproject
*.komodoproject
*.kpf
/.idea

# Vagrant files #
.virtualbox/
.vagrant/
vagrant_ansible_inventory_*
ansible.cfg

# Other files #
###############
!empty
65 changes: 65 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
sudo: required
dist: trusty

language: python
python: "2.7"

env:
- ANSIBLE_VERSION=latest
- ANSIBLE_VERSION=2.4.1.0
- ANSIBLE_VERSION=2.4.0.0
- ANSIBLE_VERSION=2.3.2.0
- ANSIBLE_VERSION=2.3.1.0
- ANSIBLE_VERSION=2.3.0.0
- ANSIBLE_VERSION=2.2.3.0
- ANSIBLE_VERSION=2.2.2.0
- ANSIBLE_VERSION=2.2.1.0
- ANSIBLE_VERSION=2.2.0.0
- ANSIBLE_VERSION=2.1.6
- ANSIBLE_VERSION=2.1.5
- ANSIBLE_VERSION=2.1.4
- ANSIBLE_VERSION=2.1.3
- ANSIBLE_VERSION=2.1.2
- ANSIBLE_VERSION=2.1.1.0
- ANSIBLE_VERSION=2.1.0.0
- ANSIBLE_VERSION=2.0.2.0
- ANSIBLE_VERSION=2.0.1.0
- ANSIBLE_VERSION=2.0.0.2
- ANSIBLE_VERSION=2.0.0.1
- ANSIBLE_VERSION=2.0.0.0

branches:
only:
- master

before_install:
- sudo apt-get update -qq

install:
# Install Ansible.
- if [ "$ANSIBLE_VERSION" = "latest" ]; then pip install ansible; else pip install ansible==$ANSIBLE_VERSION; fi
- if [ "$ANSIBLE_VERSION" = "latest" ]; then pip install ansible-lint; fi

script:
# Check the role/playbook's syntax.
- ansible-playbook -i tests/inventory tests/test.yml --syntax-check

# Run the role/playbook with ansible-playbook.
- ansible-playbook -i tests/inventory tests/test.yml -vvvv

# Run the role/playbook again, checking to make sure it's idempotent.
- >
ansible-playbook -i tests/inventory tests/test.yml
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
- if [ "$ANSIBLE_VERSION" = "latest" ]; then ansible-lint tests/test.yml || true; fi

notifications:
email: false
hipchat:
rooms:
secure: FYzsinCX15LIBtnvnd/gXQJjrjsRuaESeQmnXZXhJ2rfNByr817uM5zS5NwG5KB0opmO7c70EJAsCH/ZZyWlvuZJLylPmMeyW9lXJxV5ZBG6TcDRzoPuYFVGU0efYyWpeI3lrMZEX9jjxeGsFk4wEPSecfB46godc4o7fAGQYxLqggNbA5s8PALMsyaLrtyyc/D9gUj16UDYVldiTIWIvHvMbDiO+N9ZPU5U4h+GT7WmogX+599Vc/qxamxMda8gGroQl8fvWQyOCh4UOzJEQK3W8pumsF9IepWhJ7Q3/8xXbzX14sngU9/6lAmGyT4hVUhpMEK49FrzC7a5JUznWG96YOK3MFAgrN6RSqdKuZ4XHY+bHNTOVUVoj4jFYdnoHmhU69PPtNs9hW2Bt5Ju/beOpajxa+uPEThRFt3EkO/kRMvr01JgIKDxEoDG3WrkL1zGMNuZoLOx+UvO1M15LeOv6Vx2sRpYVY1TL5g2v0hyZ4qT5/Z5QcTbBJgNkgml9RKtIoqHj/+BtYp3uqOtNqZ5lyvBgk3nshq5ohSIBmHMJh6oKBhjsafWm+OT6iz/AZyWOlsr0R5eCEUS2s5GvowegLATfMAQGh2pxI+Wq733YyiP0oHDOVFh4I4ktjq82ef09SjtITEb8RALoDGCP1fUI5g6MYUDgR3oC3UJp+M=
webhooks: https://galaxy.ansible.com/api/v1/notifications/
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM ubuntu:16.04
MAINTAINER Mischa ter Smitten <[email protected]>

# python
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y python-minimal python-dev curl && \
apt-get clean
RUN curl -sL https://bootstrap.pypa.io/get-pip.py | python -
RUN rm -rf $HOME/.cache

# ansible
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y gcc libffi-dev libssl-dev && \
apt-get clean
RUN pip install ansible==2.3.2.0
RUN rm -rf $HOME/.cache

# provision
COPY . /etc/ansible/roles/ansible-role
WORKDIR /etc/ansible/roles/ansible-role
RUN ansible-playbook -i tests/inventory tests/test.yml --connection=local
19 changes: 19 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) Oefenweb.nl <https://github.com/Oefenweb>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
49 changes: 28 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,44 @@
Go
========
## go

Ansible role that installs [Go](https://golang.org/). The latest stable release that has been compiled for x86 64-bit Linux systems is installed by default, and different platforms and versions are supported by modifying the role variables.
[![Build Status](https://travis-ci.org/Oefenweb/ansible-go.svg?branch=master)](https://travis-ci.org/Oefenweb/ansible-go) [![Ansible Galaxy](http://img.shields.io/badge/ansible--galaxy-go-blue.svg)](https://galaxy.ansible.com/Oefenweb/go/)

Role Variables
--------------
Set up (the latest or a specific version of) [Go](https://golang.org/) in Debian-like systems.

All of these variables are optional and should only be changed if you need to install a different version of Go (e.g. if you are installing on FreeBSD, or if you need to use an earlier release).
#### Requirements

`go_tarball`: The tarball that you want to install. A list of options can be found on the [Go Downloads page](https://golang.org/dl/). The default is the official x86 64-bit Linux tarball for the latest stable release.
None

`go_tarball_checksum`: This variable specifies the algorithm and checksum for the tarball that you want to install (e.g. `sha1:c7d78ba4df574b5f9a9bb5d17505f40c4d89b81c` or `sha256:a96cce8ce43a9bf9b2a4c7d470bc7ee0cb00410da815980681c8353218dcf146`). The default is the SHA256 checksum of the official x86 64-bit tarball for the latest stable release. Checksums can be found on the [Go Download Page](https://golang.org/dl/).
#### Variables

`go_version_target`: The string that the `go version` command is expected to return (e.g. "go version go1.2.1 linux/amd64"). This variable is used to control whether or not the Go tarball should be extracted, thereby upgrading (or downgrading) a previously installed copy. If the installed version already matches the target, the extraction step is skipped.
* `go_version`: [default: `go version go1.9.2 linux/amd64`]: Version string (to check)
* `go_tarball`: [default: `go1.9.2.linux-amd64.tar.gz`]: Tarball to install
* `go_tarball_checksum`: [default: `sha256:de874549d9a8d8d8062be05808509c09a88a248e77ec14eb77453530829ac02b`]: Tarball checksum (to check)

`go_download_location`: The full download URL. This variable simply appends the `go_tarball` variable onto the Go Download URL. This should not need to be modified.
* `go_install_prefix`: [default: `/usr/local`]: Install prefix

`set_go_path`: Whether or not to set the GOPATH for all users. The default is `true`.
* `go_remove_distro_version`: [default: `true`]: Whether or not to remove distribution versions

License
-------
## Dependencies

The MIT License (MIT)
None

Copyright (c) 2013-2016 Joshua Lund
#### Example

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
```yaml
---
- hosts: all
roles:
- go
```
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
#### License
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
MIT
Author Information
------------------
#### Author Information
You can find me on [Twitter](https://twitter.com/joshualund), and on [GitHub](https://github.com/jlund/). I also occasionally blog at [MissingM](https://missingm.co).
Mischa ter Smitten (based on work of [Joshua Lund](https://github.com/jlund) and [Mahesh Paolini-Subramanya](https://github.com/dieswaytoofast))
#### Feedback, bug-reports, requests, ...
Are [welcome](https://github.com/Oefenweb/ansible-go/issues)!
56 changes: 56 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# -*- mode: ruby -*-
# vi: set ft=ruby ts=2 sw=2 tw=0 et :

role = File.basename(File.expand_path(File.dirname(__FILE__)))

boxes = [
{
:name => "ubuntu-1404",
:box => "bento/ubuntu-14.04",
:ip => '10.0.0.12',
:cpu => "50",
:ram => "256"
},
{
:name => "ubuntu-1604",
:box => "bento/ubuntu-16.04",
:ip => '10.0.0.13',
:cpu => "50",
:ram => "256"
},
{
:name => "debian-8",
:box => "bento/debian-8",
:ip => '10.0.0.15',
:cpu => "50",
:ram => "256"
},
{
:name => "debian-9",
:box => "bento/debian-9",
:ip => '10.0.0.16',
:cpu => "50",
:ram => "256"
},
]

Vagrant.configure("2") do |config|
boxes.each do |box|
config.vm.define box[:name] do |vms|
vms.vm.box = box[:box]
vms.vm.hostname = "ansible-#{role}-#{box[:name]}"

vms.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--cpuexecutioncap", box[:cpu]]
v.customize ["modifyvm", :id, "--memory", box[:ram]]
end

vms.vm.network :private_network, ip: box[:ip]

vms.vm.provision :ansible do |ansible|
ansible.playbook = "tests/vagrant.yml"
ansible.verbose = "vv"
end
end
end
end
20 changes: 16 additions & 4 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# defaults file for go
---
go_tarball: "go1.8.1.linux-amd64.tar.gz"
go_tarball_checksum: "sha256:a579ab19d5237e263254f1eac5352efcf1d70b9dacadb6d6bb12b0911ede8994"
go_version_target: "go version go1.8.1 linux/amd64"
set_go_path: true
go_version: 'go version go1.9.2 linux/amd64'
go_tarball: 'go1.9.2.linux-amd64.tar.gz'
go_tarball_checksum: 'sha256:de874549d9a8d8d8062be05808509c09a88a248e77ec14eb77453530829ac02b'

# go_version: 'go version go1.8.5 linux/amd64'
# go_tarball: 'go1.8.5.linux-amd64.tar.gz'
# go_tarball_checksum: 'sha256:4f8aeea2033a2d731f2f75c4d0a4995b357b22af56ed69b3015f4291fca4d42d'

# go_version: 'go version go1.7.6 linux/amd64'
# go_tarball: 'go1.7.6.linux-amd64.tar.gz'
# go_tarball_checksum: 'sha256:ad5808bf42b014c22dd7646458f631385003049ded0bb6af2efc7f1f79fa29ea'

go_install_prefix: /usr/local

go_remove_distro_version: true
Empty file added files/empty
Empty file.
1 change: 0 additions & 1 deletion files/go-bin.sh

This file was deleted.

2 changes: 0 additions & 2 deletions files/go-path.sh

This file was deleted.

42 changes: 12 additions & 30 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,22 @@
# meta file for go
---
galaxy_info:
author: "Joshua Lund"
description: "Ansible role that installs Go (https://golang.org/). The latest stable release that has been compiled for x86 64-bit Linux systems is installed by default, and different platforms and versions are supported by modifying the role variables."
author: Mischa ter Smitten
company: Oefenweb.nl B.V.
description: Set up (the latest or a specific version of) Go in Debian-like systems
license: MIT
min_ansible_version: 2.0
min_ansible_version: 2.0.0.0
platforms:
- name: EL
versions:
- all
- name: GenericUNIX
versions:
- all
- name: Fedora
versions:
- all
- name: opensuse
versions:
- all
- name: GenericBSD
versions:
- all
- name: FreeBSD
versions:
- all
- name: Ubuntu
versions:
- all
- name: SLES
versions:
- all
- name: GenericLinux
versions:
- all
- trusty
- xenial
- name: Debian
versions:
- all
categories:
- jessie
- stretch
galaxy_tags:
- development
- packaging
- system
dependencies: []
Loading

0 comments on commit f4915d7

Please sign in to comment.