Skip to content

Commit

Permalink
Add repos role
Browse files Browse the repository at this point in the history
  • Loading branch information
tbauriedel committed Dec 28, 2023
1 parent 8f56a83 commit e254430
Show file tree
Hide file tree
Showing 11 changed files with 85 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.vagrant
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
> **Note:** Work in progress
> **Note:** Collection is work in progress
# ansible-collection-influxdb

Install and configure InfluxDB
Collection to manage InfluxDB repository and setup.

It was created with the aim of refreshing my Ansible knowledge and getting in touch with Collections. Any hints for improvements are therefore welcome.

## Supported systems
| Distribution | Tested on |
|--------------|-----------|
| Ubuntu | 22.04 |
| Centos | 9 Stream |

## Roles

* repos
* influxdb (TODO)
20 changes: 20 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# you're doing.
Vagrant.configure("2") do |config|
config.vm.define "ubuntu" do |ubuntu|
ubuntu.vm.hostname = "influxdb-ubuntu"
ubuntu.vm.box = "bento/ubuntu-22.04"
ubuntu.vm.provision "ansible" do |ansible|
ansible.playbook = "vagrant-tests.yml"
end
end

config.vm.define "centos" do |centos|
centos.vm.hostname = "influxdb-centos"
centos.vm.box = "eurolinux-vagrant/centos-stream-9"
centos.vm.provision "ansible" do |ansible|
ansible.playbook = "vagrant-tests.yml"
end
end
end
2 changes: 2 additions & 0 deletions roles/repos/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
influxdb_repos_key_url: https://repos.influxdata.com/influxdata-archive.key
10 changes: 10 additions & 0 deletions roles/repos/tasks/Debian.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
- name: apt - Add repositiory key
ansible.builtin.apt_key:
state: present
url: "{{ influxdb_repos_key_url }}"

- name: apt - Add repository to list
ansible.builtin.apt_repository:
repo: "{{ influxdb_repos_stable }}"
state: present
12 changes: 12 additions & 0 deletions roles/repos/tasks/RedHat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
- name: yum - Add repositiory key
ansible.builtin.rpm_key:
state: present
key: "{{ influxdb_repos_key_url }}"

- name: yum - Add repository to list
ansible.builtin.yum_repository:
state: present
name: influxdb
description: Stable InfluxDB repository
baseurl: "{{ influxdb_repos_stable_baseurl }}"
13 changes: 13 additions & 0 deletions roles/repos/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
- name: Include OS specific vars
ansible.builtin.include_vars: "{{ lookup('first_found', params) }}"
vars:
params:
files:
- "{{ ansible_os_family }}.yml"
- default.yml
paths:
- "{{ role_path }}/vars"

- name: Add repositories
ansible.builtin.include_tasks: "{{ ansible_os_family }}.yml"
2 changes: 2 additions & 0 deletions roles/repos/vars/Debian.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
influxdb_repos_stable: "deb https://repos.influxdata.com/{{ ansible_distribution|lower }} {{ ansible_distribution_release|lower }} stable"
2 changes: 2 additions & 0 deletions roles/repos/vars/RedHat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
influxdb_repos_stable_baseurl: "https://repos.influxdata.com/rhel/$releasever/$basearch/stable"
2 changes: 2 additions & 0 deletions roles/repos/vars/default.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
# default variables for influxdb.repos
6 changes: 6 additions & 0 deletions vagrant-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- hosts: all
become: true

roles:
- repos

0 comments on commit e254430

Please sign in to comment.