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
WIP - Initial working version
  • Loading branch information
tersmitten authored Jan 10, 2025
2 parents bb55fbd + 6f4fd71 commit 138a6c6
Show file tree
Hide file tree
Showing 30 changed files with 531 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
warn_list:
- role-name
- name[play]
- name[casing]
79 changes: 79 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
name: CI
'on':
pull_request:
push:
branches:
- master
schedule:
- cron: '30 1 * * 3'

jobs:

lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Check out the codebase
uses: actions/checkout@v3

- name: Set up Python 3
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install test dependencies
run: |
pip install ansible-lint
ansible-galaxy install -r requirements.yml
- name: Lint code
run: |
yamllint .
ansible-lint
molecule:
name: Molecule
runs-on: ubuntu-latest
defaults:
run:
working-directory: "${{ github.repository }}"
needs:
- lint
strategy:
fail-fast: false
matrix:
include:
- distro: debian10
ansible-version: '>=9, <10'
- distro: debian11
- distro: debian12
- distro: ubuntu1804
ansible-version: '>=9, <10'
- distro: ubuntu2004
- distro: ubuntu2204
- distro: ubuntu2404

steps:
- name: Check out the codebase
uses: actions/checkout@v3
with:
path: "${{ github.repository }}"

- name: Set up Python 3
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install test dependencies
run: |
pip install 'ansible${{ matrix.ansible-version }}' molecule-plugins[docker] docker
- name: Run Molecule tests
run: |
molecule test
env:
ANSIBLE_FORCE_COLOR: '1'
ANSIBLE_VERBOSITY: '2'
MOLECULE_DEBUG: '1'
MOLECULE_DISTRO: "${{ matrix.distro }}"
PY_COLORS: '1'
20 changes: 20 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Release
'on':
push:
tags:
- '*'

jobs:

release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Check out the codebase
uses: actions/checkout@v3

- name: Publish to Galaxy
uses: robertdebock/[email protected]
with:
galaxy_api_key: ${{ secrets.GALAXY_API_KEY }}
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
15 changes: 15 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
extends: default

rules:
braces:
max-spaces-inside: 1
level: error
brackets:
max-spaces-inside: 1
level: error
line-length: disable
truthy: disable

ignore: |
.tox/
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
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 python3-minimal python3-dev curl && \
apt-get clean
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 python3-apt && \
apt-get clean
RUN pip3 install ansible==2.10.7
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
12 changes: 5 additions & 7 deletions LICENSE → LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
MIT License

Copyright (c) 2025 Oefenweb.nl
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:
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.
Expand All @@ -17,5 +15,5 @@ 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.
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
49 changes: 47 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,47 @@
# ansible-msodbcsql
Ansible role to set up msodbcsql in Debian-like systems
## msodbcsql

[![CI](https://github.com/Oefenweb/ansible-msodbcsql/workflows/CI/badge.svg)](https://github.com/Oefenweb/ansible-msodbcsql/actions?query=workflow%3ACI)
[![Ansible Galaxy](http://img.shields.io/badge/ansible--galaxy-msodbcsql-blue.svg)](https://galaxy.ansible.com/Oefenweb/msodbcsql)

Set up [Microsoft ODBC](https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server) in Debian-like systems.

#### Requirements

* `software-properties-common` (will be installed)
* `dirmngr` (will be installed)
* `apt-transport-https` (will be installed)
* `wget` (will be installed)

#### Variables

* `msodbcsql_version`: [default: `18`]: Version to install (e.g. `17`)
* `msodbcsql_install`: [default: `[]`]: Additional packages to install (e.g. `mssql-tools`)

## Dependencies

None

## Recommended

None

#### Example

```yaml
---
- hosts: all
roles:
- oefenweb.msodbcsql
```
#### License
MIT
#### Author Information
Mischa ter Smitten
#### Feedback, bug-reports, requests, ...
Are [welcome](https://github.com/Oefenweb/ansible-msodbcsql/issues)!
77 changes: 77 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# -*- 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-1804",
:box => "bento/ubuntu-18.04",
:ip => '10.0.0.13',
:cpu => "50",
:ram => "384"
},
{
:name => "ubuntu-2004",
:box => "bento/ubuntu-20.04",
:ip => '10.0.0.14',
:cpu => "50",
:ram => "512"
},
{
:name => "ubuntu-2204",
:box => "bento/ubuntu-22.04",
:ip => '10.0.0.15',
:cpu => "50",
:ram => "512"
},
{
:name => "ubuntu-2404",
:box => "bento/ubuntu-24.04",
:ip => '10.0.0.16',
:cpu => "50",
:ram => "512"
},
{
:name => "debian-10",
:box => "bento/debian-10",
:ip => '10.0.0.18',
:cpu => "50",
:ram => "256"
},
{
:name => "debian-11",
:box => "bento/debian-11",
:ip => '10.0.0.19',
:cpu => "50",
:ram => "256"
},
{
:name => "debian-12",
:box => "bento/debian-12",
:ip => '10.0.0.20',
:cpu => "50",
:ram => "384"
},
]

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
4 changes: 4 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# defaults file
---
msodbcsql_version: 18
msodbcsql_install: []
Empty file added files/empty
Empty file.
2 changes: 2 additions & 0 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# handlers file
---
29 changes: 29 additions & 0 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# meta file
---
galaxy_info:
author: oefenweb
role_name: msodbcsql
company: Oefenweb.nl B.V.
description: Set up Microsoft ODBC in Debian-like systems
license: MIT
min_ansible_version: 2.10.0
platforms:
- name: Ubuntu
versions:
- bionic
- focal
- jammy
- noble
- name: Debian
versions:
- buster
- bullseye
- bookworm
galaxy_tags:
- development
- system
- database
- sql
- r
- cran
dependencies: []
2 changes: 2 additions & 0 deletions molecule/default/collections.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
collections: []
6 changes: 6 additions & 0 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- name: Converge

Check warning on line 2 in molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Lint

role-name[path]

Avoid using paths when importing roles. (../../../)
hosts: all
become: true
roles:
- ../../../
Loading

0 comments on commit 138a6c6

Please sign in to comment.