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'
}]}}"
プレイブックに含める。
- hosts: servers
roles:- role: constrict0r.sourcez
repositories:- name: multimedia
repo: deb http://www.debian-multimedia.org sid main
- name: multimedia
- role: constrict0r.sourcez
ターミナルからプレイブックに。
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