validation_init¶
Validation_init
===============
The purpose of this `validation_init` role is to create new validation from a skeleton.
Requirements
------------
None.
Role Variables
--------------
* `validation_init_debug`: <'false'> -- Debugging mode.
* `validation_init_role_name`: <'Undefined'> -- New role name, undefined by default!
* `validation_init_prefix`: <'tripleo'> -- New role prefix
* `validation_init_skeleton_role_dir`: <'/tmp'> -- Absolute path of the directory where the skeleton will be deployed
* `validation_init_roles_dir`: <'roles'> -- Absolute/Relative path to the roles directory where the new roles will be created
* `validation_init_zuuld_molecule`: <'zuul.d/molecule.yaml'> -- Relative path to the CI molecule yaml file
* `validation_init_playbooks_dir`: <'playbooks'> -- Relative path to the playbooks directory where the new playbook will be created
* `validation_init_roles_doc_dir`: <'doc/source/roles'> -- Relative path to documentation roles directory
* `validation_init_enabling_ci`: <'true'> -- If 'true', documentation and CI configuration will be done, otherwise not
Dependencies
------------
None.
Example Playbook
----------------
- name: Create my new role
hosts: localhost
connection: local
gather_facts: false
roles:
- { role: validation_init, validation_init_role_name: "mynewrolename"}
License
-------
Apache
Author Information
------------------
Red hat TripleO DFG:DF Squad:VF
Role Documentation¶
Welcome to the “validation_init” role documentation.
Role Defaults¶
This section highlights all of the defaults and variables set within the “validation_init” role.
validation_init_debug: false
validation_init_enabling_ci: true
validation_init_playbooks_dir: playbooks
validation_init_prefix: tripleo
validation_init_roles_dir: roles
validation_init_roles_doc_dir: doc/source/roles
validation_init_skeleton_role_dir: /tmp
validation_init_zuuld_molecule: zuul.d/molecule.yaml
Molecule Scenarios¶
Molecule is being used to test the “validation_init” role. The following section highlights the drivers in service and provides an example playbook showing how the role is leveraged.
Scenario: default¶
Example default configuration¶
driver:
name: podman
log: true
platforms:
- dockerfile: ../../../../.config/molecule/Dockerfile
environment:
http_proxy: '{{ lookup(''env'', ''http_proxy'') }}'
https_proxy: '{{ lookup(''env'', ''https_proxy'') }}'
hostname: centos
image: centos/centos:stream8
name: centos
pkg_extras: python*-setuptools python*-pyyaml
privileged: true
registry:
url: quay.io
ulimits:
- host
volumes:
- /etc/ci/mirror_info.sh:/etc/ci/mirror_info.sh:ro
provisioner:
env:
ANSIBLE_LIBRARY: ${ANSIBLE_LIBRARY:-/usr/share/ansible/plugins/modules}
ANSIBLE_ROLES_PATH: ${ANSIBLE_ROLES_PATH}:${HOME}/zuul-jobs/roles
ANSIBLE_STDOUT_CALLBACK: yaml
inventory:
hosts:
all:
hosts:
centos:
ansible_python_interpreter: /usr/bin/python3
log: true
name: ansible
options:
vvv: true
scenario:
test_sequence:
- destroy
- create
- prepare
- converge
- verify
- destroy
verifier:
name: ansible
Molecule Inventory¶
hosts:
all:
hosts:
centos:
ansible_python_interpreter: /usr/bin/python3
Example default playbook¶
- gather_facts: false
hosts: all
name: Converge
tasks:
- include_role:
name: validation_init
name: Create new role
vars:
validation_init_playbooks_dir: /tmp/playbooks
validation_init_prefix: tripleo
validation_init_role_name: skeleton_test
validation_init_roles_dir: /tmp/roles
validation_init_roles_doc_dir: /tmp/doc/source/roles
validation_init_skeleton_role_dir: /tmp
validation_init_zuuld_molecule: /tmp/zuul.d/molecule.yaml
- block:
- include_role:
name: validation_init
name: Run the validation_init role again
vars:
validation_init_playbooks_dir: /tmp/playbooks
validation_init_prefix: tripleo
validation_init_role_name: skeleton_test
validation_init_roles_dir: /tmp/roles
validation_init_roles_doc_dir: /tmp/doc/source/roles
validation_init_skeleton_role_dir: /tmp
validation_init_zuuld_molecule: /tmp/zuul.d/molecule.yaml
name: Create a new role with the same name
rescue:
- meta: clear_host_errors
name: Clear host error
- debug:
msg: The Role works! End the playbook run
name: Role addition output
- meta: end_play
name: End play
- fail:
msg: 'The validation_init role didn''t properly detect that the role name was
already been taken!
'
name: Fail the test