Commit da08b216 authored by constrict0r's avatar constrict0r 💬

Imports initial files

parents
Pipeline #136054304 passed with stage
in 12 minutes and 16 seconds
---
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Add execution permissions to testme.sh.
run: chmod +x testme.sh
- name: Execute tests.
run: sudo bash -H -c './testme.sh -i -k'
\ No newline at end of file
# Ansible.
*.retry
.galaxy_install_info
# Binaries.
*.jpg
# Buffers.
*~
# C extensions.
*.so
# Coverage.
cover
.coverage
.coveralls.yml
htmlcov
# Editors.
.#.*
#.*#
# Emacs.
dconf/
#*
~*
*/#*
*flymake.py
# Jupyter.
.ipynb_checkpoints
.ipython
.jupyter
.local
# Org Mode.
*~
index.org
public/
# Python.
build/
develop-eggs
dist/
*.egg
*.egg-info
eggs
.installed.cfg
bin
lib
lib64
var
sdist
pip-log.txt
*.pyc
*.py[cod]
__pycache__
.pytest_cache
.tox
# Sphinx.
build
docs/source/build
# Tests generated files.
tests/library
tests/test_plugins
.yamllint
# Temporary.
.cache
# Translations.
.mo
\ No newline at end of file
---
stages:
- test
molecule:
image: docker:git
stage: test
services:
- docker:dind
before_script:
- apk update && apk add --no-cache docker
python3-dev py3-pip docker gcc git curl build-base
autoconf automake py3-cryptography linux-headers
musl-dev libffi-dev openssl-dev openssh
- pip3 install ansible flake8 molecule[docker]
script:
- molecule test
\ No newline at end of file
[submodule "doc/source/part"]
path = doc/source/part
url = https://gitlab.com/constrict0r/part.git
---
version: 2
sphinx:
configuration: doc/source/conf.py
python:
version: 3.7
install:
- requirements: doc/requirements.txt
submodules:
include: all
\ No newline at end of file
---
os: linux
language: python
python:
- '3.7'
jobs:
include:
- os: linux
dist: bionic
- os: linux
dist: xenial
before_script:
- chmod +x testme.sh
script:
- sudo bash -H -c './testme.sh -i -k'
after_success:
- coveralls
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/
\ No newline at end of file
The MIT License (MIT)
Copyright (c) 2019 constrict0r
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
\ No newline at end of file
upgrade
*******
.. image:: https://gitlab.com/constrict0r/upgrade/badges/master/pipeline.svg
:alt: pipeline
.. image:: https://travis-ci.com/constrict0r/upgrade.svg
:alt: travis
.. image:: https://readthedocs.org/projects/upgrade/badge
:alt: readthedocs
Ansible role to apply a system upgrade.
.. image:: https://gitlab.com/constrict0r/img/raw/master/upgrade/avatar.png
:alt: avatar
Full documentation on `Readthedocs <https://upgrade.readthedocs.io>`_.
Source code on:
`Github <https://github.com/constrict0r/upgrade>`_.
`Gitlab <https://gitlab.com/constrict0r/upgrade>`_.
`Part of: <https://gitlab.com/explore/projects?tag=doombot>`_
.. image:: https://gitlab.com/constrict0r/img/raw/master/upgrade/doombot.png
:alt: doombot
**Ingredients**
.. image:: https://gitlab.com/constrict0r/img/raw/master/upgrade/ingredient.png
:alt: ingredient
Contents
********
* `Description <#Description>`_
* `Usage <#Usage>`_
* `Variables <#Variables>`_
* `upgrade <#upgrade>`_
* `configuration <#configuration>`_
* `YAML <#YAML>`_
* `Requirements <#Requirements>`_
* `Compatibility <#Compatibility>`_
* `License <#License>`_
* `Links <#Links>`_
* `UML <#UML>`_
* `Deployment <#deployment>`_
* `Main <#main>`_
* `Author <#Author>`_
Description
***********
Ansible role to apply a system upgrade.
This role performs the following actions:
* Ensure the requirements are installed.
* Ensure the current user can obtain administrative (root)
permissions.
* Update the apt cache.
* If the **upgrade** variable is set to *true* or if the
**configuration** file contains a variable **upgrade** setted to
*true*, perform a full system upgrade.
Usage
*****
* To install and execute:
..
::
ansible-galaxy install constrict0r.upgrade
ansible localhost -m include_role -a name=constrict0r.upgrade -K
* Passing variables:
..
::
ansible localhost -m include_role -a name=constrict0r.upgrade -K \
-e "upgrade: false"
* To include the role on a playbook:
..
::
- hosts: servers
roles:
- {role: constrict0r.upgrade}
* To include the role as dependency on another role:
..
::
dependencies:
- role: constrict0r.upgrade
upgrade: true
* To use the role from tasks:
..
::
- name: Execute role task.
import_role:
name: constrict0r.upgrade
vars:
upgrade: true
To run tests:
::
cd upgrade
chmod +x testme.sh
./testme.sh
On some tests you may need to use *sudo* to succeed.
Variables
*********
The following variables are supported:
upgrade
=======
Boolean variable that defines if a system full upgrade is performed or
not.
If set to *true* a full system upgrade is executed.
This variable is set to *true* by default.
::
# Including from terminal.
ansible localhost -m include_role -a name=constrict0r.upgrade -K -e \
"upgrade=false"
# Including on a playbook.
- hosts: servers
roles:
- role: constrict0r.upgrade
upgrade: false
# To a playbook from terminal.
ansible-playbook -i tests/inventory tests/test-playbook.yml -K -e \
"upgrade=false"
configuration
=============
Absolute file path or URL to a *.yml* file that contains all or some
of the variables supported by this role.
It is recommended to use a *.yml* or *.yaml* extension for the
**configuration** file.
This variable is empty by default.
::
# Using file path.
ansible localhost -m include_role -a name=constrict0r.upgrade -K -e \
"configuration=/home/username/my-config.yml"
# Using URL.
ansible localhost -m include_role -a name=constrict0r.upgrade -K -e \
"configuration=https://my-url/my-config.yml"
To see how to write a configuration file see the *YAML* file format
section.
YAML
****
When passing configuration files to this role as parameters, it’s
recommended to add a *.yml* or *.yaml* extension to the each file.
It is also recommended to add three dashes at the top of each file:
::
---
You can include in the file the variables required for your tasks:
::
---
upgrade:
- true
If you want this role to load list of items from files and URLs you
can set the **expand** variable to *true*:
::
---
upgrade: /home/username/my-config.yml
expand: true
If the expand variable is *false*, any file path or URL found will be
treated like plain text.
Requirements
************
* `Ansible <https://www.ansible.com>`_ >= 2.8.
* `Jinja2 <https://palletsprojects.com/p/jinja/>`_.
* `Pip <https://pypi.org/project/pip/>`_.
* `Python <https://www.python.org/>`_.
* `PyYAML <https://pyyaml.org/>`_.
* `Requests <https://2.python-requests.org/en/master/>`_.
If you want to run the tests, you will also need:
* `Docker <https://www.docker.com/>`_.
* `Molecule <https://molecule.readthedocs.io/>`_.
* `Setuptools <https://pypi.org/project/setuptools/>`_.
Compatibility
*************
* `Debian Buster <https://wiki.debian.org/DebianBuster>`_.
* `Debian Raspbian <https://raspbian.org/>`_.
* `Debian Stretch <https://wiki.debian.org/DebianStretch>`_.
* `Ubuntu Xenial <http://releases.ubuntu.com/16.04/>`_.
License
*******
MIT. See the LICENSE file for more details.
Links
*****
* `Github <https://github.com/constrict0r/upgrade>`_.
* `Gitlab <https://gitlab.com/constrict0r/upgrade>`_.
* `Gitlab CI <https://gitlab.com/constrict0r/upgrade/pipelines>`_.
* `Readthedocs <https://upgrade.readthedocs.io>`_.
* `Travis CI <https://travis-ci.com/constrict0r/upgrade>`_.
UML
***
Deployment
==========
The full project structure is shown below:
.. image:: https://gitlab.com/constrict0r/img/raw/master/upgrade/deploy.png
:alt: deploy
Main
====
The project data flow is shown below:
.. image:: https://gitlab.com/constrict0r/img/raw/master/upgrade/main.png
:alt: main
Author
******
.. image:: https://gitlab.com/constrict0r/img/raw/master/upgrade/author.png
:alt: author
The Travelling Vaudeville Villain.
Enjoy!!!
.. image:: https://gitlab.com/constrict0r/img/raw/master/upgrade/enjoy.png
:alt: enjoy
sphinxcontrib-restbuilder
sphinxcontrib-globalsubs
sphinx-prompt
Sphinx-Substitution-Extensions
sphinx_rtd_theme
\ No newline at end of file
MIT. See the LICENSE file for more details.
\ No newline at end of file
Author
----------------------------------------------------------------
.. include:: part/author.inc
.. include:: part/enjoy.inc
\ No newline at end of file
Compatibility
----------------------------------------------------------------
.. include:: part/compatibility/buster.inc
.. include:: part/compatibility/raspbian.inc
.. include:: part/compatibility/stretch.inc
.. include:: part/compatibility/xenial.inc
\ No newline at end of file
# Configuration file for the Sphinx documentation builder.
import os
import sys
project = "upgrade"
copyright = "2019, constrict0r"
author = "constrict0r"
version = "0.0.1"
release = "0.0.1"
sys.path.insert(0, os.path.abspath("../.."))
extensions = [
"sphinxcontrib.restbuilder",
"sphinxcontrib.globalsubs",
"sphinx-prompt",
"sphinx_substitution_extensions"
]
templates_path = ["_templates"]
exclude_patterns = []
html_static_path = ["_static"]
html_theme = "sphinx_rtd_theme"
master_doc = "index"
img_base_url = "https://gitlab.com/" + author + "/img/raw/master/"
img_url = img_base_url + project + "/"
author_img = ".. image:: " + img_url + "author.png\n :alt: author"
author_slogan = "The Travelling Vaudeville Villain."
github_base_url = "https://github.com/"
github_url = github_base_url + author + "/" + project
github_link = "`Github <" + github_url + ">`_."
gitlab_base_url = "https://gitlab.com/"
gitlab_url = gitlab_base_url + author + "/" + project
gitlab_badge = gitlab_url + "/badges/master/pipeline.svg\n :alt: pipeline"
gitlab_ci_url = gitlab_url + "/pipelines"
gitlab_ci_link = "`Gitlab CI <" + gitlab_ci_url + ">`_."
gitlab_link = "`Gitlab <" + gitlab_url + ">`_."
travis_base_url = "https://travis-ci.com/"
travis_url = travis_base_url + author + "/" + project
travis_badge = ".. image:: " + travis_url + ".svg\n :alt: travis"
travis_ci_url = travis_url
travis_link = "`Travis CI <" + travis_url + ">`_."
readthedocs_url = "https://" + project + ".readthedocs.io"
readthedocs_badge = "/projects/" + project + "/badge\n :alt: readthedocs"
readthedocs_link = "`Readthedocs <" + readthedocs_url + ">`_."
global_substitutions = {
"AUTHOR_IMG": author_img,
"AUTHOR_SLOGAN": author_slogan,
"AVATAR_IMG": ".. image:: " + img_url + "avatar.png\n :alt: avatar",
"DEFAULT_VAR_NAME": 'upgrade',
"DEPLOY_IMG": ".. image:: " + img_url + "/deploy.png\n :alt: deploy",
"DOOMBOT_IMG": ".. image:: " + img_url + "/doombot.png\n :alt: doombot",
"ENJOY_IMG": ".. image:: " + img_url + "/enjoy.png\n :alt: enjoy",
"GITLAB_BADGE": ".. image:: " + gitlab_badge,
"GITLAB_CI_LINK": gitlab_ci_link,
"GITHUB_LINK": github_link,
"GITLAB_LINK": gitlab_link,
"INGREDIENT_IMG": ".. image:: " + img_url +
"/ingredient.png\n :alt: ingredient",
"MAIN_IMG": ".. image:: " + img_url + "/main.png\n :alt: main",
"PROJECT": project,
"READTHEDOCS_BADGE": ".. image:: https://rtfd.io" + readthedocs_badge,
"READTHEDOCS_LINK": readthedocs_link,
"TRAVIS_BADGE": travis_badge,
"TRAVIS_LINK": travis_link
}
substitutions = [
("|AUTHOR|", author),
("|DEFAULT_ROLE_VARS|", '-e "upgrade: false"'),
("|DEFAULT_VAR_NAME|", 'upgrade'),
("|DEFAULT_VAR_VALUE|", 'true'),
("|PROJECT|", project)
]