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.
# All variables intended for modification should place placed in this file.
# All variables within this role should have a prefix of "validation_init"
validation_init_debug: false
validation_init_prefix: tripleo
validation_init_skeleton_role_dir: /tmp
validation_init_roles_dir: roles
validation_init_zuuld_molecule: zuul.d/molecule.yaml
validation_init_playbooks_dir: playbooks
validation_init_roles_doc_dir: doc/source/roles
validation_init_enabling_ci: true
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.
- Driver: podman:
Scenario: default¶
Molecule Platform(s)¶
- name: centos
hostname: centos
image: centos/centos:stream8
registry:
url: quay.io
dockerfile: ../../../../.config/molecule/Dockerfile
pkg_extras: python*-setuptools python*-pyyaml
volumes:
- /etc/ci/mirror_info.sh:/etc/ci/mirror_info.sh:ro
privileged: true
environment:
http_proxy: "{{ lookup('env', 'http_proxy') }}"
https_proxy: "{{ lookup('env', 'https_proxy') }}"
ulimits:
- host
Molecule Inventory¶
hosts:
all:
hosts:
centos:
ansible_python_interpreter: /usr/bin/python3
Example default playbook¶
- name: Converge
hosts: all
gather_facts: false
tasks:
- name: Create new role
include_role:
name: validation_init
vars:
validation_init_role_name: skeleton_test
validation_init_prefix: tripleo
validation_init_skeleton_role_dir: /tmp
validation_init_roles_dir: /tmp/roles
validation_init_zuuld_molecule: /tmp/zuul.d/molecule.yaml
validation_init_playbooks_dir: /tmp/playbooks
validation_init_roles_doc_dir: /tmp/doc/source/roles
- name: Create a new role with the same name
block:
- name: Run the validation_init role again
include_role:
name: validation_init
vars:
validation_init_role_name: skeleton_test
validation_init_prefix: tripleo
validation_init_skeleton_role_dir: /tmp
validation_init_roles_dir: /tmp/roles
validation_init_zuuld_molecule: /tmp/zuul.d/molecule.yaml
validation_init_playbooks_dir: /tmp/playbooks
validation_init_roles_doc_dir: /tmp/doc/source/roles
rescue:
- name: Clear host error
meta: clear_host_errors
- name: Role addition output
debug:
msg: The Role works! End the playbook run
- name: End play
meta: end_play
- name: Fail the test
fail:
msg: |
The validation_init role didn't properly detect that the role name was
already been taken!