ansible-ops-management/tasks/netbox/presetup.yml

52 lines
1.2 KiB
YAML

---
- name: Install required software to build python libs and run netbox
become: true
ansible.builtin.package:
name: "{{ netbox_pkg }}"
state: present
- name: Setup initial netbox user
become: true
ansible.builtin.user:
name: netbox
comment: "NetBox"
system: true
uid: "2001"
- name: Configuring SELinux booleans
ansible.posix.seboolean:
name: "{{ item }}"
persistent: true
state: true
with_items: "{{ netbox_selinux_booleans }}"
- name: Setup firewalld services
ansible.posix.firewalld:
service: "{{ item }}"
permanent: true
state: enabled
loop:
- http
- https
- name: Setup firewalld port because of netbox's weird setup
ansible.posix.firewalld:
port: "8000/tcp"
permanent: true
state: enabled
- name: Download netbox
ansible.builtin.get_url:
url: "https://github.com/netbox-community/netbox/archive/refs/tags/v{{ netbox_version }}.tar.gz"
dest: "/tmp/netbox-{{ netbox_version }}.tar.gz"
checksum: "{{ netbox_checksum }}"
- name: Unpack netbox
ansible.builtin.unarchive:
src: "/tmp/netbox-{{ netbox_version }}.tar.gz"
dest: "/opt"
owner: netbox
group: netbox
mode: '0644'
remote_src: true
...