constrict0r.sourcez

Sourcez


.. image:: https://gitlab.com/constrict0r/sourcez/badges/master/pipeline.svg
:alt: パイプライン

.. image:: https://travis-ci.com/constrict0r/sourcez.svg
:alt: トラビス

.. image:: https://readthedocs.org/projects/sourcez/badge
:alt: リードザドックス

aptソースにリポジトリを追加するためのAnsibleロールです。

.. image:: https://gitlab.com/constrict0r/img/raw/master/sourcez/avatar.png
:alt: アバター

詳細なドキュメントは Readthedocs <https://sourcez.readthedocs.io>_ にあります。

ソースコードは以下にあります:

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

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

Part of: <https://gitlab.com/explore/projects?tag=doombot>_

.. image:: https://gitlab.com/constrict0r/img/raw/master/sourcez/doombot.png
:alt: ドゥームボット

材料

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

内容


  • 説明 <#Description>_
  • 使用法 <#Usage>_
  • 変数 <#Variables>_
    • リポジトリ <#repositories>_
    • 設定 <#configuration>_
  • YAML <#YAML>_
  • 属性 <#Attributes>_
    • item_expand <#item-expand>_
    • item_path <#item-path>_
  • 要件 <#Requirements>_
  • 互換性 <#Compatibility>_
  • ライセンス <#License>_
  • リンク <#Links>_
  • UML <#UML>_
    • 展開 <#deployment>_
    • メイン <#main>_
  • 著者 <#Author>_

説明


aptソースにaptリポジトリを追加するためのAnsibleロールです。

このロールは以下のアクションを実行します:

  • 要件がインストールされていることを確認します。

  • 現在のユーザーが管理者(root)権限を取得できることを確認します。

  • repositories 変数が定義されている場合、そのリポジトリをaptソースに追加します。

  • configuration 変数が定義されている場合、そのリポジトリをaptソースに追加します。

使用法


  • インストールと実行を行うには:

..

::

  ansible-galaxy install constrict0r.sourcez  
  ansible localhost -m include_role -a name=constrict0r.sourcez -K
  • 変数を渡すには:

..

::

  ansible localhost -m include_role -a name=constrict0r.sourcez -K \
      -e "{repositories: [{name: multimedia, repo: 'deb http://www.debian-multimedia.org sid main'}]}"
  • プレイブックにロールを含めるには:

..

::

  - hosts: servers  
    roles:  
        - {role: constrict0r.sourcez}
  • 別のロールの依存関係としてロールを含めるには:

..

::

  dependencies:  
    - role: constrict0r.sourcez  
      repositories: [{name: multimedia, repo: 'deb http://www.debian-multimedia.org sid main'}]
  • タスクからロールを使用するには:

..

::

  - name: ロールタスクを実行する。  
    import_role:  
      name: constrict0r.sourcez  
    vars:  
      repositories: [{name: multimedia, repo: 'deb http://www.debian-multimedia.org sid main'}]

テストを実行するには:

::

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

一部のテストでは成功するために sudo を使用する必要があります。

変数


サポートされている変数は以下の通りです:

repositories

aptソースに追加するリポジトリのリスト。

このリストはプレイブックにロールを含める際にrepositories配列を渡すことで変更できます。

この変数はデフォルトでは空です。

::

ターミナルから含める。

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

プレイブックに含める。

ターミナルからプレイブックに。

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

configuration

このロールがサポートするすべてまたは一部の変数を含む*.yml*ファイルの絶対ファイルパスまたはURL。

configuration ファイルには*.ymlまたは.yaml*拡張子を使用することをお勧めします。

この変数はデフォルトでは空です。

::

ファイルパスを使用する。

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

URLを使用する。

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

設定ファイルの書き方については、YAMLファイル形式のセクションを参照してください。

YAML


このロールに設定ファイルをパラメーターとして渡す際は、各ファイルに*.ymlまたは.yaml*拡張子を追加することをお勧めします。

また、各ファイルの先頭に三つのダッシュを追加することも推奨します:

::


ファイルにはタスクに必要な変数を含めることができます:

::


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

このロールにファイルやURLからアイテムのリストを読み込ませたい場合は、expand変数をtrueに設定できます:

::


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

expand: true

expand変数がfalseの場合、見つかったファイルパスやURLはプレーンテキストとして扱われます。

属性


アイテムのレベルで、このロールがアイテムデータをどのように処理するかを設定するために属性を使用できます。

このロールでサポートされている属性は以下の通りです:

item_expand

このアイテムをファイルパスまたはURLとして扱うか、単にプレーンテキストとして扱うかを示すブール値。

::


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

item_path

.ymlファイルの絶対ファイルパスまたはURL。

::


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

この属性はURLでも動作します。

要件


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

テストを実行するには、以下も必要です:

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

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

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

互換性


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

ライセンス


MIT。詳細はLICENSEファイルを参照してください。

リンク


  • 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


展開

プロジェクト全体の構造は以下に示されています:

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

メイン

プロジェクトのデータフローは以下に示されています:

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

著者


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

旅行するバウデビルの悪役。

お楽しみください!!!

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

プロジェクトについて

Add apt repositories to Debian sources.

インストール
ansible-galaxy install constrict0r.sourcez
ライセンス
mit
ダウンロード
2k
所有者
The Traveling Vaudeville Villain Gitlab: gitlab.com/constrict0r - Blog: geekl0g.wordpress.com - Twitter: twitter.com/constrict0r - Functional Café: is.gd/YDqy