mirror of
https://github.com/KevinMidboe/playbooks-retailor.git
synced 2026-02-15 13:59:39 +00:00
ansible playbooks for retailor.io infrastructure
This commit is contained in:
22
roles/oh-my-zsh/molecule/default/INSTALL.rst
Normal file
22
roles/oh-my-zsh/molecule/default/INSTALL.rst
Normal file
@@ -0,0 +1,22 @@
|
||||
*******
|
||||
Docker driver installation guide
|
||||
*******
|
||||
|
||||
Requirements
|
||||
============
|
||||
|
||||
* Docker Engine
|
||||
|
||||
Install
|
||||
=======
|
||||
|
||||
Please refer to the `Virtual environment`_ documentation for installation best
|
||||
practices. If not using a virtual environment, please consider passing the
|
||||
widely recommended `'--user' flag`_ when invoking ``pip``.
|
||||
|
||||
.. _Virtual environment: https://virtualenv.pypa.io/en/latest/
|
||||
.. _'--user' flag: https://packaging.python.org/tutorials/installing-packages/#installing-to-the-user-site
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ python3 -m pip install 'molecule[docker]'
|
||||
68
roles/oh-my-zsh/molecule/default/converge.yml
Normal file
68
roles/oh-my-zsh/molecule/default/converge.yml
Normal file
@@ -0,0 +1,68 @@
|
||||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
|
||||
pre_tasks:
|
||||
|
||||
- name: update apt cache
|
||||
apt:
|
||||
update_cache: yes
|
||||
when: ansible_os_family == 'Debian'
|
||||
changed_when: no
|
||||
|
||||
- name: create test users
|
||||
become: yes
|
||||
user:
|
||||
name: '{{ item }}'
|
||||
home: '/home/{{ item }}'
|
||||
createhome: yes
|
||||
with_items:
|
||||
- test_usr1
|
||||
- test_usr2
|
||||
- test_usr3
|
||||
- test_usr4
|
||||
- test_usr5
|
||||
|
||||
- name: install console-setup file
|
||||
become: yes
|
||||
copy:
|
||||
src: tests/console-setup.sh
|
||||
dest: /etc/default/console-setup
|
||||
force: no
|
||||
owner: root
|
||||
group: root
|
||||
mode: 'u=rwx,go=r'
|
||||
|
||||
roles:
|
||||
- role: ansible-role-oh-my-zsh
|
||||
oh_my_zsh_theme: test_theme1
|
||||
oh_my_zsh_plugins:
|
||||
- test_plugin1
|
||||
- test_plugin2
|
||||
users:
|
||||
- username: test_usr1
|
||||
- username: test_usr2
|
||||
oh_my_zsh:
|
||||
theme: test_theme2
|
||||
plugins:
|
||||
- test_plugin3
|
||||
- test_plugin4
|
||||
- username: test_usr3
|
||||
oh_my_zsh:
|
||||
install: no
|
||||
|
||||
- role: ansible-role-oh-my-zsh
|
||||
oh_my_zsh_theme: test_theme1
|
||||
oh_my_zsh_plugins:
|
||||
- test_plugin1
|
||||
- test_plugin2
|
||||
oh_my_zsh_install: no
|
||||
users:
|
||||
- username: test_usr4
|
||||
- username: test_usr5
|
||||
oh_my_zsh:
|
||||
install: yes
|
||||
theme: test_theme2
|
||||
plugins:
|
||||
- test_plugin3
|
||||
- test_plugin4
|
||||
34
roles/oh-my-zsh/molecule/default/molecule.yml
Normal file
34
roles/oh-my-zsh/molecule/default/molecule.yml
Normal file
@@ -0,0 +1,34 @@
|
||||
---
|
||||
dependency:
|
||||
name: galaxy
|
||||
|
||||
driver:
|
||||
name: docker
|
||||
|
||||
lint: |
|
||||
set -e
|
||||
yamllint .
|
||||
ansible-lint
|
||||
flake8
|
||||
|
||||
platforms:
|
||||
- name: ansible-role-oh-my-zsh-debian-min
|
||||
image: debian:8
|
||||
- name: ansible-role-oh-my-zsh-debian-max
|
||||
image: debian:9
|
||||
- name: ansible-role-oh-my-zsh-ubuntu-min
|
||||
image: ubuntu:16.04
|
||||
- name: ansible-role-oh-my-zsh-ubuntu-max
|
||||
image: ubuntu:18.04
|
||||
- name: ansible-role-oh-my-zsh-centos
|
||||
image: centos:7
|
||||
- name: ansible-role-oh-my-zsh-fedora
|
||||
image: fedora:31
|
||||
- name: ansible-role-oh-my-zsh-opensuse
|
||||
image: opensuse/leap:15.1
|
||||
|
||||
provisioner:
|
||||
name: ansible
|
||||
|
||||
verifier:
|
||||
name: testinfra
|
||||
23
roles/oh-my-zsh/molecule/default/tests/conftest.py
Normal file
23
roles/oh-my-zsh/molecule/default/tests/conftest.py
Normal file
@@ -0,0 +1,23 @@
|
||||
"""PyTest Fixtures."""
|
||||
from __future__ import absolute_import
|
||||
|
||||
import os
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
def pytest_runtest_setup(item):
|
||||
"""Run tests only when under molecule with testinfra installed."""
|
||||
try:
|
||||
import testinfra
|
||||
except ImportError:
|
||||
pytest.skip("Test requires testinfra", allow_module_level=True)
|
||||
if "MOLECULE_INVENTORY_FILE" in os.environ:
|
||||
pytest.testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
|
||||
os.environ["MOLECULE_INVENTORY_FILE"]
|
||||
).get_hosts("all")
|
||||
else:
|
||||
pytest.skip(
|
||||
"Test should run only from inside molecule.",
|
||||
allow_module_level=True
|
||||
)
|
||||
16
roles/oh-my-zsh/molecule/default/tests/console-setup.sh
Normal file
16
roles/oh-my-zsh/molecule/default/tests/console-setup.sh
Normal file
@@ -0,0 +1,16 @@
|
||||
# CONFIGURATION FILE FOR SETUPCON
|
||||
|
||||
# Consult the console-setup(5) manual page.
|
||||
|
||||
ACTIVE_CONSOLES="/dev/tty[1-6]"
|
||||
|
||||
CHARMAP="ISO-8859-1"
|
||||
|
||||
CODESET="Lat15"
|
||||
FONTFACE="VGA"
|
||||
FONTSIZE="8x16"
|
||||
|
||||
VIDEOMODE=
|
||||
|
||||
# The following is an example how to use a braille font
|
||||
# FONT='lat9w-08.psf.gz brl-8x8.psf'
|
||||
50
roles/oh-my-zsh/molecule/default/tests/test_role.py
Normal file
50
roles/oh-my-zsh/molecule/default/tests/test_role.py
Normal file
@@ -0,0 +1,50 @@
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.mark.parametrize('username', [
|
||||
'test_usr1',
|
||||
'test_usr2',
|
||||
'test_usr5',
|
||||
])
|
||||
def test_oh_my_zsh_install(host, username):
|
||||
oh_my_zsh = host.file('/home/' + username + '/.oh-my-zsh')
|
||||
assert oh_my_zsh.exists
|
||||
assert oh_my_zsh.is_directory
|
||||
assert oh_my_zsh.user == username
|
||||
assert oh_my_zsh.group in [username, 'users']
|
||||
|
||||
|
||||
@pytest.mark.parametrize('username', [
|
||||
'test_usr3',
|
||||
'test_usr4',
|
||||
])
|
||||
def test_oh_my_zsh_is_not_installed_for_excluded_users(host, username):
|
||||
oh_my_zsh = host.file('/home/' + username + '/.oh-my-zsh')
|
||||
zshrc = host.file('/home/' + username + '/.zshrc')
|
||||
assert not oh_my_zsh.exists
|
||||
assert not zshrc.exists
|
||||
|
||||
|
||||
@pytest.mark.parametrize('username,theme,plugins', [
|
||||
('test_usr1', 'test_theme1', 'test_plugin1 test_plugin2'),
|
||||
('test_usr2', 'test_theme2', 'test_plugin3 test_plugin4'),
|
||||
])
|
||||
def test_oh_my_zsh_config(host, username, theme, plugins):
|
||||
zshrc = host.file('/home/' + username + '/.zshrc')
|
||||
assert zshrc.exists
|
||||
assert zshrc.is_file
|
||||
assert zshrc.user == username
|
||||
assert zshrc.group in [username, 'users']
|
||||
assert zshrc.contains(theme)
|
||||
assert zshrc.contains(plugins)
|
||||
|
||||
|
||||
def test_console_setup(host):
|
||||
# console-setup is Debian family specific
|
||||
if host.file('/etc/debian_version').exists:
|
||||
setup = host.file('/etc/default/console-setup')
|
||||
assert setup.exists
|
||||
assert setup.is_file
|
||||
assert setup.user == 'root'
|
||||
assert setup.group == 'root'
|
||||
assert setup.contains('CHARMAP="UTF-8"')
|
||||
Reference in New Issue
Block a user