constrict0r.sourcez

sourcez


.. image:: https://gitlab.com/constrict0r/sourcez/badges/master/pipeline.svg :alt: pipeline

.. image:: https://travis-ci.com/constrict0r/sourcez.svg :alt: travis

.. image:: https://readthedocs.org/projects/sourcez/badge :alt: readthedocs

Ansible-Rolle zum Hinzufügen von Repositories zu den apt-Quellen.

.. image:: https://gitlab.com/constrict0r/img/raw/master/sourcez/avatar.png :alt: avatar

Vollständige Dokumentation auf Readthedocs <https://sourcez.readthedocs.io>_.

Quellcode auf:

Github <https://github.com/constrict0r/sourcez>_.

Gitlab <https://gitlab.com/constrict0r/sourcez>_.

Teil von: <https://gitlab.com/explore/projects?tag=doombot>_

.. image:: https://gitlab.com/constrict0r/img/raw/master/sourcez/doombot.png :alt: doombot

Zutaten

.. image:: https://gitlab.com/constrict0r/img/raw/master/sourcez/ingredient.png :alt: ingredient

Inhalt


  • Beschreibung <#Description>_
  • Verwendung <#Usage>_
  • Variablen <#Variables>_
    • repositories <#repositories>_
    • configuration <#configuration>_
  • YAML <#YAML>_
  • Attribute <#Attributes>_
    • item_expand <#item-expand>_
    • item_path <#item-path>_
  • Anforderungen <#Requirements>_
  • Kompatibilität <#Compatibility>_
  • Lizenz <#License>_
  • Links <#Links>_
  • UML <#UML>_
    • Bereitstellung <#deployment>_
    • Haupt <#main>_
  • Autor <#Author>_

Beschreibung


Ansible-Rolle zum Hinzufügen von apt-Repositories zu den apt-Quellen.

Diese Rolle führt folgende Aktionen durch:

  • Sicherstellen, dass die Anforderungen installiert sind.

  • Sicherstellen, dass der aktuelle Benutzer administrative (Root) Berechtigungen erhalten kann.

  • Wenn die repositories-Variable definiert ist, die in ihr gelisteten Repositories zu den apt-Quellen hinzufügen.

  • Wenn die configuration-Variable definiert ist, die in ihr gelisteten Repositories zu den apt-Quellen hinzufügen.

Verwendung


  • Zum Installieren und Ausführen:

..

::

  ansible-galaxy install constrict0r.sourcez
  ansible localhost -m include_role -a name=constrict0r.sourcez -K
  • Variablen übergeben:

..

::

  ansible localhost -m include_role -a name=constrict0r.sourcez -K \
      -e "{repositories: [{name: multimedia, repo: 'deb http://www.debian-multimedia.org sid main'}]}"
  • Um die Rolle in einem Playbook einzuschließen:

..

::

  - hosts: servers
    roles:
        - {role: constrict0r.sourcez}
  • Um die Rolle als Abhängigkeit in einer anderen Rolle einzuschließen:

..

::

  dependencies:
    - role: constrict0r.sourcez
      repositories: [{name: multimedia, repo: 'deb http://www.debian-multimedia.org sid main'}]
  • Um die Rolle aus Aufgaben zu verwenden:

..

::

  - name: Rolle ausführen.
    import_role:
      name: constrict0r.sourcez
    vars:
      repositories: [{name: multimedia, repo: 'deb http://www.debian-multimedia.org sid main'}]

Zum Ausführen von Tests:

::

cd sourcez chmod +x testme.sh ./testme.sh

Bei einigen Tests müssen Sie möglicherweise sudo verwenden, um erfolgreich zu sein.

Variablen


Die folgenden Variablen werden unterstützt:

repositories

Liste der Repositories, die zu den apt-Quellen hinzugefügt werden sollen.

Diese Liste kann geändert werden, indem ein repositories-Array beim Einfügen der Rolle in ein Playbook oder über –extra-vars von einem Terminal übergeben wird.

Diese Variable ist standardmäßig leer.

::

Einfügen aus dem Terminal.

ansible localhost -m include_role -a name=constrict0r.sourcez -K -e
"{repositories: [{
name: multimedia,
repo: 'deb http://www.debian-multimedia.org sid main'
}]}}"

Einfügen in ein Playbook.

Zu einem Playbook vom Terminal.

ansible-playbook -i inventory my-playbook.yml -K -e
"{repositories: [{
name: multimedia,
repo: 'deb http://www.debian-multimedia.org sid main'
}]}}"

configuration

Absoluter Dateipfad oder URL zu einer .yml-Datei, die alle oder einige der von dieser Rolle unterstützten Variablen enthält.

Es wird empfohlen, für die configuration-Datei eine .yml- oder .yaml-Erweiterung zu verwenden.

Diese Variable ist standardmäßig leer.

::

Verwendung des Dateipfads.

ansible localhost -m include_role -a name=constrict0r.sourcez -K -e
"configuration=/home/username/my-config.yml"

Verwendung der URL.

ansible localhost -m include_role -a name=constrict0r.sourcez -K -e
"configuration=https://my-url/my-config.yml"

So schreiben Sie eine Konfigurationsdatei, finden Sie im Abschnitt YAML-Dateiformat.

YAML


Beim Übergeben von Konfigurationsdateien an diese Rolle als Parameter wird empfohlen, jeder Datei eine .yml- oder .yaml-Erweiterung hinzuzufügen.

Es wird auch empfohlen, drei Striche an den Anfang jeder Datei hinzufügen:

::


Sie können in der Datei die für Ihre Aufgaben benötigten Variablen einfügen:

::


repositories: - [{name: multimedia, repo: 'deb http://www.debian-multimedia.org sid main'}]

Wenn Sie möchten, dass diese Rolle eine Liste von Elementen aus Dateien und URLs lädt, können Sie die expand-Variable auf true setzen:

::


repositories: /home/username/my-config.yml

expand: true

Wenn die expand-Variable false ist, wird jeder gefundene Dateipfad oder jede URL als einfacher Text behandelt.

Attribute


Auf Elementebene können Sie Attribute verwenden, um zu konfigurieren, wie diese Rolle mit den Elementdaten umgeht.

Die von dieser Rolle unterstützten Attribute sind:

item_expand

Booleaner Wert, der angibt, ob dieses Element als Dateipfad oder URL behandelt wird oder einfach nur als einfacher Text.

::


repositories: - item_expand: true item_path: /home/username/my-config.yml

item_path

Absoluter Dateipfad oder URL zu einer .yml-Datei.

::


repositories: - item_path: /home/username/my-config.yml

Dieses Attribut funktioniert auch mit URLs.

Anforderungen


  • 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/>_.

Wenn Sie die Tests ausführen möchten, benötigen Sie außerdem:

  • Docker <https://www.docker.com/>_.

  • Molecule <https://molecule.readthedocs.io/>_.

  • Setuptools <https://pypi.org/project/setuptools/>_.

Kompatibilität


  • 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/>_.

Lizenz


MIT. Siehe die Lizenzdatei für weitere Details.

Links


  • Github <https://github.com/constrict0r/sourcez>_.

  • Gitlab <https://gitlab.com/constrict0r/sourcez>_.

  • Gitlab CI <https://gitlab.com/constrict0r/sourcez/pipelines>_.

  • Readthedocs <https://sourcez.readthedocs.io>_.

  • Travis CI <https://travis-ci.com/constrict0r/sourcez>_.

UML


Bereitstellung

Die gesamte Projektstruktur ist unten dargestellt:

.. image:: https://gitlab.com/constrict0r/img/raw/master/sourcez/deploy.png :alt: deploy

Haupt

Der Datenfluss des Projekts ist unten dargestellt:

.. image:: https://gitlab.com/constrict0r/img/raw/master/sourcez/main.png :alt: main

Autor


.. image:: https://gitlab.com/constrict0r/img/raw/master/sourcez/author.png :alt: author

Der reisende Vaudeville-Bösewicht.

Viel Spaß!!!

.. image:: https://gitlab.com/constrict0r/img/raw/master/sourcez/enjoy.png :alt: enjoy

Über das Projekt

Add apt repositories to Debian sources.

Installieren
ansible-galaxy install constrict0r.sourcez
GitHub Repository
Lizenz
mit
Downloads
2k
Besitzer
The Traveling Vaudeville Villain Gitlab: gitlab.com/constrict0r - Blog: geekl0g.wordpress.com - Twitter: twitter.com/constrict0r - Functional Café: is.gd/YDqy