Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for debian bullseye #28

Merged
merged 9 commits into from
Apr 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ galaxy_info:
- name: Ubuntu
versions:
- focal
- name: Debian
versions:
- buster
- bullseye
galaxy_tags:
- netbox
- networking
Expand Down
2 changes: 1 addition & 1 deletion molecule/default/requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ roles:
- name: geerlingguy.postgresql
scm: git
src: 'git+https://github.com/geerlingguy/ansible-role-postgresql'
version: 3.1.0
version: 3.2.1

- name: geerlingguy.redis
4 changes: 2 additions & 2 deletions tasks/install.amazon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
register: amzn2extras
changed_when: amzn2extras is failed
with_items:
- python3.8
- "{{ python_packages }}"
jvoss marked this conversation as resolved.
Show resolved Hide resolved
- postgresql12

- name: install.amazon | enable required extras
ansible.builtin.command: "amazon-linux-extras enable {{ item }} "
become: yes
with_items:
- python3.8
- "{{ python_packages }}"
jvoss marked this conversation as resolved.
Show resolved Hide resolved
- postgresql12
when: not amazon_extras_repo.stat.exists or amzn2extras is failed

Expand Down
9 changes: 5 additions & 4 deletions tasks/install.debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
state: present
loop:
- git
- python3.8
- python3-pip
- python3.8-venv
- python3.8-dev
- build-essential
- libxml2-dev
- libxslt1-dev
Expand All @@ -22,6 +18,11 @@
- libssl-dev
- zlib1g-dev

- name: install.debian | install required python packages
ansible.builtin.apt:
name: "{{ python_packages }}"
state: present

- name: install.debian | install Git
ansible.builtin.apt:
name: git
Expand Down
8 changes: 5 additions & 3 deletions tasks/install.redhat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,18 @@
loop:
- gcc
- git
- python38
- python38-devel
- python3-pip
- libxml2-devel
- libxslt-devel
- libffi-devel
- libpq-devel
- openssl-devel
- redhat-rpm-config

- name: install.redhat | install required python packages
ansible.builtin.yum:
name: "{{ python_packages }}"
state: present

- name: install.redhat | install Git
ansible.builtin.yum:
name: git
Expand Down
3 changes: 3 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
---
# Variable configuration.
- include_tasks: variables.yml

- name: Include system packages
include_tasks: "install.{{ ansible_os_family | lower }}.yml"
args:
Expand Down
1 change: 1 addition & 0 deletions tasks/superusers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@
label: "{{ item.username }}"
changed_when: '"Superuser created successfully." in result.stdout'
failed_when: >
(result.rc != 0) and
(result.stderr != '') and
("CommandError: Error: That username is already taken." not in result.stderr)
2 changes: 1 addition & 1 deletion tasks/upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
- name: upgrade | run the upgrade script
ansible.builtin.command: "{{ netbox_current_path }}/upgrade.sh"
environment:
PYTHON: python3.8
PYTHON: "python{{ python_version | default(__python_version) }}"
become: yes
become_method: sudo
become_user: "{{ netbox_user }}"
Expand Down
25 changes: 25 additions & 0 deletions tasks/variables.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
# Variable configuration.
- name: Include OS-specific variables (Debian).
ansible.builtin.include_vars: "{{ ansible_distribution }}-{{ ansible_distribution_version.split('.')[0] }}.yml"
when: ansible_os_family == 'Debian'

- name: Include OS-specific variables (RedHat).
ansible.builtin.include_vars: "{{ ansible_os_family }}-{{ ansible_distribution_version.split('.')[0] }}.yml"
when:
- ansible_os_family == 'RedHat'
- ansible_distribution != 'Amazon'

- name: Include OS-specific variables (Amazon).
ansible.builtin.include_vars: "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml"
when: ansible_distribution == 'Amazon'

- name: Define python_packages.
jvoss marked this conversation as resolved.
Show resolved Hide resolved
ansible.builtin.set_fact:
python_packages: "{{ __python_packages | list }}"
when: python_packages is not defined
jvoss marked this conversation as resolved.
Show resolved Hide resolved

- name: Define python_version.
ansible.builtin.set_fact:
python_version: "{{ __python_version }}"
when: python_version is not defined
4 changes: 4 additions & 0 deletions vars/Amazon-2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
__python_version: "3.8"
__python_packages:
- "python{{ python_version | default(__python_version) }}"
10 changes: 10 additions & 0 deletions vars/Debian-10.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
__python_version: "3.7"
# this is the last supported available version of python on debian 10.
__python_packages:
- "python{{ python_version | default(__python_version) }}"
- "python3-pip"
- "python{{ python_version | default(__python_version) }}-venv"
- "python{{ python_version | default(__python_version) }}-dev"
netbox_version_tag: v3.1.11
# this is the last supported version of netbox on debian 10.
7 changes: 7 additions & 0 deletions vars/Debian-11.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
__python_version: "3.9"
__python_packages:
- "python{{ python_version | default(__python_version) }}"
- "python3-pip"
- "python{{ python_version | default(__python_version) }}-venv"
- "python{{ python_version | default(__python_version) }}-dev"
6 changes: 6 additions & 0 deletions vars/RedHat-8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
__python_version: "3.8"
__python_packages:
- "python{{ python_version | default(__python_version) | replace('.','') }}"
- "python{{ python_version | default(__python_version) | replace('.','') }}-devel"
- "python3-pip"
7 changes: 7 additions & 0 deletions vars/Ubuntu-20.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
__python_version: "3.8"
__python_packages:
- "python{{ python_version | default(__python_version) }}"
- "python3-pip"
- "python{{ python_version | default(__python_version) }}-venv"
- "python{{ python_version | default(__python_version) }}-dev"