Update: Jupyter playbook

This commit is contained in:
mrjk 2022-02-14 15:34:28 -05:00
parent 34587710b3
commit 00f87bb4f7

View File

@ -10,7 +10,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": 3,
"id": "98d4907b", "id": "98d4907b",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -18,12 +18,12 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"/home/jez/volumes/data/prj/bell/training/tiger-ansible/ext/kheops\n" "/home/jez/prj/bell/dev/kheops\n"
] ]
} }
], ],
"source": [ "source": [
"cd /home/jez/volumes/data/prj/bell/training/tiger-ansible/ext/kheops\n", "cd ${KHEOPS_EXAMPLES_DIR:-/dev/null}\n",
"echo $PWD\n", "echo $PWD\n",
"export KHEOPS_NAMESPACE=ex1_enc \n", "export KHEOPS_NAMESPACE=ex1_enc \n",
"export KHEOPS_CONFIG=examples/kheops.yml\n", "export KHEOPS_CONFIG=examples/kheops.yml\n",
@ -48,7 +48,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2, "execution_count": 4,
"id": "6ede46a3", "id": "6ede46a3",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -56,22 +56,24 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"usage: kheops [-h] [-v] [-c CONFIG]\n", "Usage: kheops [OPTIONS] COMMAND [ARGS]...\n",
" {schema,gen_doc,lookup,demo,subcommand2} ...\n",
"\n", "\n",
"Kheops, hierarchical data lookup tool\n", " Khéops, hierarchical key/value store\n",
"\n", "\n",
"options:\n", "Options:\n",
" -h, --help show this help message and exit\n", " -v, --verbose [default: 0]\n",
" -v, --verbose Increase verbosity (KHEOPS_VERBOSE) (default: 0)\n", " -c PATH Last name of person to greet. [env var:\n",
" -c CONFIG, --config CONFIG\n", " KHEOPS_CONFIG; default: kheops.yml]\n",
" Kheops configuration file (KHEOPS_CONFIG) (default:\n", " --install-completion [bash|zsh|fish|powershell|pwsh]\n",
" examples/kheops.yml)\n", " Install completion for the specified shell.\n",
" --show-completion [bash|zsh|fish|powershell|pwsh]\n",
" Show completion for the specified shell, to\n",
" copy it or customize the installation.\n",
" --help Show this message and exit.\n",
"\n", "\n",
"subcommands:\n", "Commands:\n",
" valid subcommands\n", " config\n",
"\n", " lookup Lookup database\n"
" {schema,gen_doc,lookup,demo,subcommand2}\n"
] ]
} }
], ],
@ -149,14 +151,6 @@
"A scope is completely optional while keys are required." "A scope is completely optional while keys are required."
] ]
}, },
{
"cell_type": "code",
"execution_count": null,
"id": "9e6aae44",
"metadata": {},
"outputs": [],
"source": []
},
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "d509fa19", "id": "d509fa19",
@ -165,9 +159,35 @@
"## Basic hierarchy" "## Basic hierarchy"
] ]
}, },
{
"cell_type": "markdown",
"id": "8dd5b6b9",
"metadata": {},
"source": [
"Let's create a firest hierachy, we will define a first basic hierarchy. In `kheops.yml`, we can find:\n",
"\n",
"```\n",
"ex1_enc:\n",
" \n",
" config:\n",
" file_path_prefix: \"ex1_enc/\"\n",
" file_path_suffix: \"/ansible\"\n",
"\n",
" lookups:\n",
"\n",
" - path: default # Simplest form, just a path\n",
" - path: \"roles/{role}\" # If list, it's auto expanded like in bash\n",
" - path: \"env_{env}\" # If list, it's auto expanded like in bash\n",
" - path: \"nodes/{node}\"\n",
"\n",
"```\n",
"\n",
"Now we have our hierachy, let's create our files:"
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 3, "execution_count": 9,
"id": "e510a46d", "id": "e510a46d",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -175,7 +195,7 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"\u001b[01;34mexamples/ex1_enc\u001b[00m\n", "\u001b[01;34mexamples/ex1_enc\u001b[0m\n",
"└── default.yml\n", "└── default.yml\n",
"\n", "\n",
"0 directories, 1 file\n", "0 directories, 1 file\n",
@ -217,7 +237,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4, "execution_count": 8,
"id": "06d85b1c", "id": "06d85b1c",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -225,8 +245,9 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"env: NO_ENV\n", "profile:\n",
"product: NO_PRODUCT\n", " env: NO_ENV\n",
" product: NO_PRODUCT\n",
"\n" "\n"
] ]
} }
@ -245,7 +266,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 5, "execution_count": 10,
"id": "c5fad63b", "id": "c5fad63b",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -253,8 +274,9 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"env: NO_ENV\n", "profile:\n",
"product: NO_PRODUCT\n", " env: NO_ENV\n",
" product: NO_PRODUCT\n",
"\n" "\n"
] ]
} }
@ -263,6 +285,14 @@
"kheops lookup -e node=web.infra.net profile" "kheops lookup -e node=web.infra.net profile"
] ]
}, },
{
"cell_type": "markdown",
"id": "a0649351",
"metadata": {},
"source": [
"Same result, let's check how we can change this behavior."
]
},
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "53c43757", "id": "53c43757",
@ -281,7 +311,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 6, "execution_count": 11,
"id": "9f5aabaa", "id": "9f5aabaa",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -289,9 +319,9 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"\u001b[01;34mexamples/ex1_enc\u001b[00m\n", "\u001b[01;34mexamples/ex1_enc\u001b[0m\n",
"├── default.yml\n", "├── default.yml\n",
"└── \u001b[01;34mroles\u001b[00m\n", "└── \u001b[01;34mroles\u001b[0m\n",
" ├── mysql.yml\n", " ├── mysql.yml\n",
" └── web.yml\n", " └── web.yml\n",
"\n", "\n",
@ -336,7 +366,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 7, "execution_count": 12,
"id": "4762fa0c", "id": "4762fa0c",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -383,7 +413,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 8, "execution_count": 13,
"id": "0294ec50", "id": "0294ec50",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -391,21 +421,23 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"env: NO_ENV\n", "profile:\n",
"product: httpd_server\n", " env: NO_ENV\n",
"web_top_domain: ''\n", " product: httpd_server\n",
"web_app: NO_APP\n", " web_top_domain: ''\n",
"web_port: 80\n", " web_app: NO_APP\n",
"web_user_list:\n", " web_port: 80\n",
"- sysadmins\n", " web_user_list:\n",
" - sysadmins\n",
"\n", "\n",
"env: NO_ENV\n", "profile:\n",
"product: mysql_server\n", " env: NO_ENV\n",
"mysql_database: NO_DATABASE\n", " product: mysql_server\n",
"mysql_users:\n", " mysql_database: NO_DATABASE\n",
"- sysadmin@10.0.42%\n", " mysql_users:\n",
"mysql_port: 3306\n", " - sysadmin@10.0.42%\n",
"mysql_cluster: false\n", " mysql_port: 3306\n",
" mysql_cluster: false\n",
"\n" "\n"
] ]
} }
@ -436,7 +468,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 9, "execution_count": 14,
"id": "c1acb199", "id": "c1acb199",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -444,12 +476,12 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"\u001b[01;34mexamples/ex1_enc\u001b[00m\n", "\u001b[01;34mexamples/ex1_enc\u001b[0m\n",
"├── default.yml\n", "├── default.yml\n",
"├── \u001b[01;34mnodes\u001b[00m\n", "├── \u001b[01;34mnodes\u001b[0m\n",
"│   ├── mysql.infra.net.yml\n", "│   ├── mysql.infra.net.yml\n",
"│   └── web.infra.net.yml\n", "│   └── web.infra.net.yml\n",
"└── \u001b[01;34mroles\u001b[00m\n", "└── \u001b[01;34mroles\u001b[0m\n",
" ├── mysql.yml\n", " ├── mysql.yml\n",
" └── web.yml\n", " └── web.yml\n",
"\n", "\n",
@ -495,7 +527,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 10, "execution_count": 15,
"id": "b0d34416", "id": "b0d34416",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -503,24 +535,24 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"env: NO_ENV\n", "profile:\n",
"product: httpd_server\n", " env: NO_ENV\n",
"web_top_domain: ''\n", " product: httpd_server\n",
"web_app: myapp\n", " web_top_domain: ''\n",
"web_port: 80\n", " web_app: myapp\n",
"web_user_list:\n", " web_port: 80\n",
"- sysadmins\n", " web_user_list:\n",
"- domain_org\n", " - domain_org\n",
"- domain_org_external\n", " - domain_org_external\n",
"\n", "\n",
"env: NO_ENV\n", "profile:\n",
"product: mysql_server\n", " env: NO_ENV\n",
"mysql_database: app_domain_org\n", " product: mysql_server\n",
"mysql_users:\n", " mysql_database: app_domain_org\n",
"- sysadmin@10.0.42%\n", " mysql_users:\n",
"- app_domain_org@10.0.51%\n", " - app_domain_org@10.0.51%\n",
"mysql_port: 3306\n", " mysql_port: 3306\n",
"mysql_cluster: false\n", " mysql_cluster: false\n",
"\n" "\n"
] ]
} }
@ -548,7 +580,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 11, "execution_count": 16,
"id": "6c92b0cc", "id": "6c92b0cc",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -556,14 +588,14 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"\u001b[01;34mexamples/ex1_enc\u001b[00m\n", "\u001b[01;34mexamples/ex1_enc\u001b[0m\n",
"├── default.yml\n", "├── default.yml\n",
"├── env_dev.yml\n", "├── env_dev.yml\n",
"├── env_prod.yml\n", "├── env_prod.yml\n",
"├── \u001b[01;34mnodes\u001b[00m\n", "├── \u001b[01;34mnodes\u001b[0m\n",
"│   ├── mysql.infra.net.yml\n", "│   ├── mysql.infra.net.yml\n",
"│   └── web.infra.net.yml\n", "│   └── web.infra.net.yml\n",
"└── \u001b[01;34mroles\u001b[00m\n", "└── \u001b[01;34mroles\u001b[0m\n",
" ├── mysql.yml\n", " ├── mysql.yml\n",
" └── web.yml\n", " └── web.yml\n",
"\n", "\n",
@ -619,7 +651,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 13, "execution_count": 17,
"id": "9c3200b4", "id": "9c3200b4",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -627,31 +659,30 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"env: prod\n", "profile:\n",
"product: httpd_server\n", " env: prod\n",
"web_top_domain: infra.com\n", " product: httpd_server\n",
"web_app: myapp\n", " web_top_domain: infra.com\n",
"web_port: 80\n", " web_app: myapp\n",
"web_user_list:\n", " web_port: 80\n",
"- sysadmins\n", " web_user_list:\n",
"- domain_org\n", " - domain_org\n",
"- domain_org_external\n", " - domain_org_external\n",
"web_cache: 12h\n", " web_cache: 12h\n",
"\n", "\n",
"env: dev\n", "profile:\n",
"product: httpd_server\n", " env: dev\n",
"web_top_domain: dev.infra.net\n", " product: httpd_server\n",
"web_app: myapp\n", " web_top_domain: dev.infra.net\n",
"web_port: 80\n", " web_app: myapp\n",
"web_user_list:\n", " web_port: 80\n",
"- sysadmins\n", " web_user_list:\n",
"- debug_user\n", " - domain_org\n",
"- domain_org\n", " - domain_org_external\n",
"- domain_org_external\n", " web_cache: 1m\n",
"web_cache: 1m\n", " mysql_users:\n",
"mysql_users:\n", " - debug@10.0.%\n",
"- debug@10.0.%\n", " debug: true\n",
"debug: true\n",
"\n" "\n"
] ]
} }
@ -671,7 +702,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 14, "execution_count": 18,
"id": "7c5e86f3", "id": "7c5e86f3",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -679,31 +710,30 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"env: prod\n", "profile:\n",
"product: mysql_server\n", " env: prod\n",
"mysql_database: app_domain_org\n", " product: mysql_server\n",
"mysql_users:\n", " mysql_database: app_domain_org\n",
"- sysadmin@10.0.42%\n", " mysql_users:\n",
"- app_domain_org@10.0.51%\n", " - app_domain_org@10.0.51%\n",
"mysql_port: 3306\n", " mysql_port: 3306\n",
"mysql_cluster: false\n", " mysql_cluster: false\n",
"web_top_domain: infra.com\n", " web_top_domain: infra.com\n",
"web_cache: 12h\n", " web_cache: 12h\n",
"\n", "\n",
"env: dev\n", "profile:\n",
"product: mysql_server\n", " env: dev\n",
"mysql_database: app_domain_org\n", " product: mysql_server\n",
"mysql_users:\n", " mysql_database: app_domain_org\n",
"- sysadmin@10.0.42%\n", " mysql_users:\n",
"- debug@10.0.%\n", " - app_domain_org@10.0.51%\n",
"- app_domain_org@10.0.51%\n", " mysql_port: 3306\n",
"mysql_port: 3306\n", " mysql_cluster: false\n",
"mysql_cluster: false\n", " web_top_domain: dev.infra.net\n",
"web_top_domain: dev.infra.net\n", " web_cache: 1m\n",
"web_cache: 1m\n", " web_user_list:\n",
"web_user_list:\n", " - debug_user\n",
"- debug_user\n", " debug: true\n",
"debug: true\n",
"\n" "\n"
] ]
} }
@ -713,22 +743,6 @@
"kheops lookup -e node=mysql.infra.net -e role=mysql -e env=dev profile" "kheops lookup -e node=mysql.infra.net -e role=mysql -e env=dev profile"
] ]
}, },
{
"cell_type": "markdown",
"id": "db50e110",
"metadata": {},
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "c2c4658d",
"metadata": {},
"outputs": [],
"source": [
"\n"
]
},
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "e4bf6d8d", "id": "e4bf6d8d",
@ -739,7 +753,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 15, "execution_count": 19,
"id": "103cb37d", "id": "103cb37d",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -747,60 +761,64 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"env: NO_ENV\n", "profile:\n",
"product: NO_PRODUCT\n", " env: NO_ENV\n",
" product: NO_PRODUCT\n",
"\n", "\n",
"==> Per environment view\n", "==> Per environment view\n",
"env: prod\n", "profile:\n",
"product: NO_PRODUCT\n", " env: prod\n",
"web_top_domain: infra.com\n", " product: NO_PRODUCT\n",
"web_cache: 12h\n", " web_top_domain: infra.com\n",
" web_cache: 12h\n",
"\n", "\n",
"env: dev\n", "profile:\n",
"product: NO_PRODUCT\n", " env: dev\n",
"web_top_domain: dev.infra.net\n", " product: NO_PRODUCT\n",
"web_cache: 1m\n", " web_top_domain: dev.infra.net\n",
"web_user_list:\n", " web_cache: 1m\n",
"- debug_user\n", " web_user_list:\n",
"mysql_users:\n", " - debug_user\n",
"- debug@10.0.%\n", " mysql_users:\n",
"debug: true\n", " - debug@10.0.%\n",
" debug: true\n",
"\n", "\n",
"==> Per role and environment view\n", "==> Per role and environment view\n",
"env: prod\n", "profile:\n",
"product: mysql_server\n", " env: prod\n",
"mysql_database: NO_DATABASE\n", " product: mysql_server\n",
"mysql_users:\n", " mysql_database: NO_DATABASE\n",
"- sysadmin@10.0.42%\n", " mysql_users:\n",
"mysql_port: 3306\n", " - sysadmin@10.0.42%\n",
"mysql_cluster: false\n", " mysql_port: 3306\n",
"web_top_domain: infra.com\n", " mysql_cluster: false\n",
"web_cache: 12h\n", " web_top_domain: infra.com\n",
" web_cache: 12h\n",
"\n", "\n",
"env: prod\n", "profile:\n",
"product: httpd_server\n", " env: prod\n",
"web_top_domain: infra.com\n", " product: httpd_server\n",
"web_app: NO_APP\n", " web_top_domain: infra.com\n",
"web_port: 80\n", " web_app: NO_APP\n",
"web_user_list:\n", " web_port: 80\n",
"- sysadmins\n", " web_user_list:\n",
"web_cache: 12h\n", " - sysadmins\n",
" web_cache: 12h\n",
"\n", "\n",
"==> Per node view\n", "==> Per node view\n",
"env: dev\n", "profile:\n",
"product: httpd_server\n", " env: dev\n",
"web_top_domain: dev.infra.net\n", " product: httpd_server\n",
"web_app: myapp\n", " web_top_domain: dev.infra.net\n",
"web_port: 80\n", " web_app: myapp\n",
"web_user_list:\n", " web_port: 80\n",
"- sysadmins\n", " web_user_list:\n",
"- debug_user\n", " - domain_org\n",
"- domain_org\n", " - domain_org_external\n",
"- domain_org_external\n", " web_cache: 1m\n",
"web_cache: 1m\n", " mysql_users:\n",
"mysql_users:\n", " - debug@10.0.%\n",
"- debug@10.0.%\n", " debug: true\n",
"debug: true\n",
"\n" "\n"
] ]
} }
@ -902,7 +920,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 19, "execution_count": 21,
"id": "52f5033b", "id": "52f5033b",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -911,6 +929,7 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"+ : Find where a key has been defined\n", "+ : Find where a key has been defined\n",
"+ : ==========================\n",
"+ grep --colour=auto -r '^profile:' examples/ex1_enc\n", "+ grep --colour=auto -r '^profile:' examples/ex1_enc\n",
"\u001b[35m\u001b[Kexamples/ex1_enc/env_prod.yml\u001b[m\u001b[K\u001b[36m\u001b[K:\u001b[m\u001b[K\u001b[01;31m\u001b[Kprofile:\u001b[m\u001b[K\n", "\u001b[35m\u001b[Kexamples/ex1_enc/env_prod.yml\u001b[m\u001b[K\u001b[36m\u001b[K:\u001b[m\u001b[K\u001b[01;31m\u001b[Kprofile:\u001b[m\u001b[K\n",
"\u001b[35m\u001b[Kexamples/ex1_enc/roles/mysql.yml\u001b[m\u001b[K\u001b[36m\u001b[K:\u001b[m\u001b[K\u001b[01;31m\u001b[Kprofile:\u001b[m\u001b[K\n", "\u001b[35m\u001b[Kexamples/ex1_enc/roles/mysql.yml\u001b[m\u001b[K\u001b[36m\u001b[K:\u001b[m\u001b[K\u001b[01;31m\u001b[Kprofile:\u001b[m\u001b[K\n",
@ -920,6 +939,7 @@
"\u001b[35m\u001b[Kexamples/ex1_enc/default.yml\u001b[m\u001b[K\u001b[36m\u001b[K:\u001b[m\u001b[K\u001b[01;31m\u001b[Kprofile:\u001b[m\u001b[K\n", "\u001b[35m\u001b[Kexamples/ex1_enc/default.yml\u001b[m\u001b[K\u001b[36m\u001b[K:\u001b[m\u001b[K\u001b[01;31m\u001b[Kprofile:\u001b[m\u001b[K\n",
"\u001b[35m\u001b[Kexamples/ex1_enc/env_dev.yml\u001b[m\u001b[K\u001b[36m\u001b[K:\u001b[m\u001b[K\u001b[01;31m\u001b[Kprofile:\u001b[m\u001b[K\n", "\u001b[35m\u001b[Kexamples/ex1_enc/env_dev.yml\u001b[m\u001b[K\u001b[36m\u001b[K:\u001b[m\u001b[K\u001b[01;31m\u001b[Kprofile:\u001b[m\u001b[K\n",
"+ : Find where a key has been defined and 5 first lines\n", "+ : Find where a key has been defined and 5 first lines\n",
"+ : ==========================\n",
"+ grep --colour=auto -r -A 5 web_user_list: examples/ex1_enc\n", "+ grep --colour=auto -r -A 5 web_user_list: examples/ex1_enc\n",
"\u001b[35m\u001b[Kexamples/ex1_enc/roles/web.yml\u001b[m\u001b[K\u001b[36m\u001b[K:\u001b[m\u001b[K \u001b[01;31m\u001b[Kweb_user_list:\u001b[m\u001b[K\n", "\u001b[35m\u001b[Kexamples/ex1_enc/roles/web.yml\u001b[m\u001b[K\u001b[36m\u001b[K:\u001b[m\u001b[K \u001b[01;31m\u001b[Kweb_user_list:\u001b[m\u001b[K\n",
"\u001b[35m\u001b[Kexamples/ex1_enc/roles/web.yml\u001b[m\u001b[K\u001b[36m\u001b[K-\u001b[m\u001b[K - sysadmins\n", "\u001b[35m\u001b[Kexamples/ex1_enc/roles/web.yml\u001b[m\u001b[K\u001b[36m\u001b[K-\u001b[m\u001b[K - sysadmins\n",
@ -937,6 +957,7 @@
"\u001b[35m\u001b[Kexamples/ex1_enc/env_dev.yml\u001b[m\u001b[K\u001b[36m\u001b[K-\u001b[m\u001b[K\n", "\u001b[35m\u001b[Kexamples/ex1_enc/env_dev.yml\u001b[m\u001b[K\u001b[36m\u001b[K-\u001b[m\u001b[K\n",
"\u001b[35m\u001b[Kexamples/ex1_enc/env_dev.yml\u001b[m\u001b[K\u001b[36m\u001b[K-\u001b[m\u001b[K debug: true\n", "\u001b[35m\u001b[Kexamples/ex1_enc/env_dev.yml\u001b[m\u001b[K\u001b[36m\u001b[K-\u001b[m\u001b[K debug: true\n",
"+ : Search from anything related to database\n", "+ : Search from anything related to database\n",
"+ : ==========================\n",
"+ grep --colour=auto -R -C 3 database examples/ex1_enc\n", "+ grep --colour=auto -R -C 3 database examples/ex1_enc\n",
"\u001b[35m\u001b[Kexamples/ex1_enc/roles/mysql.yml\u001b[m\u001b[K\u001b[36m\u001b[K-\u001b[m\u001b[Kprofile:\n", "\u001b[35m\u001b[Kexamples/ex1_enc/roles/mysql.yml\u001b[m\u001b[K\u001b[36m\u001b[K-\u001b[m\u001b[Kprofile:\n",
"\u001b[35m\u001b[Kexamples/ex1_enc/roles/mysql.yml\u001b[m\u001b[K\u001b[36m\u001b[K-\u001b[m\u001b[K product: \"mysql_server\"\n", "\u001b[35m\u001b[Kexamples/ex1_enc/roles/mysql.yml\u001b[m\u001b[K\u001b[36m\u001b[K-\u001b[m\u001b[K product: \"mysql_server\"\n",
@ -960,12 +981,17 @@
"set -x\n", "set -x\n",
"\n", "\n",
": Find where a key has been defined\n", ": Find where a key has been defined\n",
": ==========================\n",
"grep -r '^profile:' examples/$KHEOPS_NAMESPACE\n", "grep -r '^profile:' examples/$KHEOPS_NAMESPACE\n",
"\n", "\n",
"\n",
": Find where a key has been defined and 5 first lines\n", ": Find where a key has been defined and 5 first lines\n",
": ==========================\n",
"grep -r -A 5 'web_user_list:' examples/$KHEOPS_NAMESPACE\n", "grep -r -A 5 'web_user_list:' examples/$KHEOPS_NAMESPACE\n",
"\n", "\n",
"\n",
": Search from anything related to database\n", ": Search from anything related to database\n",
": ==========================\n",
"grep -R -C 3 'database' examples/$KHEOPS_NAMESPACE\n", "grep -R -C 3 'database' examples/$KHEOPS_NAMESPACE\n",
"\n", "\n",
"set +x" "set +x"
@ -989,7 +1015,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 18, "execution_count": 22,
"id": "49bc3fc3", "id": "49bc3fc3",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -1050,7 +1076,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 17, "execution_count": 23,
"id": "e4a1e8d1", "id": "e4a1e8d1",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -1058,26 +1084,25 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"--- /dev/fd/63\t2022-02-01 20:10:53.094525316 -0500\n", "--- /dev/fd/63\t2022-02-14 13:45:59.223619144 -0500\n",
"+++ /dev/fd/62\t2022-02-01 20:10:53.094525316 -0500\n", "+++ /dev/fd/62\t2022-02-14 13:45:59.223619144 -0500\n",
"@@ -1,11 +1,15 @@\n", "@@ -1,11 +1,14 @@\n",
"-env: prod\n", " profile:\n",
"+env: dev\n", "- env: prod\n",
" product: httpd_server\n", "+ env: dev\n",
"-web_top_domain: infra.com\n", " product: httpd_server\n",
"+web_top_domain: dev.infra.net\n", "- web_top_domain: infra.com\n",
" web_app: myapp\n", "+ web_top_domain: dev.infra.net\n",
" web_port: 80\n", " web_app: myapp\n",
" web_user_list:\n", " web_port: 80\n",
" - sysadmins\n", " web_user_list:\n",
"+- debug_user\n", " - domain_org\n",
" - domain_org\n", " - domain_org_external\n",
" - domain_org_external\n", "- web_cache: 12h\n",
"-web_cache: 12h\n", "+ web_cache: 1m\n",
"+web_cache: 1m\n", "+ mysql_users:\n",
"+mysql_users:\n", "+ - debug@10.0.%\n",
"+- debug@10.0.%\n", "+ debug: true\n",
"+debug: true\n",
" \n" " \n"
] ]
}, },
@ -1094,14 +1119,6 @@
"<(kheops lookup -e node=web.infra.net -e role=web -e env=dev profile)" "<(kheops lookup -e node=web.infra.net -e role=web -e env=dev profile)"
] ]
}, },
{
"cell_type": "code",
"execution_count": null,
"id": "a6feb212",
"metadata": {},
"outputs": [],
"source": []
},
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "12b1730b", "id": "12b1730b",
@ -1112,7 +1129,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 21, "execution_count": 25,
"id": "3ac0cc53", "id": "3ac0cc53",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -1149,11 +1166,11 @@
"+------------------------+------------------------------+\n", "+------------------------+------------------------------+\n",
" INFO: Explain candidates:\n", " INFO: Explain candidates:\n",
"+----------------------------------------------------------------------------------+-------------------------------+------------------------------+\n", "+----------------------------------------------------------------------------------+-------------------------------+------------------------------+\n",
"| Status | Runtime | Data |\n", "| Status | Runtime | Key Value |\n",
"+----------------------------------------------------------------------------------+-------------------------------+------------------------------+\n", "+----------------------------------------------------------------------------------+-------------------------------+------------------------------+\n",
"| | | |\n", "| | | |\n",
"| Status:{ | Runtime:{ | Data:{ |\n", "| Status:{ | Runtime:{ | Key:{ |\n",
"| \"path\": \"/home/jez/volumes/data/prj/bell/training/tiger-ansible/ext/kheops ... | \"scope\": { | \"env\": \"NO_ENV\", |\n", "| \"path\": \"/home/jez/volumes/data/prj/bell/dev/kheops/examples/ex1_enc/defau ... | \"scope\": { | \"env\": \"NO_ENV\", |\n",
"| \"status\": \"found\", | \"role\": \"web\" | \"product\": \"NO_PRODUCT\" |\n", "| \"status\": \"found\", | \"role\": \"web\" | \"product\": \"NO_PRODUCT\" |\n",
"| \"rel_path\": \"examples/ex1_enc/default.yml\" | }, | } |\n", "| \"rel_path\": \"examples/ex1_enc/default.yml\" | }, | } |\n",
"| } | \"key\": \"profile\", | |\n", "| } | \"key\": \"profile\", | |\n",
@ -1164,8 +1181,8 @@
"| | \"backend_index\": 0 | |\n", "| | \"backend_index\": 0 | |\n",
"| | } | |\n", "| | } | |\n",
"| | | |\n", "| | | |\n",
"| Status:{ | Runtime:{ | Data:{ |\n", "| Status:{ | Runtime:{ | Key:{ |\n",
"| \"path\": \"/home/jez/volumes/data/prj/bell/training/tiger-ansible/ext/kheops ... | \"scope\": { | \"product\": \"httpd_server\", |\n", "| \"path\": \"/home/jez/volumes/data/prj/bell/dev/kheops/examples/ex1_enc/roles ... | \"scope\": { | \"product\": \"httpd_server\", |\n",
"| \"status\": \"found\", | \"role\": \"web\" | \"web_top_domain\": \"\", |\n", "| \"status\": \"found\", | \"role\": \"web\" | \"web_top_domain\": \"\", |\n",
"| \"rel_path\": \"examples/ex1_enc/roles/web.yml\" | }, | \"web_app\": \"NO_APP\", |\n", "| \"rel_path\": \"examples/ex1_enc/roles/web.yml\" | }, | \"web_app\": \"NO_APP\", |\n",
"| } | \"key\": \"profile\", | \"web_port\": 80, |\n", "| } | \"key\": \"profile\", | \"web_port\": 80, |\n",
@ -1176,25 +1193,26 @@
"| | \"backend_index\": 1 | |\n", "| | \"backend_index\": 1 | |\n",
"| | } | |\n", "| | } | |\n",
"+----------------------------------------------------------------------------------+-------------------------------+------------------------------+\n", "+----------------------------------------------------------------------------------+-------------------------------+------------------------------+\n",
"env: NO_ENV\n", "profile:\n",
"product: httpd_server\n", " env: NO_ENV\n",
"web_top_domain: ''\n", " product: httpd_server\n",
"web_app: NO_APP\n", " web_top_domain: ''\n",
"web_port: 80\n", " web_app: NO_APP\n",
"web_user_list:\n", " web_port: 80\n",
"- sysadmins\n", " web_user_list:\n",
" - sysadmins\n",
"\n" "\n"
] ]
} }
], ],
"source": [ "source": [
"kheops lookup -e role=web profile -x" "kheops lookup -e role=web profile -X"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "cb111da7", "id": "07eeed03",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [] "source": []