Skip to content

Commit

Permalink
Merge pull request ome#370 from pwalczysko/fix-molecule
Browse files Browse the repository at this point in the history
first attempt to fix molecule
  • Loading branch information
jburel authored Jul 19, 2023
2 parents 4687065 + a88e669 commit bfefafb
Show file tree
Hide file tree
Showing 47 changed files with 1,355 additions and 1,108 deletions.
5 changes: 5 additions & 0 deletions .config/ansible-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# .config/ansible-lint.yml
warn_list: # or 'skip_list' to silence them completely
- experimental # all rules tagged as experimental
- latest[git] # Result of the command may vary on subsequent runs.
- no-changed-when # Commands should not change things if nothing needs doing.
20 changes: 14 additions & 6 deletions .github/workflows/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,34 @@ on:
jobs:

list-scenarios:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
outputs:
matrix: ${{ steps.listscenarios.outputs.scenarios }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- id: listscenarios
uses: ome/action-ansible-molecule-list-scenarios@main

test:
name: Test
needs:
- list-scenarios
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
strategy:
# Keep running so we can see if other tests pass
fail-fast: false
matrix:
scenario: ${{fromJson(needs.list-scenarios.outputs.matrix)}}
steps:
- uses: actions/checkout@v2
- uses: ome/action-ome-ansible-molecule@main
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
scenario: ${{ matrix.scenario }}
python-version: '3.8'
- name: Install Ansible & Molecule
run: |
pip install "ansible<8" "ansible-lint<6.13" flake8
pip install "molecule<5" "ansible-compat<4"
pip install molecule-plugins[docker] pytest-testinfra
pip3.8 install jmespath
- name: Run molecule
run: molecule test -s "${{ matrix.scenario }}"
54 changes: 28 additions & 26 deletions bootstrap/playbook.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,36 @@
---
# Playbook which runs the necessary root-level steps so that a host can be managed by others
- hosts: omedev
# Playbook which runs the necessary root-level steps
# so that a host can be managed by others
- name: Boot1
hosts: omedev
roles:

- role: ome.network
- role: ome.network

- role: ome.lvm_partition
lvm_lvname: var_log
lvm_lvmount: /var/log
lvm_lvsize: 4g
lvm_lvfilesystem: xfs
lvm_vgname: VolGroup00
- role: ome.lvm_partition
lvm_lvname: root
lvm_lvmount: /
lvm_lvsize: 100%FREE
lvm_lvfilesystem: xfs
lvm_vgname: VolGroup00
lvm_shrink: False
- role: ome.lvm_partition
lvm_lvname: var_log
lvm_lvmount: /var/log
lvm_lvsize: 4g
lvm_lvfilesystem: xfs
lvm_vgname: VolGroup00
- role: ome.lvm_partition
lvm_lvname: root
lvm_lvmount: /
lvm_lvsize: 100%FREE
lvm_lvfilesystem: xfs
lvm_vgname: VolGroup00
lvm_shrink: false

- role: ome.sudoers
sudoers_individual_commands:
- user: "%omedev"
become: ALL
command: "NOPASSWD: ALL"
- role: ome.sudoers
sudoers_individual_commands:
- user: "%omedev"
become: ALL
command: "NOPASSWD: ALL"

- role: ome.upgrade_distpackages
upgrade_distpackages_reboot_kernel: True
- role: ome.upgrade_distpackages
upgrade_distpackages_reboot_kernel: true


- hosts: vlan-10ge-servers, vlan-ome-idr-docker
- name: Network
hosts: vlan-10ge-servers, vlan-ome-idr-docker
roles:
- role: ome.network
- role: ome.network
5 changes: 3 additions & 2 deletions k8s/bootstrap/playbook.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
- hosts: vlan-10ge-servers
- name: Bootkub
hosts: vlan-10ge-servers
roles:
- role: ome.network
- role: ome.network
5 changes: 3 additions & 2 deletions k8s/prerequisites/playbook.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
- hosts: kubernetes-lochy-k8s
- name: Kuberneteslochy
hosts: kubernetes-lochy-k8s
roles:
# No mounts are configured, this just installs required packages
- role: ome.nfs_mount
- role: ome.nfs_mount
10 changes: 4 additions & 6 deletions molecule/bootstrap/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ dependency:
role-file: requirements.yml
driver:
name: docker
lint:
name: yamllint
# TODO: enable
enabled: False
lint: |
yamllint .
ansible-lint
flake8
platforms:
- name: omedev
image: centos:7
Expand All @@ -26,5 +26,3 @@ scenario:
- syntax
verifier:
name: testinfra
lint:
name: flake8
1 change: 0 additions & 1 deletion molecule/docker-prod/Dockerfile.j2

This file was deleted.

22 changes: 22 additions & 0 deletions molecule/docker-prod/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Molecule managed

{% if item.registry is defined %}
FROM {{ item.registry.url }}/{{ item.image }}
{% else %}
FROM {{ item.image }}
{% endif %}

{% if item.env is defined %}
{% for var, value in item.env.items() %}
{% if value %}
ENV {{ var }} {{ value }}
{% endif %}
{% endfor %}
{% endif %}

RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo python-jmespath bash ca-certificates iproute2 && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python*-dnf bash iproute && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo python36-jmespath python38-jmespath yum-plugin-ovl bash iproute ca-certificates && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml iproute2 && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates iproute2 && xbps-remove -O; fi
4 changes: 2 additions & 2 deletions molecule/docker-prod/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
set_fact:
redmine_tracker_db_host: "{{ hostname_ip.stdout }}"


- import_playbook: ../../omedev/docker-prod-apps.yml
- name: Import-playbook
import_playbook: ../../omedev/docker-prod-apps.yml
12 changes: 5 additions & 7 deletions molecule/docker-prod/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ dependency:
role-file: requirements.yml
driver:
name: docker
lint:
name: yamllint
# TODO: enable
enabled: False
lint: |
yamllint .
ansible-lint
flake8
platforms:
- name: ome-dockr-prod1.openmicroscopy.org
image: centos/systemd:latest
Expand Down Expand Up @@ -41,7 +41,7 @@ provisioner:

group_vars:
# all:
# molecule_test: True
# molecule_test: true
docker-hosts:
# This should allow docker-in-docker to work
docker_storage_driver: vfs
Expand All @@ -54,5 +54,3 @@ scenario:
name: docker-prod
verifier:
name: testinfra
lint:
name: flake8
5 changes: 3 additions & 2 deletions molecule/docker-prod/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
hosts: ome-dockr-prod1.openmicroscopy.org
roles:
- role: ome.postgresql
postgresql_version: "12"
postgresql_version: "13"
postgresql_server_auth:
- database: redmine
user: redmine
Expand All @@ -18,4 +18,5 @@
- redmine
postgresql_server_listen: "'*'"

- import_playbook: ../../omedev/playbook.yml
- name: Import playbook
import_playbook: ../../omedev/playbook.yml
1 change: 0 additions & 1 deletion molecule/nightshade-webclients/Dockerfile.j2

This file was deleted.

12 changes: 5 additions & 7 deletions molecule/nightshade-webclients/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ dependency:
role-file: requirements.yml
driver:
name: docker
lint:
name: yamllint
# TODO: enable
enabled: False
lint: |
yamllint .
ansible-lint
flake8
platforms:
- name: ns-webclients
image: centos/systemd
Expand All @@ -28,7 +28,7 @@ provisioner:
molecule_test: true
docker-hosts:
# firewalld isn't installed, don't attempt to disable
iptables_raw_disable_firewalld: False
iptables_raw_disable_firewalld: false
playbooks:
converge: ../../site.yml
lint:
Expand Down Expand Up @@ -56,5 +56,3 @@ scenario:
- destroy
verifier:
name: testinfra
lint:
name: flake8
10 changes: 4 additions & 6 deletions molecule/ome-demoserver/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ dependency:
role-file: requirements.yml
driver:
name: docker
lint:
name: yamllint
# TODO: enable
enabled: False
lint: |
yamllint .
ansible-lint
flake8
platforms:
- name: ome-demoserver
image: centos:7
Expand All @@ -31,5 +31,3 @@ scenario:
- syntax
verifier:
name: testinfra
lint:
name: flake8
1 change: 0 additions & 1 deletion molecule/ome-dundeeomero/Dockerfile.j2

This file was deleted.

22 changes: 22 additions & 0 deletions molecule/ome-dundeeomero/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Molecule managed

{% if item.registry is defined %}
FROM {{ item.registry.url }}/{{ item.image }}
{% else %}
FROM {{ item.image }}
{% endif %}

{% if item.env is defined %}
{% for var, value in item.env.items() %}
{% if value %}
ENV {{ var }} {{ value }}
{% endif %}
{% endfor %}
{% endif %}

RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates iproute2 && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python*-dnf bash iproute && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash iproute ca-certificates && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml iproute2 && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates iproute2 && xbps-remove -O; fi
16 changes: 7 additions & 9 deletions molecule/ome-dundeeomero/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ dependency:
role-file: requirements.yml
driver:
name: docker
lint:
name: yamllint
# TODO: enable
enabled: False
lint: |
yamllint .
ansible-lint
flake8
platforms:
- name: ome-dundeeomero.openmicroscopy.org
image: centos/systemd
Expand All @@ -22,15 +22,15 @@ provisioner:
name: ansible
options:
diff: true
skip-tags:
- skip_molecule
# skip-tags:
# - "skip_molecule"
inventory:
group_vars:
all:
molecule_test: true
docker-hosts:
# firewalld isn't installed, don't attempt to disable
iptables_raw_disable_firewalld: False
iptables_raw_disable_firewalld: false
playbooks:
converge: ../../site.yml
lint:
Expand All @@ -57,5 +57,3 @@ scenario:
- destroy
verifier:
name: testinfra
lint:
name: flake8
1 change: 0 additions & 1 deletion molecule/ome-pg-prod/Dockerfile.j2

This file was deleted.

10 changes: 4 additions & 6 deletions molecule/ome-pg-prod/molecule_disabled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ dependency:
role-file: requirements.yml
driver:
name: docker
lint:
name: yamllint
# TODO: enable
enabled: False
lint: |
yamllint .
ansible-lint
flake8
platforms:
- name: ome-pg-prod1.openmicroscopy.org
image: centos/systemd
Expand All @@ -26,5 +26,3 @@ scenario:
name: ome-pg-prod
verifier:
name: testinfra
lint:
name: flake8
9 changes: 5 additions & 4 deletions molecule/ome-pg-prod/prepare.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Workaround lack of cron on Docker
- hosts: ome-pg-prod1.openmicroscopy.org
- name: Prepare pg prod
hosts: ome-pg-prod1.openmicroscopy.org
tasks:
- name: Install cron
become: yes
yum:
- name: Install cron
become: true
ansible.builtin.yum:
name: cronie
state: present
1 change: 0 additions & 1 deletion molecule/omero-training-server/Dockerfile.j2

This file was deleted.

Loading

0 comments on commit bfefafb

Please sign in to comment.