Skip to content

Commit

Permalink
add molecule for influxdb2
Browse files Browse the repository at this point in the history
  • Loading branch information
tbauriedel committed Jan 12, 2024
1 parent 3d740bf commit 4ed2863
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 9 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/test-influxdb2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
name: tbauriedel.influxdb2

on:
pull_request:
branches:
- '*'

jobs:
influxdb2:
runs-on: ubuntu-latest

env:
COLLECTION_NAMESPACE: tbauriedel
COLLECTION_NAME: influxdb2

strategy:
matrix:
distro: ['rockylinux9']
scenario: ['influxdb2']

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install dependencies ansible
run: |
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements-test.txt
- name: Install collection
run: |
mkdir -p ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE
cp -a ../ansible-collection-$COLLECTION_NAME ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE/$COLLECTION_NAME
- name: Test with molecule
run: |
ansible --version
molecule --version
molecule test -s ${{ matrix.scenario }}
env:
MOLECULE_DISTRO: ${{ matrix.distro }}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: tbauriedel.influxdb.repos
name: tbauriedel.influxdb2

on:
pull_request:
Expand All @@ -16,8 +16,8 @@ jobs:

strategy:
matrix:
distro: ['centos7', 'ubuntu2204']
scenario: ['repos']
distro: ['rockylinux9','ubuntu2204']

Check warning on line 19 in .github/workflows/test-repos.yml

View workflow job for this annotation

GitHub Actions / yamllint

19:32 [commas] too few spaces after comma
scenario: ['repos',]

Check warning on line 20 in .github/workflows/test-repos.yml

View workflow job for this annotation

GitHub Actions / yamllint

20:28 [commas] too few spaces after comma

steps:
- name: Checkout code
Expand Down
3 changes: 3 additions & 0 deletions molecule/influxdb2/collections.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
collections:
- name: community.docker
- name: ansible.posix
23 changes: 23 additions & 0 deletions molecule/influxdb2/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
- name: Converge
hosts: all

vars:
influxdb_influxdb2_admin_token: 123456789abc!
influxdb_influxdb2_buckets:
- name: foobar1
state: present
org: default
token: "{{ influxdb_influxdb2_admin_token }}"
host: "{{ influxdb_influxdb2_host }}"
retention:
type: 'expire'
everySeconds: 50000
shardGroupDurationSeconds: 0

collections:
- tbauriedel.influxdb2

roles:
- repos
- influxdb2
18 changes: 18 additions & 0 deletions molecule/influxdb2/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
dependency:
name: galaxy
driver:
name: docker
platforms:
- name: influxdb2
image: "geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu2204}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""}
cgroupns_mode: host
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
privileged: true
pre_build_image: true
provisioner:
name: ansible
verifier:
name: ansible
8 changes: 8 additions & 0 deletions molecule/influxdb2/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
- name: Verify
hosts: all
tasks:
- name: Ensure service is running
ansible.builtin.service:
name: influxdb
state: started

Check failure on line 8 in molecule/influxdb2/verify.yml

View workflow job for this annotation

GitHub Actions / yamllint

8:23 [new-line-at-end-of-file] no new line character at the end of file
2 changes: 1 addition & 1 deletion molecule/repos/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ dependency:
driver:
name: docker
platforms:
- name: instance
- name: "repos-${MOLECULE_DISTRO}"
image: "geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu2204}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""}
cgroupns_mode: host
Expand Down
10 changes: 5 additions & 5 deletions vagrant/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ Vagrant.configure("2") do |config|
end
end

config.vm.define "centos" do |centos|
centos.vm.hostname = "influxdb-centos"
centos.vm.box = "centos/7"
centos.vm.network "forwarded_port", guest: 8086, host: 8087
centos.vm.provision "ansible" do |ansible|
config.vm.define "rocky" do |rocky|
rocky.vm.hostname = "influxdb-rocky"
rocky.vm.box = "rockylinux/9"
rocky.vm.network "forwarded_port", guest: 8086, host: 8087
rocky.vm.provision "ansible" do |ansible|
ansible.playbook = "playbook.yml"
# ansible.verbose = "vvv"
end
Expand Down

0 comments on commit 4ed2863

Please sign in to comment.