Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
bodsch committed Jun 25, 2024
1 parent 510a379 commit 8cded7c
Show file tree
Hide file tree
Showing 15 changed files with 144 additions and 55 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/configured.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,21 @@ jobs:
image:
- debian:12
python_version:
- "3.11.3"
- "3.11"
ansible-version:
- '6.7'
scenario:
- configured

steps:
- name: check out the codebase.
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: 'ansible-telegraf'
ref: ${{ github.event.workflow_run.head_branch }}

- name: 🐍 set up python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "${{ matrix.python_version }}"

Expand All @@ -48,6 +48,11 @@ jobs:
python -m pip install --upgrade pip
pip install -r test-requirements.txt
- name: force reinstall of community.docker
run: |
mkdir -p /home/runner/.ansible/collections
ansible-galaxy collection install community.docker --force
- name: test with tox
run: |
make \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Check out the codebase
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: 'ansible-telegraf'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 🛎 Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: lint
uses: docker://ghcr.io/github/super-linter:slim-v4
Expand Down
78 changes: 69 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,22 @@ jobs:
image:
- archlinux:latest
python_version:
- "3.10.11"
- "3.11.3"
- "3.10"
- "3.11"
ansible-version:
- '6.7'
scenario:
- default

steps:
- name: check out the codebase.
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: 'ansible-telegraf'
ref: ${{ github.event.workflow_run.head_branch }}

- name: 🐍 set up python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "${{ matrix.python_version }}"

Expand All @@ -47,6 +47,11 @@ jobs:
python -m pip install --upgrade pip
pip install -r test-requirements.txt
- name: force reinstall of community.docker
run: |
mkdir -p /home/runner/.ansible/collections
ansible-galaxy collection install community.docker --force
- name: test with tox
run: |
make \
Expand All @@ -59,7 +64,7 @@ jobs:
ANSIBLE_FORCE_COLOR: '1'
DISTRIBUTION: ${{ matrix.image }}

deb:
debian:
name: "${{ matrix.image }} / ansible: ${{ matrix.ansible-version }}"
runs-on: ubuntu-20.04
if: ${{ github.event_name == 'schedule' || github.event.workflow_run.conclusion == 'success' }}
Expand All @@ -69,25 +74,75 @@ jobs:
image:
- debian:11
- debian:12
python_version:
- "3.10"
- "3.11"
ansible-version:
- '6.7'
scenario:
- default

steps:
- name: check out the codebase.
uses: actions/checkout@v4
with:
path: 'ansible-telegraf'
ref: ${{ github.event.workflow_run.head_branch }}

- name: 🐍 set up python
uses: actions/setup-python@v5
with:
python-version: "${{ matrix.python_version }}"

- name: install dependencies
run: |
python -m pip install --upgrade pip
pip install -r test-requirements.txt
- name: force reinstall of community.docker
run: |
mkdir -p /home/runner/.ansible/collections
ansible-galaxy collection install community.docker --force
- name: test with tox
run: |
make \
test \
-e TOX_SCENARIO="${{ matrix.scenario }}" \
-e TOX_ANSIBLE="ansible_${{ matrix.ansible-version }}" \
-e DISTRIBUTION="${{ matrix.image }}"
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
DISTRIBUTION: ${{ matrix.image }}

ubuntu:
name: "${{ matrix.image }} / ansible: ${{ matrix.ansible-version }}"
runs-on: ubuntu-20.04
if: ${{ github.event_name == 'schedule' || github.event.workflow_run.conclusion == 'success' }}
strategy:
fail-fast: false
matrix:
image:
- ubuntu:20.04
- ubuntu:22.04
python_version:
- "3.10.11"
- "3.11.3"
- "3.10"
- "3.11"
ansible-version:
- '6.7'
scenario:
- default

steps:
- name: check out the codebase.
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: 'ansible-telegraf'
ref: ${{ github.event.workflow_run.head_branch }}

- name: 🐍 set up python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "${{ matrix.python_version }}"

Expand All @@ -96,6 +151,11 @@ jobs:
python -m pip install --upgrade pip
pip install -r test-requirements.txt
- name: force reinstall of community.docker
run: |
mkdir -p /home/runner/.ansible/collections
ansible-galaxy collection install community.docker --force
- name: test with tox
run: |
make \
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
export TOX_SCENARIO ?= default
export TOX_ANSIBLE ?= ansible_6.1
export TOX_ANSIBLE ?= ansible_8.5

.PHONY: converge destroy verify test lint

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ Ansible role to install and configure [telegraf](https://www.influxdata.com/time
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/bodsch/ansible-telegraf/main.yml?branch=main)][ci]
[![GitHub issues](https://img.shields.io/github/issues/bodsch/ansible-telegraf)][issues]
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/bodsch/ansible-telegraf)][releases]
[![Ansible Quality Score](https://img.shields.io/ansible/quality/50067?label=role%20quality)][quality]
[![Ansible Downloads](https://img.shields.io/ansible/role/d/bodsch/telegraf?logo=ansible)][galaxy]

[ci]: https://github.com/bodsch/ansible-telegraf/actions
[issues]: https://github.com/bodsch/ansible-telegraf/issues?q=is%3Aopen+is%3Aissue
[releases]: https://github.com/bodsch/ansible-telegraf/releases
[quality]: https://galaxy.ansible.com/bodsch/telegraf
[galaxy]: https://galaxy.ansible.com/ui/standalone/roles/bodsch/telegraf/


If `latest` is set for `telegraf_version`, the role tries to install the latest release version.
Expand Down
1 change: 0 additions & 1 deletion collections.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@

collections:
- name: bodsch.core
version: ">=1.0.17"
- name: bodsch.scm
33 changes: 21 additions & 12 deletions molecule/configured/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,23 @@ dependency:
driver:
name: docker

lint: |
set -e
yamllint .
ansible-lint .
flake8 .
platforms:
- name: instance
image: "bodsch/ansible-${DISTRIBUTION:-debian:11}"
image: "bodsch/ansible-${DISTRIBUTION:-debian:12}"
command: ${MOLECULE_DOCKER_COMMAND:-""}
docker_host: "${DOCKER_HOST:-unix://run/docker.sock}"
privileged: true
pre_build_image: true
cgroupns_mode: host
published_ports:
- 9090:9090
- 9093:9093
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- /sys/fs/cgroup:/sys/fs/cgroup:rw
- /var/lib/containerd
tmpfs:
- /run
- /tmp
docker_networks:
- name: telegraf
ipam_config:
Expand All @@ -36,25 +35,35 @@ platforms:
ipv4_address: "10.11.0.10"

- name: influx1
image: "bodsch/ansible-debian:11"
image: "bodsch/ansible-${DISTRIBUTION:-debian:12}"
command: ${MOLECULE_DOCKER_COMMAND:-""}
docker_host: "${DOCKER_HOST:-unix://run/docker.sock}"
privileged: true
pre_build_image: true
cgroupns_mode: host
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- /sys/fs/cgroup:/sys/fs/cgroup:rw
- /var/lib/containerd
tmpfs:
- /run
- /tmp
networks:
- name: telegraf
ipv4_address: "10.11.0.11"

- name: influx2
image: "bodsch/ansible-debian:11"
image: "bodsch/ansible-${DISTRIBUTION:-debian:12}"
command: ${MOLECULE_DOCKER_COMMAND:-""}
docker_host: "${DOCKER_HOST:-unix://run/docker.sock}"
privileged: true
pre_build_image: true
cgroupns_mode: host
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- /sys/fs/cgroup:/sys/fs/cgroup:rw
- /var/lib/containerd
tmpfs:
- /run
- /tmp
networks:
- name: telegraf
ipv4_address: "10.11.0.12"
Expand Down
9 changes: 6 additions & 3 deletions molecule/configured/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
- name: update pacman system
ansible.builtin.command: |
pacman --refresh --sync --sysupgrade --noconfirm
register: pacman
changed_when: pacman.rc != 0
failed_when: pacman.rc != 0

- name: create depends service
ansible.builtin.copy:
Expand Down Expand Up @@ -43,17 +46,17 @@

pre_tasks:
- name: package update
shell:
ansible.builtin.shell:
apt -y update && apt -y upgrade

- name:
shell:
ansible.builtin.shell:
cd /tmp/ ;
curl https://repos.influxdata.com/influxdata-archive_compat.key > /tmp/influxdata-archive_compat.key &&
echo '393e8779c89ac8d958f81f942f9ad7fb82a25e133faddaf92e15b16e6ac9ce4c /tmp/influxdata-archive_compat.key' | sha256sum -c && cat /tmp/influxdata-archive_compat.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/influxdata-archive_compat.gpg

- name: install pip
package:
ansible.builtin.package:
name: python3-pip
state: present
when:
Expand Down
18 changes: 9 additions & 9 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,24 @@ dependency:
driver:
name: docker

lint: |
set -e
yamllint .
ansible-lint .
flake8 .
platforms:
- name: instance
image: "bodsch/ansible-${DISTRIBUTION:-debian:11}"
image: "bodsch/ansible-${DISTRIBUTION:-debian:12}"
command: ${MOLECULE_DOCKER_COMMAND:-""}
docker_host: "${DOCKER_HOST:-unix://run/docker.sock}"
privileged: true
pre_build_image: true
cgroupns_mode: host
published_ports:
- 9090:9090
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- /sys/fs/cgroup:/sys/fs/cgroup:rw
- /var/lib/containerd
capabilities:
- SYS_ADMIN
tmpfs:
- /run
- /tmp

provisioner:
name: ansible
Expand All @@ -43,7 +44,6 @@ provisioner:

scenario:
test_sequence:
# - lint
- destroy
- dependency
- syntax
Expand Down
5 changes: 5 additions & 0 deletions molecule/default/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
- name: update pacman system
ansible.builtin.command: |
pacman --refresh --sync --sysupgrade --noconfirm
register: pacman
changed_when: pacman.rc != 0
failed_when: pacman.rc != 0

- name: create depends service
ansible.builtin.copy:
Expand All @@ -36,3 +39,5 @@
- "distribution version : {{ ansible_distribution_major_version }}"
- "ansible version : {{ ansible_version.full }}"
- "python version : {{ ansible_python.version.major }}.{{ ansible_python.version.minor }}"

...
Loading

0 comments on commit 8cded7c

Please sign in to comment.