adamwoolhether / NetBox4CentOS8

Quick and easy install playbook for NetBox on CentOS 8
5 stars 5 forks source link

installing netbox #1

Open andrewm659 opened 3 years ago

andrewm659 commented 3 years ago

So after seeing your comment in the netbox repo issues I have downloaded your ansible playbook. However I am heavily modifying it to look like a traditional ansible playbook that you would find on ansible galaxy. I have been testing while going through this and have hit a snag. Also I have broken up the playbook into smaller files and made include statements. Instead of running AS the actual root user, I run the playbook as my used but I have full sudo permissions which results in LOTS of become statements.

I am at this point: TASK [netbox1 : CREATE SUPER USER] **** task path: /opt/syseng/automation/ansible/playbooks/roles/netbox1/tasks/netbox.yml

The playbook is just sitting there. I am not sure the variable is being passed properly.

adamwoolhether commented 3 years ago

@andrewm659 I'd have to see your modified .yaml code to accurately diagnose the situation.

Have you tried running the playbook as-is on a fresh CentOS system?

Also please see the Notes section in the README, it sounds like you may be trying to create a superuser that already exists.

andrewm659 commented 3 years ago

So I got it working. And yes that was the issue. There needs to be more logic in it to check for the super user and either destroy the database and reload it or ignore it and move on.

andrewm659 commented 3 years ago

Also need the plugins...

adamwoolhether commented 3 years ago

@andrewm659 I totally agree. The command modules are not ideal, but I'm not sure how else to execute ansible commands within a target host's virtual environment. As such, I've loosely checked if the Netbox upgrade.sh has been executed before and placed the relevant tasks within a conditional block.

The "GENERATE SELF-SIGNED CERTIFICATE" task can also be improved. I know there is a proper module, but there are many crypto modules and crypto isn't my area of expertise, so I simply run the command after ensuring a key doesn't already exist.

Please feel free to contribute/improve

andrewm659 commented 3 years ago

Let me create a separate repo. I'll show you what I did.

andrewm659 commented 3 years ago

https://github.com/andrewm659/ansible-role-netbox

adamwoolhether commented 3 years ago

https://github.com/andrewm659/ansible-role-netbox

Regarding conditional logic, i'm not quite sure what you've done different? Can you point it out for me?

It seems you've just separated the plays into various role task-files.

andrewm659 commented 3 years ago

It also doesn't have to run as root anymore but as a user with elevated privileges. And yes I did basically separate out into tasks.