Skip to content

Commit

Permalink
Merge pull request #3 from Oefenweb/consistency-changes
Browse files Browse the repository at this point in the history
Consistency changes
  • Loading branch information
tersmitten authored Oct 27, 2022
2 parents ff31edd + 930b06c commit ae6decb
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 29 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ jobs:
python-version: '3.x'

- name: Install test dependencies
run: pip install ansible-lint[community,yamllint]
run: |
pip install ansible-lint
ansible-galaxy install -r requirements.yml
- name: Lint code
run: |
Expand All @@ -43,11 +45,8 @@ jobs:
matrix:
include:
- distro: debian8
ansible-version: '<2.10'
- distro: debian9
- distro: debian10
- distro: ubuntu1604
ansible-version: '>=2.9, <2.10'
- distro: ubuntu1604
ansible-version: '>=2.10, <2.11'
- distro: ubuntu1604
Expand Down
13 changes: 8 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
FROM ubuntu:16.04
FROM ubuntu:18.04
MAINTAINER Mischa ter Smitten <[email protected]>

ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8

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

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

# provision
Expand Down
5 changes: 2 additions & 3 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# meta file
---
galaxy_info:
namespace: oefenweb
author: oefenweb
role_name: go
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.9.0
min_ansible_version: 2.10.0
platforms:
- name: Ubuntu
versions:
Expand Down
6 changes: 6 additions & 0 deletions molecule/default/collections.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
collections:
- name: community.docker
version: '>=1.2.0,<2'
- name: community.general
version: '>=2,<3'
2 changes: 1 addition & 1 deletion molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
become: true
pre_tasks:
- name: include vars
include_vars: "{{ playbook_dir }}/../../tests/vars/main.yml"
ansible.builtin.include_vars: "{{ playbook_dir }}/../../tests/vars/main.yml"
roles:
- ../../../
3 changes: 3 additions & 0 deletions requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# requirements file
---
collections: []
28 changes: 14 additions & 14 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# tasks file
---
- name: get (current) version
command: >
ansible.builtin.command: >
{{ go_version_command }}
register: _get_current_version
changed_when: false
Expand All @@ -11,10 +11,15 @@
- go
- go-get-version

- block:
- name: install
when: _get_current_version.stdout | default('') != go_version
tags:
- configuration
- go
block:

- name: create (download) directory
file:
ansible.builtin.file:
path: "{{ go_download_path }}"
state: directory
owner: root
Expand All @@ -24,7 +29,7 @@
- go-download-directory

- name: download
get_url:
ansible.builtin.get_url:
url: "{{ go_download_url }}"
dest: "{{ go_download_path }}/{{ go_tarball }}"
checksum: "{{ go_tarball_checksum }}"
Expand All @@ -35,7 +40,7 @@
- go-download-file

- name: remove distro versions
apt:
ansible.builtin.apt:
name: "{{ go_distro_versions }}"
state: absent
purge: true
Expand All @@ -45,15 +50,15 @@
- go-remove-distro

- name: remove current version
file:
ansible.builtin.file:
path: "{{ go_install_prefix }}/go"
state: absent
tags:
- go-remove
- go-remove-current

- name: extract
unarchive:
ansible.builtin.unarchive:
src: "{{ go_download_path }}/{{ go_tarball }}"
dest: "{{ go_install_prefix }}"
creates: "{{ go_install_prefix }}/go"
Expand All @@ -62,7 +67,7 @@
- go-extract

- name: configure environment (variables)
template:
ansible.builtin.template:
src: etc/profile.d/go.sh.j2
dest: /etc/profile.d/go.sh
owner: root
Expand All @@ -72,15 +77,10 @@
- go-configure-environment

- name: check (installed) version
command: >
ansible.builtin.command: >
{{ go_version_command }}
register: _get_installed_version
failed_when: "_get_installed_version.stdout | default('') != go_version"
changed_when: false
tags:
- go-check-version

when: _get_current_version.stdout | default('') != go_version
tags:
- configuration
- go
2 changes: 1 addition & 1 deletion tests/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
become: true
pre_tasks:
- name: include vars
include_vars: "{{ playbook_dir }}/vars/main.yml"
ansible.builtin.include_vars: "{{ playbook_dir }}/vars/main.yml"
roles:
- ../../
2 changes: 1 addition & 1 deletion tests/vagrant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
become: true
pre_tasks:
- name: include vars
include_vars: "{{ playbook_dir }}/vars/main.yml"
ansible.builtin.include_vars: "{{ playbook_dir }}/vars/main.yml"
roles:
- ../../

0 comments on commit ae6decb

Please sign in to comment.