ytti / oxidized

Oxidized is a network device configuration backup tool. It's a RANCID replacement!
Apache License 2.0
2.77k stars 916 forks source link

environment when running docker... #3175

Open jseifeddine opened 4 months ago

jseifeddine commented 4 months ago

Hi Team,

just want to say fantastic work to all involved in this project, we've been using oxidized and haven't had any operational issues.

Keep up the great work!!

Just on the question of having variables when running in docker - unfortunately, they aren't available in the execution of the hooks for example, but even in the config YAML itself,

anyway, to fix the config bit, i made some minor changes....

https://github.com/ytti/oxidized/compare/master...j-oss2023:oxidized:master

So now i can do this:

docker

services:
  oxidized:
    restart: always
    image: oxidized/oxidized:0.30.1
    environment:
      CONFIG_RELOAD_INTERVAL: 600
      NETBOX_API_TOKEN: ${NETBOX_API_TOKEN}
      NETBOX_URL: ${NETBOX_URL}
      SSH_USERNAME: ${SSH_USERNAME}
      SSH_PASSWORD: ${SSH_PASSWORD}

oxidized

---
username: <%= ENV['SSH_USERNAME'] %>
password: <%= ENV['SSH_PASSWORD'] %>
...
source:
  default: http
  http:
    url: <%= ENV['NETBOX_URL'] %>/api/dcim/devices/?tag=oxidized
    scheme: https
    hosts_location: results
    delimiter: !ruby/regexp /:/
    read_timeout: 120
    user: false
    secure: true
    map:
      name: name
      model: platform.slug
      group: platform.slug
      ip: name
    headers:
      Authorization: Token <%= ENV['NETBOX_API_TOKEN'] %>
...

Check it out - I'm in a mad rush with other projects at the moment, but i'm happy to clean that up or adjust and contribute...

I should say, I am no ruby developer (at all) - in fact this was with the help of my good friend ChatGPT

Thanks !!!

jseifeddine commented 4 months ago

For those having issues with git... i made a forceful gitlab-pusher, who you can totally offload the git pushing to

https://github.com/jseifeddine/gitlab-pusher

theS1LV3R commented 1 month ago

This is exactly what I would want to use as well, could a PR be created so maybe this can get some more attention? Seems like a great addition.