-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework the whole role for NetBox 2.5.
Only support Debian 9 for now but the role will be extend later. All the role has been rewritten. NetBox is now setup using a virtualenv to avoid messing with the Python dependencies in the system. Also rework variables to set, mostly to configure NetBox.
- Loading branch information
Showing
25 changed files
with
366 additions
and
425 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
### VirtualEnv ### | ||
.Python | ||
[Bb]in | ||
[Ii]nclude | ||
[Ll]ib | ||
[Ll]ib64 | ||
[Ll]ocal | ||
[Ss]cripts | ||
[Ss]hare | ||
pyvenv.cfg | ||
.venv | ||
pip-selfcheck.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
--- | ||
- name: restart netbox | ||
supervisorctl: | ||
name: netbox | ||
state: restarted | ||
when: netbox_setup_web_backend | ||
|
||
- name: restart apache2 | ||
service: | ||
name: "{{ apache2_service }}" | ||
state: restarted | ||
state: restarted | ||
when: netbox_setup_web_frontend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
# Include variables and define needed ones | ||
- name: include os-specific variables | ||
include_vars: "{{ item }}" | ||
with_first_found: | ||
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_version }}.yml" | ||
- "{{ ansible_distribution | lower }}.yml" | ||
- "{{ ansible_os_family | lower }}.yml" | ||
|
||
- name: define python packages | ||
set_fact: | ||
netbox_python_packages: "{{ __netbox_python_packages | list }}" | ||
when: netbox_python_packages is not defined | ||
|
||
- name: define postgresql packages | ||
set_fact: | ||
netbox_postgresql_packages: "{{ __netbox_postgresql_packages | list }}" | ||
when: netbox_postgresql_packages is not defined | ||
|
||
- name: define other packages | ||
set_fact: | ||
netbox_other_packages: "{{ __netbox_other_packages | list }}" | ||
when: netbox_other_packages is not defined | ||
|
||
- name: define web backend packages | ||
set_fact: | ||
netbox_web_backend_packages: "{{ __netbox_web_backend_packages | list }}" | ||
when: netbox_web_backend_packages is not defined | ||
|
||
- name: define web frontend packages | ||
set_fact: | ||
netbox_web_frontend_packages: "{{ __netbox_web_frontend_packages | list }}" | ||
when: netbox_web_frontend_packages is not defined |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
- name: install required packages | ||
package: | ||
name: "{{ __netbox_required_packages | flatten}}" | ||
state: present | ||
vars: | ||
__netbox_required_packages: | ||
- "{{ netbox_python_packages }}" | ||
- "{{ netbox_postgresql_packages }}" | ||
- "{{ netbox_other_packages }}" | ||
- "{{ netbox_web_backend_packages if netbox_setup_web_backend else [] }}" | ||
- "{{ netbox_web_frontend_packages if netbox_setup_web_frontend else [] }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,27 @@ | ||
--- | ||
- include: include-vars.yml | ||
- import_tasks: include_vars.yml | ||
- import_tasks: install_packages.yml | ||
|
||
- include: install-packages.yml | ||
- name: ensure python 3 is used | ||
set_fact: | ||
ansible_python_interpreter: "{{ netbox_python_binary }}" | ||
|
||
- include: setup-database.yml | ||
- block: | ||
- name: create netbox group | ||
group: | ||
name: "{{ netbox_group }}" | ||
|
||
- include: setup-netbox.yml | ||
- name: create netbox user | ||
user: | ||
name: "{{ netbox_user }}" | ||
group: "{{ netbox_group }}" | ||
home: "{{ netbox_user_home_directory }}" | ||
|
||
- include: setup-web-backend.yml | ||
when: netbox_setup_web_backend | ||
- import_tasks: setup_database.yml | ||
when: netbox_database_host == 'localhost' | ||
- import_tasks: setup_netbox.yml | ||
|
||
- include: setup-web-frontend.yml | ||
when: netbox_setup_web_frontend | ||
- include: setup_web_backend.yml | ||
when: netbox_setup_web_backend | ||
- include: setup_web_frontend.yml | ||
when: netbox_setup_web_frontend |
Oops, something went wrong.