Last active
February 21, 2021 10:52
-
-
Save juanje/4cf378efcb0748ad005fe52ea42212f6 to your computer and use it in GitHub Desktop.
Revisions
-
juanje revised this gist
Feb 21, 2021 . 2 changed files with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -29,7 +29,7 @@ msg: "{{ item }}" loop: "{{ api_urls }}" - name: Show the list of api_resources debug: msg: "{{ item }}" loop: "{{ api_resources }}" This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,7 +18,7 @@ ok: [localhost] => (item=https://api.example.com/v3) => ok: [localhost] => (item=https://api.example.com/v5) => msg: https://api.example.com/v5 TASK [Show the list of api_resources] ************************************************************************************************************************************************************************************************************ ok: [localhost] => (item=resource_num_1) => msg: resource_num_1 ok: [localhost] => (item=resource_num_2) => -
juanje revised this gist
Feb 21, 2021 . 2 changed files with 41 additions and 33 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,6 @@ --- - name: Compose variables and merge lists hosts: localhost connection: local gather_facts: no @@ -28,7 +29,12 @@ msg: "{{ item }}" loop: "{{ api_urls }}" - name: Show the list of resources debug: msg: "{{ item }}" loop: "{{ api_resources }}" - name: Show the WHAT resources get from WHERE debug: msg: "GET: {{ item.1 }} FROM: {{ item.0 }}" # Merge api_urls and api_resources lists using the zip() filter This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,40 +1,42 @@ $ ansible-playbook compose_variables.yml PLAY [Compose variables and merge lists] ***************************************************************************************************************************************************************************************************** TASK [Compose the list of api_urls] ********************************************************************************************************************************************************************************************************** ok: [localhost] => (item=1) ok: [localhost] => (item=2) ok: [localhost] => (item=3) ok: [localhost] => (item=5) TASK [Show the list of api_urls] ************************************************************************************************************************************************************************************************************* ok: [localhost] => (item=https://api.example.com/v1) => msg: https://api.example.com/v1 ok: [localhost] => (item=https://api.example.com/v2) => msg: https://api.example.com/v2 ok: [localhost] => (item=https://api.example.com/v3) => msg: https://api.example.com/v3 ok: [localhost] => (item=https://api.example.com/v5) => msg: https://api.example.com/v5 TASK [Show the list of resources] ************************************************************************************************************************************************************************************************************ ok: [localhost] => (item=resource_num_1) => msg: resource_num_1 ok: [localhost] => (item=resource_num_2) => msg: resource_num_2 ok: [localhost] => (item=resource_num_3) => msg: resource_num_3 ok: [localhost] => (item=resource_num_5) => msg: resource_num_5 TASK [Show the WHAT resources get from WHERE] ************************************************************************************************************************************************************************************************ ok: [localhost] => (item=['https://api.example.com/v1', 'resource_num_1']) => msg: 'GET: resource_num_1 FROM: https://api.example.com/v1' ok: [localhost] => (item=['https://api.example.com/v2', 'resource_num_2']) => msg: 'GET: resource_num_2 FROM: https://api.example.com/v2' ok: [localhost] => (item=['https://api.example.com/v3', 'resource_num_3']) => msg: 'GET: resource_num_3 FROM: https://api.example.com/v3' ok: [localhost] => (item=['https://api.example.com/v5', 'resource_num_5']) => msg: 'GET: resource_num_5 FROM: https://api.example.com/v5' PLAY RECAP *********************************************************************************************************************************************************************************************************************************** localhost : ok=4 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 -
juanje revised this gist
Aug 11, 2020 . 1 changed file with 12 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,17 +9,27 @@ - 2 - 3 - 5 api_url: "https://api.example.com" api_resource: "resource_num_" api_resources: [] api_urls: [] pre_tasks: - name: Compose the list of api_urls set_fact: # [A] = [A] + [item] api_urls: "{{ api_urls }} + [ '{{ api_url }}/v{{ item }}' ]" api_resources: "{{ api_resources }} + [ '{{ api_resource }}{{ item }}' ]" loop: "{{ api_versions }}" tasks: - name: Show the list of api_urls debug: msg: "{{ item }}" loop: "{{ api_urls }}" - name: Ensure the toolbox image is at local directory debug: msg: "GET: {{ item.1 }} FROM: {{ item.0 }}" # Merge api_urls and api_resources lists using the zip() filter loop: "{{ api_urls | zip(api_resources) | list }}" -
juanje revised this gist
Aug 11, 2020 . 2 changed files with 21 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -22,4 +22,4 @@ - name: Show the list of api_urls debug: msg: '{{ item }}' loop: "{{ api_urls }}" This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,12 @@ $ ansible-playbook compose_variables.yml PLAY [localhost] ********************************************************************************************************************************************************************************************************************************* TASK [Compose the list of api_urls] ************************************************************************************************************************************************************************************************************** ok: [localhost] => (item=1) ok: [localhost] => (item=2) ok: [localhost] => (item=3) ok: [localhost] => (item=5) TASK [Show the list of api_urls] ***************************************************************************************************************************************************************************************************************** ok: [localhost] => (item=https://api.example.com/v1) => { @@ -22,5 +22,19 @@ ok: [localhost] => (item=https://api.example.com/v5) => { "msg": "https://api.example.com/v5" } TASK [Ensure the toolbox image is at local directory] ******************************************************************************************************************************************************************************************** ok: [localhost] => (item=['https://api.example.com/v1', 'resource_num_1']) => { "msg": "GET: resource_num_1 FROM: https://api.example.com/v1" } ok: [localhost] => (item=['https://api.example.com/v2', 'resource_num_2']) => { "msg": "GET: resource_num_2 FROM: https://api.example.com/v2" } ok: [localhost] => (item=['https://api.example.com/v3', 'resource_num_3']) => { "msg": "GET: resource_num_3 FROM: https://api.example.com/v3" } ok: [localhost] => (item=['https://api.example.com/v5', 'resource_num_5']) => { "msg": "GET: resource_num_5 FROM: https://api.example.com/v5" } PLAY RECAP *************************************************************************************************************************************************************************************************************************************** localhost : ok=3 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 -
juanje revised this gist
Aug 11, 2020 . 2 changed files with 34 additions and 46 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,30 +1,25 @@ --- - hosts: localhost connection: local gather_facts: no vars: api_versions: - 1 - 2 - 3 - 5 api_url: 'https://api.example.com' api_urls: [] pre_tasks: - name: Compose the list of api_urls set_fact: api_urls: "{{ api_urls }} + [ '{{ api_url }}/v{{ item }}' ]" loop: "{{ api_versions }}" tasks: - name: Show the list of api_urls debug: msg: '{{ item }}' loop: "{{ api_urls }}" This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,33 +1,26 @@ $ ansible-playbook compose_variables.yml PLAY [localhost] ********************************************************************************************************************************************************************************************************************************* TASK [Compose the list of api_urls] ************************************************************************************************************************************************************************************************************** ok: [localhost] => (item=v1) ok: [localhost] => (item=v2) ok: [localhost] => (item=v3) ok: [localhost] => (item=v5) TASK [Show the list of api_urls] ***************************************************************************************************************************************************************************************************************** ok: [localhost] => (item=https://api.example.com/v1) => { "msg": "https://api.example.com/v1" } ok: [localhost] => (item=https://api.example.com/v2) => { "msg": "https://api.example.com/v2" } ok: [localhost] => (item=https://api.example.com/v3) => { "msg": "https://api.example.com/v3" } ok: [localhost] => (item=https://api.example.com/v5) => { "msg": "https://api.example.com/v5" } PLAY RECAP *************************************************************************************************************************************************************************************************************************************** localhost : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 -
juanje revised this gist
Aug 10, 2020 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,7 +15,7 @@ pre_tasks: - set_fact: toolbox_dirs: "{{ toolbox_dirs }} + [ '{{ toolbox_image }}-{{ item }}' ]" registry_urls: "{{ registry_urls }} + [ '{{ registry_url }}/f{{ item }}/{{ toolbox_image }}:{{ item }}' ]" loop: "{{ fedora_versions }}" tasks: @@ -27,4 +27,4 @@ - name: Ensure the toolbox image is at local directory debug: msg: "skopeo copy docker://{{ item.0 }} dir:{{ item.1 }}" loop: "{{ registry_urls | zip(toolbox_dirs) | list }}" -
juanje revised this gist
Aug 7, 2020 . 1 changed file with 11 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,33 +1,33 @@ $ ansible-playbook -i localhost, -c local compose_variables.yml PLAY [localhost ********************************************************************************************************************************************************************************************************************************* TASK [set_fact] ********************************************************************************************************************************************************************************************************************************** ok: [localhost] => (item=29) ok: [localhost] => (item=31) ok: [localhost] => (item=33) TASK [Ensure a directory exist to store the toolbox images] ************************************************************************************************************************************************************************************** ok: [localhost] => (item=fedora-toolbox-29) => { "msg": "mkdir ./fedora-toolbox-29" } ok: [localhost] => (item=fedora-toolbox-31) => { "msg": "mkdir ./fedora-toolbox-31" } ok: [localhost] => (item=fedora-toolbox-33) => { "msg": "mkdir ./fedora-toolbox-33" } TASK [Ensure the toolbox image is at local directory] ******************************************************************************************************************************************************************************************** ok: [localhost] => (item=['registry.fedoraproject.org/f29/fedora-toolbox:29', 'fedora-toolbox-29']) => { "msg": "skopeo copy docker://registry.fedoraproject.org/f29/fedora-toolbox:29 dir:fedora-toolbox-29" } ok: [localhost] => (item=['registry.fedoraproject.org/f31/fedora-toolbox:31', 'fedora-toolbox-31']) => { "msg": "skopeo copy docker://registry.fedoraproject.org/f31/fedora-toolbox:31 dir:fedora-toolbox-31" } ok: [localhost] => (item=['registry.fedoraproject.org/f33/fedora-toolbox:33', 'fedora-toolbox-33']) => { "msg": "skopeo copy docker://registry.fedoraproject.org/f33/fedora-toolbox:33 dir:fedora-toolbox-33" } PLAY RECAP *************************************************************************************************************************************************************************************************************************************** localhost : ok=3 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 -
juanje revised this gist
Aug 7, 2020 . 2 changed files with 2 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,5 @@ --- - hosts: all gather_facts: false vars: This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ $ ansible-playbook -i localhost, -c local compose_variables.yml PLAY [127.0.0.1] ********************************************************************************************************************************************************************************************************************************* -
juanje renamed this gist
Aug 5, 2020 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
juanje renamed this gist
Aug 5, 2020 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
juanje renamed this gist
Aug 5, 2020 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
juanje revised this gist
Aug 5, 2020 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ --- - hosts: 127.0.0.1 connection: local gather_facts: false -
juanje created this gist
Aug 5, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ - hosts: 127.0.0.1 connection: local gather_facts: false vars: fedora_versions: - 29 - 31 - 33 registry_url: 'registry.fedoraproject.org' toolbox_image: 'fedora-toolbox' toolbox_dirs: [] registry_urls: [] pre_tasks: - set_fact: toolbox_dirs: "{{ toolbox_dirs }} + [ '{{ toolbox_image }}-{{ item }}' ]" registry_urls: "{{ registry_urls }} + [ '{{ registry_url }}/f{{ item }}/{{ toolbox_image }}:{{item }}' ]" loop: "{{ fedora_versions }}" tasks: - name: Ensure a directory exist to store the toolbox images debug: msg: 'mkdir ./{{ item }}' loop: "{{ toolbox_dirs }}" - name: Ensure the toolbox image is at local directory debug: msg: "skopeo copy docker://{{ item.0 }} dir:{{ item.1 }}" loop: "{{ registry_urls|zip(toolbox_dirs)|list }}" This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ $ ansible-playbook -i 127.0.0.1, compose_variables.yml PLAY [127.0.0.1] ********************************************************************************************************************************************************************************************************************************* TASK [set_fact] ********************************************************************************************************************************************************************************************************************************** ok: [127.0.0.1] => (item=29) ok: [127.0.0.1] => (item=31) ok: [127.0.0.1] => (item=33) TASK [Ensure a directory exist to store the toolbox images] ************************************************************************************************************************************************************************************** ok: [127.0.0.1] => (item=fedora-toolbox-29) => { "msg": "mkdir ./fedora-toolbox-29" } ok: [127.0.0.1] => (item=fedora-toolbox-31) => { "msg": "mkdir ./fedora-toolbox-31" } ok: [127.0.0.1] => (item=fedora-toolbox-33) => { "msg": "mkdir ./fedora-toolbox-33" } TASK [Ensure the toolbox image is at local directory] ******************************************************************************************************************************************************************************************** ok: [127.0.0.1] => (item=['registry.fedoraproject.org/f29/fedora-toolbox:29', 'fedora-toolbox-29']) => { "msg": "skopeo copy docker://registry.fedoraproject.org/f29/fedora-toolbox:29 dir:fedora-toolbox-29" } ok: [127.0.0.1] => (item=['registry.fedoraproject.org/f31/fedora-toolbox:31', 'fedora-toolbox-31']) => { "msg": "skopeo copy docker://registry.fedoraproject.org/f31/fedora-toolbox:31 dir:fedora-toolbox-31" } ok: [127.0.0.1] => (item=['registry.fedoraproject.org/f33/fedora-toolbox:33', 'fedora-toolbox-33']) => { "msg": "skopeo copy docker://registry.fedoraproject.org/f33/fedora-toolbox:33 dir:fedora-toolbox-33" } PLAY RECAP *************************************************************************************************************************************************************************************************************************************** 127.0.0.1 : ok=3 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0