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

More flexibilty for docker #11

Merged
merged 3 commits into from
Dec 20, 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
13 changes: 5 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,11 @@ jobs:
fail-fast: false
matrix:
include:
- distro: debian8
- distro: debian9
- distro: debian10
- 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 +62,8 @@ jobs:
python-version: '3.x'

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

run: |
pip install 'ansible${{ matrix.ansible-version }}' molecule-plugins[docker] docker
- name: Run Molecule tests
run: |
molecule test
Expand Down
23 changes: 15 additions & 8 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"
},
]

Expand Down
1 change: 1 addition & 0 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# handlers file
---
- name: restart autossh-tunnel-client

Check warning on line 3 in handlers/main.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
ansible.builtin.service:
name: autossh-tunnel-client
state: restarted
use: "{{ service_use_service_mgr | default(omit) }}"
when: service_default_state | default('started') == 'started'
3 changes: 2 additions & 1 deletion meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ galaxy_info:
platforms:
- name: Ubuntu
versions:
- xenial
- bionic
- focal
- jammy
- noble
galaxy_tags:
- system
- networking
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
17 changes: 9 additions & 8 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# tasks file
---
- name: facts | set

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.set_fact:
is_docker_guest: "{{ ansible_virtualization_role | default('host') == 'guest' and ansible_virtualization_type | default('none') == 'docker' }}"
tags:
Expand All @@ -8,7 +8,7 @@
- autossh-tunnel-client
- autossh-tunnel-client-facts

- name: install package

Check warning on line 11 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: "{{ autossh_tunnel_client_dependencies }}"
state: "{{ apt_install_state | default('latest') }}"
Expand All @@ -27,17 +27,22 @@
- autossh-tunnel-client-configure

- name: service
block:
- name: service-initd
ansible.builtin.import_tasks: service-initd.yml
when: is_docker_guest
tags:
- configuration
- autossh-tunnel-client
- autossh-tunnel-client-service
- autossh-tunnel-client-service-initd
block:
- name: service-initd
ansible.builtin.import_tasks: service-initd.yml

- name: service
when: not is_docker_guest
tags:
- configuration
- autossh-tunnel-client
- autossh-tunnel-client-service
block:
- name: service upstart
ansible.builtin.import_tasks: service-upstart.yml
Expand All @@ -50,17 +55,13 @@
when: ansible_service_mgr == 'systemd'
tags:
- autossh-tunnel-client-service-systemd
when: not is_docker_guest
tags:
- configuration
- autossh-tunnel-client
- autossh-tunnel-client-service

- name: start and enable service
ansible.builtin.service:
name: autossh-tunnel-client
state: "{{ service_default_state | default('started') }}"
enabled: "{{ service_default_enabled | default(true) | bool }}"
use: "{{ service_use_service_mgr | default(omit) }}"
tags:
- configuration
- autossh-tunnel-client
Expand Down
2 changes: 1 addition & 1 deletion tasks/service-initd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
dest: "{{ autossh_tunnel_client_etc_init_d_file }}"
owner: root
group: root
mode: 0755
mode: '0755'
notify: restart autossh-tunnel-client
tags:
- autossh-tunnel-client-service-initd-update
2 changes: 1 addition & 1 deletion tasks/service-systemd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
dest: "{{ autossh_tunnel_client_etc_systemd_file }}"
owner: root
group: root
mode: 0644
mode: '0644'
register: _update_systemd_script
notify: restart autossh-tunnel-client
tags:
Expand Down
2 changes: 1 addition & 1 deletion tasks/service-upstart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
dest: "{{ autossh_tunnel_client_etc_init_file }}"
owner: root
group: root
mode: 0644
mode: '0644'
notify: restart autossh-tunnel-client
tags:
- autossh-tunnel-client-service-upstart-update
2 changes: 1 addition & 1 deletion tests/tasks/pre.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
state: directory
owner: root
group: root
mode: 0700
mode: '0700'

- name: generate key pair
ansible.builtin.command: >
Expand Down
3 changes: 2 additions & 1 deletion tests/test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# test file
---
- hosts: localhost
- name: converge
hosts: localhost
connection: local
become: true
pre_tasks:
Expand Down
3 changes: 2 additions & 1 deletion tests/vagrant.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# test file
---
- hosts: all
- name: converge
hosts: all
remote_user: vagrant
become: true
pre_tasks:
Expand Down
Loading