From c7e6392093227a7b6bbad6892d3a22521ae6ef52 Mon Sep 17 00:00:00 2001 From: teramako Date: Fri, 3 Feb 2023 20:44:18 +0900 Subject: [PATCH] update README - add Mermaid.js sample - udpate PlantUML image(SVG) --- README.md | 78 ++++++++++++++++++++++++++++++++++++++++++- docs/img/sample_1.svg | 78 +------------------------------------------ 2 files changed, 78 insertions(+), 78 deletions(-) diff --git a/README.md b/README.md index da36144..06391e1 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ Role: BASE_DIR The base directory.[default=current directory] ``` +### PlantUML The PlantUML code is out to stdout. ```console $ playbook2uml path/to/playbook.yml --title "hello_world.yml" @@ -60,10 +61,85 @@ playbook2uml path/to/playbook.yml --title "Sample 1" | \ curl --data-binary @- http://plantuml-server.example.com/svg/ -o - > path/to/foo.svg ``` -## Output +#### Output (PlantUML) ![plantuml svg](docs/img/sample_1.svg) +### Mermaid.js + +```console +$ playbook2uml path/to/playbook.yml -t mermaid +stateDiagram-v2 + state "Play: Sample 1" as play_1 { + state "Create directory
action: file" as task_1 + block_1 : Execute python script + state block_1 { + state "Get python script from web
action: get_url" as task_2 + block_1_always : Always + state block_1_always { + state "execute
action: command" as task_3 + state task_4_when <> + note right of task_4_when + when + - exec_result.rc != 0 + end note + state "debug
action: debug" as task_4 + } + block_1_rescue : Rescue + state block_1_rescue { + state "Use local file
action: copy" as task_5 + } + } + state "End Message
action: debug" as task_6 + } + [*] --> task_1 + task_1 --> task_2 + task_2 --> task_3 + task_3 --> task_4_when + task_4_when --> task_4 + task_4 --> task_6 + task_4_when --> task_6 : skip + task_5 --> task_3 + task_6 --> [*] +``` + +#### Output (Mermaid.js) + +```mermaid +stateDiagram-v2 + state "Play: Sample 1" as play_1 { + state "Create directory
action: file" as task_1 + block_1 : Execute python script + state block_1 { + state "Get python script from web
action: get_url" as task_2 + block_1_always : Always + state block_1_always { + state "execute
action: command" as task_3 + state task_4_when <> + note right of task_4_when + when + - exec_result.rc != 0 + end note + state "debug
action: debug" as task_4 + } + block_1_rescue : Rescue + state block_1_rescue { + state "Use local file
action: copy" as task_5 + } + } + state "End Message
action: debug" as task_6 + } + [*] --> task_1 + task_1 --> task_2 + task_2 --> task_3 + task_3 --> task_4_when + task_4_when --> task_4 + task_4 --> task_6 + task_4_when --> task_6 : skip + task_5 --> task_3 + task_6 --> [*] +``` + ## Requirements - `ansible` >= 2.9 diff --git a/docs/img/sample_1.svg b/docs/img/sample_1.svg index 498f809..da085a6 100644 --- a/docs/img/sample_1.svg +++ b/docs/img/sample_1.svg @@ -1,77 +1 @@ -Sample 1Play: Sample 1hostslocalhostBlock: Execute python scriptAlwaysRescueCreate directoryActionfilepath/path/to/dirstatedirectoryEnd MessageActiondebugmsgEndGet python script from webActionget_urlurlhttps://example.com/path/file.pydest/path/to/dir/file.pymode0700executeActioncommandexecutable/usr/bin/python3_raw_params/paty/to/dir/file.pybecomeyesregisterexec_resultwhen- exec_result.rc != 0debugActiondebugvarexec_result.stderr_linesUse local fileActioncopysrcpath/to/file.pydest/path/to/dir/file.pymode0700skip \ No newline at end of file +Play: Sample 1gather_factsNonehostslocalhostserial[]strategylinearBlock: Execute python scriptAlwaysRescueCreate directoryActionfilepath/path/to/dirstatedirectoryEnd MessageActiondebugmsgEndGet python script from webActionget_urlurlhttps://example.com/path/file.pydest/path/to/dir/file.pymode0700executeActioncommandexecutable/usr/bin/python3_raw_params/paty/to/dir/file.pybecomeyesregister exec_resultwhen- exec_result.rc != 0debugActiondebugvarexec_result.stderr_linesUse local fileActioncopysrcpath/to/file.pydest/path/to/dir/file.pymode0700skip \ No newline at end of file