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 Noble #16

Merged
merged 3 commits into from
Oct 30, 2024
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
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ jobs:
- distro: debian10
- distro: debian11
- distro: debian12
- distro: ubuntu1604
ansible-version: '>=2.10, <2.11'
- distro: ubuntu1604
- distro: ubuntu1804
ansible-version: '>=9, <10'
- distro: ubuntu2004
- distro: ubuntu2204
- distro: ubuntu2404

steps:
- name: Check out the codebase
Expand All @@ -65,8 +65,8 @@ jobs:
python-version: '3.x'

- name: Install test dependencies
run: pip install 'ansible${{ matrix.ansible-version }}' molecule-plugins[docker] docker

run: |
pip install 'ansible${{ matrix.ansible-version }}' molecule-plugins[docker] docker
- name: Run Molecule tests
run: |
molecule test
Expand Down
25 changes: 16 additions & 9 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@
role = File.basename(File.expand_path(File.dirname(__FILE__)))

boxes = [
{
:name => "ubuntu-1604",
:box => "bento/ubuntu-16.04",
:ip => '10.0.0.12',
:cpu => "50",
:ram => "256"
},
{
:name => "ubuntu-1804",
:box => "bento/ubuntu-18.04",
Expand All @@ -23,7 +16,21 @@ boxes = [
:box => "bento/ubuntu-20.04",
:ip => '10.0.0.14',
:cpu => "50",
:ram => "384"
:ram => "512"
},
{
:name => "ubuntu-2204",
:box => "bento/ubuntu-22.04",
:ip => '10.0.0.15',
:cpu => "50",
:ram => "512"
},
{
:name => "ubuntu-2404",
:box => "bento/ubuntu-24.04",
:ip => '10.0.0.16',
:cpu => "50",
:ram => "512"
},
{
:name => "debian-10",
Expand All @@ -44,7 +51,7 @@ boxes = [
:box => "bento/debian-12",
:ip => '10.0.0.20',
:cpu => "50",
:ram => "256"
:ram => "384"
},
]

Expand Down
6 changes: 3 additions & 3 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# meta file
---
galaxy_info:
namespace: oefenweb
author: oefenweb
role_name: ssh_server
author: Mischa ter Smitten
company: Oefenweb.nl B.V.
description: Set up an OpenSSH server in Debian-like systems
license: MIT
min_ansible_version: 2.10.0
platforms:
- name: Ubuntu
versions:
- xenial
- bionic
- focal
- jammy
- noble
- name: Debian
versions:
- buster
Expand Down
6 changes: 1 addition & 5 deletions molecule/default/collections.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
---
collections:
- name: community.docker
version: '>=1.2.0,<2'
- name: community.general
version: '>=2,<3'
collections: []
2 changes: 1 addition & 1 deletion molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ driver:
name: docker
platforms:
- name: instance
image: "geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu1604}-ansible:latest"
image: "geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu2004}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
Expand Down
86 changes: 60 additions & 26 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,6 @@
# tasks file
---
- name: get (current) version # noqa risky-shell-pipe
ansible.builtin.shell: >
dpkg-query -W -f='${Version}' openssh-server | awk -F':' '{print $2}' | awk -F'p' '{print $1}'
register: _get_current_version
changed_when: false
failed_when: false
tags:
- configuration
- ssh-server
- ssh-server-version
- ssh-server-version-get

- name: set (current) version
ansible.builtin.set_fact:
ssh_server_version: "{{ _get_current_version.stdout | regex_search('^([0-9]+\\.[0-9]+\\.?[0-9]*)$') }}"
changed_when: false
check_mode: false
tags:
- configuration
- ssh-server
- ssh-server-version
- ssh-server-version-set

- name: install dependencies

Check warning on line 3 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
ansible.builtin.apt:
name: "{{ ssh_server_dependencies }}"
state: "{{ apt_install_state | default('latest') }}"
Expand All @@ -34,7 +11,7 @@
- ssh-server
- ssh-server-dependencies

- name: install

Check warning on line 14 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
ansible.builtin.apt:
name: "{{ ssh_server_install }}"
state: "{{ apt_install_state | default('latest') }}"
Expand All @@ -43,7 +20,7 @@
- ssh-server
- ssh-server-install

- name: check host keys

Check warning on line 23 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
ansible.builtin.command: >
ssh-keygen -A
args:
Expand All @@ -57,10 +34,66 @@
- ssh-server
- ssh-server-check-host-keys

- name: stat directories

Check warning on line 37 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
ansible.builtin.stat:
path: "{{ item }}/"
register: _stat_directories
with_items:
- "{{ ssh_server_config_file | dirname }}"
- "{{ ssh_server_runtime_directory }}"
tags:
- configuration
- ssh-server
- ssh-server-configure
- ssh-server-configure-directories
- ssh-server-configure-directories-stat

- name: create directories

Check warning on line 51 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
ansible.builtin.file:
path: "{{ item.item }}"
state: directory
owner: root
group: root
mode: 0755
with_items: "{{ _stat_directories.results }}"
when:
- item.stat is defined
- not item.stat.exists
tags:
- configuration
- ssh-server
- ssh-server-configure
- ssh-server-configure-directories
- ssh-server-configure-directories-create

- name: get (current) version # noqa risky-shell-pipe

Check warning on line 69 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
ansible.builtin.shell: >
dpkg-query -W -f='${Version}' openssh-server | awk -F':' '{print $2}' | awk -F'p' '{print $1}'
register: _get_current_version
changed_when: false
check_mode: false
failed_when: "_get_current_version.rc != 0"
tags:
- configuration
- ssh-server
- ssh-server-version
- ssh-server-version-get

- name: set (current) version
ansible.builtin.set_fact:
ssh_server_version: "{{ _get_current_version.stdout | regex_search('^([0-9]+\\.[0-9]+\\.?[0-9]*)$') }}"
changed_when: false
check_mode: false
tags:
- configuration
- ssh-server
- ssh-server-version
- ssh-server-version-set

- name: update configuration file
ansible.builtin.template:
src: etc/ssh/sshd_config.j2
dest: /etc/ssh/sshd_config
src: "{{ ssh_server_config_file.lstrip('/') }}.j2"
dest: "{{ ssh_server_config_file }}"
owner: root
group: root
mode: 0644
Expand All @@ -69,7 +102,8 @@
tags:
- configuration
- ssh-server
- ssh-server-configuration
- ssh-server-configure
- ssh-server-configure-file

- name: start and enable service
ansible.builtin.service:
Expand Down
3 changes: 3 additions & 0 deletions vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
---
ssh_server_dependencies:
- openssh-server

ssh_server_config_file: /etc/ssh/sshd_config
ssh_server_runtime_directory: /run/sshd
Loading