Skip to content

Commit

Permalink
Download nginx from apt for ubuntu version greater that 22.04 (#11)
Browse files Browse the repository at this point in the history
* Download nginx from apt for ubuntu version higher that 2204

* Test against ubuntu 22.04

* See if we can bypass the error during prepare state

* Revert changes

* Fix Molecule CI workflow for Ubuntu 22.04 GitHub Actions.

* Use the latest molecule-action

* Skip role name check
Run lint on ubuntu 22.04

* Add role name and namespace so that molecule test doesn't fail

* Try addressing new unexplained error from molecule in the pipeline

* Try again to get past pipeline error

* Revert the commit that did not fix the problem

This reverts commit 7ff5391.

* Drop centos testing

* Update *very* out of date pip requirements

* Try a different entrypoint

Tihs works on my local, let's see if github workflow likes it too

* Add a line that might help

* Fix bad comparison

* Try using different images for testing

* Bring meta up to date

* Update readme

* Remove Debian task; we don't use or test it

* Switch back to latest

* Put Rocky (aka CentOS) test back

* Fix typo

* Remove cruft

* Disambiguate

* Update readme

Co-authored-by: Dale Anderson <[email protected]>
  • Loading branch information
Chithrak07 and dale-c-anderson authored Jan 3, 2023
1 parent 155a1b0 commit a990a72
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 40 deletions.
16 changes: 7 additions & 9 deletions .github/workflows/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
path: "${{ github.repository }}"
- name: molecule
uses: robertdebock/molecule-action@2.6.3
uses: robertdebock/molecule-action@4.0.9
with:
command: lint
test:
Expand All @@ -27,18 +27,16 @@ jobs:
strategy:
matrix:
image:
- geerlingguy/docker-ubuntu2004-ansible:latest
- geerlingguy/docker-ubuntu1804-ansible:latest
- geerlingguy/docker-ubuntu1604-ansible:latest
- geerlingguy/docker-centos8-ansible:latest
- geerlingguy/docker-centos7-ansible:latest
- registry.gitlab.com/aussielunix/ansible/molecule-containers/ubuntu:jammy
- registry.gitlab.com/aussielunix/ansible/molecule-containers/ubuntu:focal
- registry.gitlab.com/aussielunix/ansible/molecule-containers/rockylinux:9
steps:
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
path: "${{ github.repository }}"
- name: molecule
uses: robertdebock/molecule-action@2.6.3
uses: robertdebock/molecule-action@4.0.9
with:
image: "${{ matrix.image }}"
options: parallel
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Install and configure NGINX for acro hosting environments

## Requirements

* Ubuntu 14.04+ or RedHat/CentOS 6+
* Ubuntu 18.04+ or CentOS/Red Hat/Rocky Linux 8+
* Your playbook must gather facts

## Role Variables
Expand Down
17 changes: 10 additions & 7 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
---
galaxy_info:
author: Matt Breden
description: Install Nginx on Ubuntu or RedHat/CentOS
author: Matt Breden, Dale Anderson, Chithra K
description: Install NGINX on Ubuntu or Red Hat
company: Acro Media Inc.
license: GPLv3
min_ansible_version: 2.0
role_name: nginx
namespace: acromedia
platforms:
- name: Ubuntu
versions:
- trusty
- xenial
- bionic
- name: EL
- jammy # 22.04
- focal # 20.04
- bionic # 18.04
- name: EL # Or CentOS, or Rocky
versions:
- 6
- 8
- 9
galaxy_tags: []
dependencies: []
16 changes: 10 additions & 6 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
---
role_name_check: 1
dependency:
name: galaxy
driver:
name: docker
platforms:
- name: instance
image: ${MOLECULE_DOCKER_IMAGE:-'geerlingguy/docker-ubuntu1804-ansible:latest'}
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
image: "registry.gitlab.com/aussielunix/ansible/molecule-containers/${MOLECULE_DISTRO:-ubuntu:jammy}"
privileged: true
pre_build_image: true
override_command: false
tmpfs:
- /run
- /tmp
provisioner:
name: ansible
verifier:
name: ansible
playbooks:
converge: ${MOLECULE_PLAYBOOK:-converge.yml}
env:
ANSIBLE_VERBOSITY: ${MOLECULE_ANSIBLE_VERBOSITY:-0}
verifier:
name: ansible
5 changes: 1 addition & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
# pip requirements for testing
testinfra==3.4.0
pytest==5.3.2
docker==3.4.1
molecule==2.22
molecule[docker]
3 changes: 0 additions & 3 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
- include_tasks: setup-Ubuntu.yml
when: ansible_distribution == 'Ubuntu'

- include_tasks: setup-Debian.yml
when: ansible_distribution == 'Debian'

- name: Install NGINX
package:
name: nginx
Expand Down
5 changes: 0 additions & 5 deletions tasks/setup-Debian.yml

This file was deleted.

4 changes: 2 additions & 2 deletions tasks/setup-RedHat.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---

- name: Ensure nginx is installed.
package:
yum:
name: "{{ nginx_package_name }}"
state: present
state: present
16 changes: 13 additions & 3 deletions tasks/setup-Ubuntu.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
---

- name: Ensure nginx will reinstall if the PPA was just added.
- name: Add external PPA so we can get newer nginx version than what comes stock.
This was only really necessary on older Ubuntu versions (e.g. trusty and xenial).
Current ubuntu versions ship with a feature-complete nginx.
apt_repository:
repo: 'ppa:nginx/stable'
repo: 'ppa:nginx/stable'
codename: '{{ ansible_distribution_release }}'
when: ansible_distribution_version < '22.04'
register: nginx_ppa_add_result

- name: Refresh apt cache after adding PPA
apt:
update_cache: true
when: nginx_ppa_add_result is defined
and nginx_ppa_add_result.changed

0 comments on commit a990a72

Please sign in to comment.