Skip to content

Commit 9939e53

Browse files
committed
WIP
1 parent 1cbd982 commit 9939e53

26 files changed

+502
-0
lines changed

.ansible-lint

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
warn_list:
3+
- role-name
4+
- name[play]
5+
- name[casing]

.github/workflows/ci.yml

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
---
2+
name: CI
3+
'on':
4+
pull_request:
5+
push:
6+
branches:
7+
- master
8+
schedule:
9+
- cron: '30 1 * * 3'
10+
11+
jobs:
12+
13+
lint:
14+
name: Lint
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Check out the codebase
18+
uses: actions/checkout@v3
19+
20+
- name: Set up Python 3
21+
uses: actions/setup-python@v4
22+
with:
23+
python-version: '3.x'
24+
25+
- name: Install test dependencies
26+
run: |
27+
pip install ansible-lint
28+
ansible-galaxy install -r requirements.yml
29+
30+
- name: Lint code
31+
run: |
32+
yamllint .
33+
ansible-lint
34+
35+
molecule:
36+
name: Molecule
37+
runs-on: ubuntu-latest
38+
defaults:
39+
run:
40+
working-directory: "${{ github.repository }}"
41+
needs:
42+
- lint
43+
strategy:
44+
fail-fast: false
45+
matrix:
46+
include:
47+
- distro: debian10
48+
ansible-version: '>=9, <10'
49+
- distro: debian11
50+
- distro: debian12
51+
- distro: ubuntu1804
52+
ansible-version: '>=9, <10'
53+
- distro: ubuntu2004
54+
- distro: ubuntu2204
55+
- distro: ubuntu2404
56+
57+
steps:
58+
- name: Check out the codebase
59+
uses: actions/checkout@v3
60+
with:
61+
path: "${{ github.repository }}"
62+
63+
- name: Set up Python 3
64+
uses: actions/setup-python@v4
65+
with:
66+
python-version: '3.x'
67+
68+
- name: Install test dependencies
69+
run: |
70+
pip install 'ansible${{ matrix.ansible-version }}' molecule-plugins[docker] docker
71+
- name: Run Molecule tests
72+
run: |
73+
molecule test
74+
env:
75+
ANSIBLE_FORCE_COLOR: '1'
76+
ANSIBLE_VERBOSITY: '2'
77+
MOLECULE_DEBUG: '1'
78+
MOLECULE_DISTRO: "${{ matrix.distro }}"
79+
PY_COLORS: '1'

.github/workflows/release.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Release
3+
'on':
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
10+
release:
11+
name: Release
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Check out the codebase
15+
uses: actions/checkout@v3
16+
17+
- name: Publish to Galaxy
18+
uses: robertdebock/[email protected]
19+
with:
20+
galaxy_api_key: ${{ secrets.GALAXY_API_KEY }}

.gitignore

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# OS generated files #
2+
######################
3+
.DS_Store
4+
.DS_Store?
5+
._*
6+
.Spotlight-V100
7+
.Trashes
8+
Icon?
9+
ehthumbs.db
10+
Thumbs.db
11+
12+
# IDE files #
13+
#################
14+
/.settings
15+
/.buildpath
16+
/.project
17+
/nbproject
18+
*.komodoproject
19+
*.kpf
20+
/.idea
21+
22+
# Vagrant files #
23+
.virtualbox/
24+
.vagrant/
25+
vagrant_ansible_inventory_*
26+
ansible.cfg
27+
28+
# Other files #
29+
###############
30+
!empty

.yamllint

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
extends: default
3+
4+
rules:
5+
braces:
6+
max-spaces-inside: 1
7+
level: error
8+
brackets:
9+
max-spaces-inside: 1
10+
level: error
11+
line-length: disable
12+
truthy: disable
13+
14+
ignore: |
15+
.tox/

Dockerfile

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM ubuntu:18.04
2+
MAINTAINER Mischa ter Smitten <[email protected]>
3+
4+
ENV LANG C.UTF-8
5+
ENV LC_ALL C.UTF-8
6+
7+
# python
8+
RUN apt-get update && \
9+
DEBIAN_FRONTEND=noninteractive apt-get install -y python3-minimal python3-dev curl && \
10+
apt-get clean
11+
RUN curl -sL https://bootstrap.pypa.io/pip/3.6/get-pip.py | python3 -
12+
RUN rm -rf $HOME/.cache
13+
14+
# ansible
15+
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python3-apt && \
16+
apt-get clean
17+
RUN pip3 install ansible==2.10.7
18+
RUN rm -rf $HOME/.cache
19+
20+
# provision
21+
COPY . /etc/ansible/roles/ansible-role
22+
WORKDIR /etc/ansible/roles/ansible-role
23+
RUN ansible-playbook -i tests/inventory tests/test.yml --connection=local

README.md

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
## nvm
2+
3+
[![CI](https://github.com/Oefenweb/ansible-nvm/workflows/CI/badge.svg)](https://github.com/Oefenweb/ansible-nvm/actions?query=workflow%3ACI)
4+
[![Ansible Galaxy](http://img.shields.io/badge/ansible--galaxy-nvm-blue.svg)](https://galaxy.ansible.com/Oefenweb/nvm)
5+
6+
Set up Node Version Manager ([nvm](https://github.com/nvm-sh/nvm)) in Debian-like systems
7+
8+
#### Requirements
9+
10+
* `curl` (will be installed)
11+
* `git` (will be installed)
12+
13+
#### Variables
14+
15+
* `nvm_version` [default: `v0.40.2`]: Version to install
16+
* `nvm_install` [default: `[]`]: (Additional) packages to install (e.g. `build-essential`, `libssl-dev`)
17+
18+
## Dependencies
19+
20+
None
21+
22+
## Recommended
23+
24+
#### Example
25+
26+
```yaml
27+
---
28+
- hosts: all
29+
roles:
30+
- oefenweb.nvm
31+
```
32+
33+
#### License
34+
35+
MIT
36+
37+
#### Author Information
38+
39+
Mischa ter Smitten
40+
41+
#### Feedback, bug-reports, requests, ...
42+
43+
Are [welcome](https://github.com/Oefenweb/ansible-nvm/issues)!

Vagrantfile

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# -*- mode: ruby -*-
2+
# vi: set ft=ruby ts=2 sw=2 tw=0 et :
3+
4+
role = File.basename(File.expand_path(File.dirname(__FILE__)))
5+
6+
boxes = [
7+
{
8+
:name => "ubuntu-1804",
9+
:box => "bento/ubuntu-18.04",
10+
:ip => '10.0.0.13',
11+
:cpu => "50",
12+
:ram => "384"
13+
},
14+
{
15+
:name => "ubuntu-2004",
16+
:box => "bento/ubuntu-20.04",
17+
:ip => '10.0.0.14',
18+
:cpu => "50",
19+
:ram => "512"
20+
},
21+
{
22+
:name => "ubuntu-2204",
23+
:box => "bento/ubuntu-22.04",
24+
:ip => '10.0.0.15',
25+
:cpu => "50",
26+
:ram => "512"
27+
},
28+
{
29+
:name => "ubuntu-2404",
30+
:box => "bento/ubuntu-24.04",
31+
:ip => '10.0.0.16',
32+
:cpu => "50",
33+
:ram => "512"
34+
},
35+
{
36+
:name => "debian-10",
37+
:box => "bento/debian-10",
38+
:ip => '10.0.0.18',
39+
:cpu => "50",
40+
:ram => "256"
41+
},
42+
{
43+
:name => "debian-11",
44+
:box => "bento/debian-11",
45+
:ip => '10.0.0.19',
46+
:cpu => "50",
47+
:ram => "256"
48+
},
49+
{
50+
:name => "debian-12",
51+
:box => "bento/debian-12",
52+
:ip => '10.0.0.20',
53+
:cpu => "50",
54+
:ram => "384"
55+
},
56+
]
57+
58+
Vagrant.configure("2") do |config|
59+
boxes.each do |box|
60+
config.vm.define box[:name] do |vms|
61+
vms.vm.box = box[:box]
62+
vms.vm.hostname = "ansible-#{role}-#{box[:name]}"
63+
64+
vms.vm.provider "virtualbox" do |v|
65+
v.customize ["modifyvm", :id, "--cpuexecutioncap", box[:cpu]]
66+
v.customize ["modifyvm", :id, "--memory", box[:ram]]
67+
end
68+
69+
vms.vm.network :private_network, ip: box[:ip]
70+
71+
vms.vm.provision :ansible do |ansible|
72+
ansible.playbook = "tests/vagrant.yml"
73+
ansible.verbose = "vv"
74+
end
75+
end
76+
end
77+
end

defaults/main.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# defaults file
2+
---
3+
nvm_version: 'v0.40.2'
4+
5+
nvm_install: []

files/empty

Whitespace-only changes.

handlers/main.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# handlers file
2+
---

meta/main.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# meta file
2+
---
3+
galaxy_info:
4+
author: oefenweb
5+
role_name: nvm
6+
company: Oefenweb.nl B.V.
7+
description: Set up Node Version Manager (nvm) in Debian-like systems
8+
license: MIT
9+
min_ansible_version: 2.10.0
10+
platforms:
11+
- name: Ubuntu
12+
versions:
13+
- bionic
14+
- focal
15+
- jammy
16+
- noble
17+
- name: Debian
18+
versions:
19+
- buster
20+
- bullseye
21+
- bookworm
22+
galaxy_tags:
23+
- system
24+
- web
25+
dependencies: []

molecule/default/collections.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
collections: []

molecule/default/converge.yml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
- name: Converge
3+
hosts: all
4+
become: true
5+
pre_tasks:
6+
- name: include vars
7+
ansible.builtin.include_vars: "{{ playbook_dir }}/../../tests/vars/main.yml"
8+
roles:
9+
- ../../../

molecule/default/molecule.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
dependency:
3+
name: galaxy
4+
driver:
5+
name: docker
6+
platforms:
7+
- name: instance
8+
image: "geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu2004}-ansible:latest"
9+
command: ${MOLECULE_DOCKER_COMMAND:-""}
10+
volumes:
11+
- /sys/fs/cgroup:/sys/fs/cgroup:rw
12+
- /var/lib/containerd
13+
cgroupns_mode: host
14+
privileged: true
15+
pre_build_image: true
16+
provisioner:
17+
name: ansible
18+
playbooks:
19+
prepare: prepare.yml
20+
converge: converge.yml
21+
verify: verify.yml

molecule/default/prepare.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
- name: Prepare
3+
hosts: all
4+
become: true
5+
tasks: []

molecule/default/verify.yml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
- name: Verify
3+
hosts: all
4+
become: true
5+
tasks:
6+
- name: include tasks
7+
ansible.builtin.import_tasks: "{{ playbook_dir }}/../../tests/tasks/post.yml"

requirements.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# requirements file
2+
---
3+
collections:
4+
- name: community.general

0 commit comments

Comments
 (0)