diff --git a/geant/gap_ansible/playbooks/l3_core_service.yaml b/geant/gap_ansible/playbooks/l3_core_service.yaml index b1ec56b93ec77e706d46119c63dc4ee77ee9d148..6517b5bcbfc7a981d364fa3f62140cc85b5dd7fb 100644 --- a/geant/gap_ansible/playbooks/l3_core_service.yaml +++ b/geant/gap_ansible/playbooks/l3_core_service.yaml @@ -22,24 +22,8 @@ # verb == 'check' # ansible.builtin.meta: end_play - - name: Generate an ID for this run - ansible.builtin.set_fact: - opid: "{{ lookup('community.general.random_string', length=18, special=false) }}" - - - name: Print the ID - ansible.builtin.debug: - msg: "{{ opid }}" - - - name: Create a folder for all compiled output - ansible.builtin.file: - path: "/var/tmp/ansible_run_{{ opid }}" - state: directory - mode: '0755' - delegate_to: localhost - - - name: Import group_vars/all - ansible.builtin.include_vars: - dir: /opt/ansible_inventory/group_vars/all + - name: Include storage path configuration + ansible.builtin.include_tasks: ../tasks/configure_storage.yaml - name: Import standard general variables for GEANT L3 Core Services ansible.builtin.include_vars: diff --git a/geant/gap_ansible/playbooks/manage_bgp_peers.yaml b/geant/gap_ansible/playbooks/manage_bgp_peers.yaml index 113fa28b317b6b2e909464c13c50810751271320..ed5898afc73eb549b98f0b233e32f54e55a13020 100644 --- a/geant/gap_ansible/playbooks/manage_bgp_peers.yaml +++ b/geant/gap_ansible/playbooks/manage_bgp_peers.yaml @@ -2,24 +2,8 @@ hosts: all gather_facts: false tasks: - - name: Generate an ID for this run - ansible.builtin.set_fact: - opid: "{{ lookup('community.general.random_string', length=18, special=false) }}" - - - name: Print the ID - ansible.builtin.debug: - msg: "{{ opid }}" - - - name: Create a folder for all compiled output - ansible.builtin.file: - path: "/var/tmp/ansible_run_{{ opid }}" - state: directory - mode: '0755' - delegate_to: localhost - - - name: Import group_vars/all - ansible.builtin.include_vars: - dir: /opt/ansible_inventory/group_vars/all + - name: Include storage path configuration + ansible.builtin.include_tasks: ../tasks/configure_storage.yaml - name: Import general variables for {{ partner_name | upper }} ansible.builtin.include_vars: diff --git a/geant/gap_ansible/playbooks/manage_sbp.yaml b/geant/gap_ansible/playbooks/manage_sbp.yaml index 75665516f8773c2060902f1d517a155ef9984985..7e1715b12cab9b60e73495f6474f184ef3b37783 100644 --- a/geant/gap_ansible/playbooks/manage_sbp.yaml +++ b/geant/gap_ansible/playbooks/manage_sbp.yaml @@ -2,24 +2,8 @@ hosts: all gather_facts: false tasks: - - name: Generate an ID for this run - ansible.builtin.set_fact: - opid: "{{ lookup('community.general.random_string', length=18, special=false) }}" - - - name: Print the ID - ansible.builtin.debug: - msg: "{{ opid }}" - - - name: Create a folder for all compiled output - ansible.builtin.file: - path: "/var/tmp/ansible_run_{{ opid }}" - state: directory - mode: '0755' - delegate_to: localhost - - - name: Import group_vars/all - ansible.builtin.include_vars: - dir: /opt/ansible_inventory/group_vars/all + - name: Include storage path configuration + ansible.builtin.include_tasks: ../tasks/configure_storage.yaml - name: Import standard general variables for GEANT L3 Core Services ansible.builtin.include_vars: diff --git a/geant/gap_ansible/playbooks/validate_prefix_list.yaml b/geant/gap_ansible/playbooks/validate_prefix_list.yaml index 691c055c14119ce26758851fcd4e0470bdd67a47..c868c8b6f4236ff452ca15d69cef6a490172e84b 100644 --- a/geant/gap_ansible/playbooks/validate_prefix_list.yaml +++ b/geant/gap_ansible/playbooks/validate_prefix_list.yaml @@ -3,24 +3,8 @@ hosts: all gather_facts: false tasks: - - name: Generate an ID for this run - ansible.builtin.set_fact: - opid: "{{ lookup('community.general.random_string', length=18, special=false) }}" - - - name: Print the ID - ansible.builtin.debug: - msg: "{{ opid }}" - - - name: Create a folder for all compiled output - ansible.builtin.file: - path: "/var/tmp/ansible_run_{{ opid }}" - state: directory - mode: '0755' - delegate_to: localhost - - - name: Import group_vars/all - ansible.builtin.include_vars: - dir: /opt/ansible_inventory/group_vars/all + - name: Include storage path configuration + ansible.builtin.include_tasks: ../tasks/configure_storage.yaml - name: Import standard general variables for GEANT L3 Core Services ansible.builtin.include_vars: diff --git a/geant/gap_ansible/playbooks/vrf_update.yaml b/geant/gap_ansible/playbooks/vrf_update.yaml index 17f26833e0eae216be77f1156e977a2bc030d578..866241642cd82960e7572bcc7da5a0577abf5f5a 100644 --- a/geant/gap_ansible/playbooks/vrf_update.yaml +++ b/geant/gap_ansible/playbooks/vrf_update.yaml @@ -3,24 +3,8 @@ hosts: all gather_facts: false tasks: - - name: Generate an ID for this run - ansible.builtin.set_fact: - opid: "{{ lookup('community.general.random_string', length=18, special=false) }}" - - - name: Print the ID - ansible.builtin.debug: - msg: "{{ opid }}" - - - name: Create a folder for all compiled output - ansible.builtin.file: - path: "/var/tmp/ansible_run_{{ opid }}" - state: directory - mode: '0755' - delegate_to: localhost - - - name: Import group_vars/all - ansible.builtin.include_vars: - dir: /opt/ansible_inventory/group_vars/all + - name: Include storage path configuration + ansible.builtin.include_tasks: ../tasks/configure_storage.yaml - name: Import standard variables for "{{ subscription.product.product_type }}/{{ subscription.vrf.vrf_name | upper }}" ansible.builtin.include_vars: diff --git a/geant/gap_ansible/roles/base_config/tasks/compile_base_config.yaml b/geant/gap_ansible/roles/base_config/tasks/compile_base_config.yaml index 96a5b4e286c4f8d335daa7cf97d661c3ba808b18..a0531622d692b9b77b225d168ba9def39d95f227 100644 --- a/geant/gap_ansible/roles/base_config/tasks/compile_base_config.yaml +++ b/geant/gap_ansible/roles/base_config/tasks/compile_base_config.yaml @@ -18,15 +18,15 @@ - name: Create a folder for all the things ansible.builtin.file: - path: "/var/tmp/ansible_run_{{ opid }}" + path: "{{ play_storage_path }}" state: directory mode: '0755' delegate_to: localhost -- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/base_config.conf" +- name: Print the template in "{{ play_storage_path }}/base_config.conf" ansible.builtin.template: src: "routers/{{ wfo_router.router.vendor }}/base_config.j2" - dest: "/var/tmp/ansible_run_{{ opid }}/base_config.conf" + dest: "{{ play_storage_path }}/base_config.conf" lstrip_blocks: true trim_blocks: true mode: '0755' diff --git a/geant/gap_ansible/roles/base_config/tasks/configure_storage.yaml b/geant/gap_ansible/roles/base_config/tasks/configure_storage.yaml new file mode 120000 index 0000000000000000000000000000000000000000..0998fc94da841acab1668c1a80098f9f4e47bbb0 --- /dev/null +++ b/geant/gap_ansible/roles/base_config/tasks/configure_storage.yaml @@ -0,0 +1 @@ +../../../tasks/configure_storage.yaml \ No newline at end of file diff --git a/geant/gap_ansible/roles/base_config/tasks/deploy_base_config.yaml b/geant/gap_ansible/roles/base_config/tasks/deploy_base_config.yaml index c29a2a046af6678c16730bacd02dd4fd7ed4c617..83d8ab63ac67b7c338bfc93cc1ba6bf2216bd441 100644 --- a/geant/gap_ansible/roles/base_config/tasks/deploy_base_config.yaml +++ b/geant/gap_ansible/roles/base_config/tasks/deploy_base_config.yaml @@ -1,7 +1,7 @@ - name: Deploy base_config on "{{ inventory_hostname }}" [CHECK ONLY][Juniper] junipernetworks.junos.junos_config: update: 'replace' - src: "/var/tmp/ansible_run_{{ opid }}/{{ mytemplates.template_name }}.conf" + src: "{{ play_storage_path }}/{{ mytemplates.template_name }}.conf" src_format: text check_commit: true diff: true @@ -17,7 +17,7 @@ - name: Deploy base_config on "{{ inventory_hostname }}" [AND COMMIT][Juniper] junipernetworks.junos.junos_config: update: 'replace' - src: "/var/tmp/ansible_run_{{ opid }}/{{ mytemplates.template_name }}.conf" + src: "{{ play_storage_path }}/{{ mytemplates.template_name }}.conf" src_format: text comment: "{{ commit_comment }}" diff: true diff --git a/geant/gap_ansible/roles/base_config/tasks/main.yml b/geant/gap_ansible/roles/base_config/tasks/main.yml index 0a6fb446324230b694c9fcd4c9936cab80ca1b7f..a0f793aee732718e2db835d09107aab93b632533 100644 --- a/geant/gap_ansible/roles/base_config/tasks/main.yml +++ b/geant/gap_ansible/roles/base_config/tasks/main.yml @@ -39,17 +39,8 @@ when: wfo_router.router.vendor == "juniper" - -- name: Generate an ID for this run - ansible.builtin.set_fact: - opid: "{{ lookup('community.general.random_string', length=18, special=false) }}" - config_is_different: "False" - - -- name: Print the ID - ansible.builtin.debug: - msg: "{{ opid }}" - +- name: Include configure storage tasks + ansible.builtin.include_tasks: configure_storage.yaml - name: Merge the variables when: verb in verbs diff --git a/geant/gap_ansible/roles/bgp_config/tasks/compile.yaml b/geant/gap_ansible/roles/bgp_config/tasks/compile.yaml index 91cdd033f6dbde4eddca6b6451381bbf39e0b2d7..7ecde8bf22acf948e5f32030d78b6937409004e5 100644 --- a/geant/gap_ansible/roles/bgp_config/tasks/compile.yaml +++ b/geant/gap_ansible/roles/bgp_config/tasks/compile.yaml @@ -4,11 +4,11 @@ ansible_host: "localhost" ansible_connection: local -- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_bgp.conf" +- name: Print the template in "{{ play_storage_path }}/{{ partner_name }}_bgp.conf" # when: verb in ["deploy"] ansible.builtin.template: src: "{{ vendor }}/{{ verb }}/bgp.j2" - dest: "/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_bgp.conf" + dest: "{{ play_storage_path }}/{{ partner_name }}_bgp.conf" lstrip_blocks: true trim_blocks: true mode: '0755' diff --git a/geant/gap_ansible/roles/bgp_config/tasks/deploy_bgp.yaml b/geant/gap_ansible/roles/bgp_config/tasks/deploy_bgp.yaml index 4353e467dec54a2eb51020a8bfe02bf8e2748ebc..30568a14e55628bc6ca0c7ff5878ca1a8ba9c3bb 100644 --- a/geant/gap_ansible/roles/bgp_config/tasks/deploy_bgp.yaml +++ b/geant/gap_ansible/roles/bgp_config/tasks/deploy_bgp.yaml @@ -19,7 +19,7 @@ geant.gap_ansible.nokia_netconf_config: format: xml default_operation: merge - content: "{{ lookup('ansible.builtin.file', '/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_bgp.conf') }}" + content: "{{ lookup('ansible.builtin.file', '{{ play_storage_path }}/{{ partner_name }}_bgp.conf') }}" commit: true validate: true config_mode: private @@ -32,7 +32,7 @@ geant.gap_ansible.nokia_netconf_config: format: xml default_operation: merge - content: "{{ lookup('ansible.builtin.file', '/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_bgp.conf') }}" + content: "{{ lookup('ansible.builtin.file', '{{ play_storage_path }}/{{ partner_name }}_bgp.conf') }}" commit: true commit_comment: "{{ commit_comment }}" config_mode: private diff --git a/geant/gap_ansible/roles/deploy_service_config/tasks/assemble_config.yml b/geant/gap_ansible/roles/deploy_service_config/tasks/assemble_config.yml index 83c77e192238d7fe87e8ef340edcd17c20f6d071..e04b2a695907b554e6fb60fddc0fbbbeb2c8dc81 100644 --- a/geant/gap_ansible/roles/deploy_service_config/tasks/assemble_config.yml +++ b/geant/gap_ansible/roles/deploy_service_config/tasks/assemble_config.yml @@ -10,7 +10,7 @@ # Because ansible.builtin.assemble works with a single directory - name: Create a subdirectory for the assembled output ansible.builtin.file: - path: "/var/tmp/ansible_run_{{ opid }}/assembled/" + path: "{{ play_storage_path }}/assembled/" state: directory mode: '0755' @@ -18,28 +18,28 @@ - name: Copy Nokia SR OS header for assembly ansible.builtin.copy: src: "{{ vendor }}/header" - dest: "/var/tmp/ansible_run_{{ opid }}/assembled/00_header" + dest: "{{ play_storage_path }}/assembled/00_header" mode: '0644' # Enumeration prefix is needed to impact the order of assembly - name: Copy Nokia SR OS footer for assembly ansible.builtin.copy: src: "{{ vendor }}/footer" - dest: "/var/tmp/ansible_run_{{ opid }}/assembled/02_footer" + dest: "{{ play_storage_path }}/assembled/02_footer" mode: '0644' # Enumeration prefix is needed to impact the order of assembly - name: Assemble body of the config ansible.builtin.assemble: - src: "/var/tmp/ansible_run_{{ opid }}/" - dest: "/var/tmp/ansible_run_{{ opid }}/assembled/01-body" + src: "{{ play_storage_path }}/" + dest: "{{ play_storage_path }}/assembled/01-body" mode: '0644' # Use the enumeration prefixes to assemble fragments in the right order - name: Merge header, body and footer to get the final config ansible.builtin.assemble: - src: "/var/tmp/ansible_run_{{ opid }}/assembled" - dest: "/var/tmp/ansible_run_{{ opid }}/assembled/for_deployment" + src: "{{ play_storage_path }}/assembled" + dest: "{{ play_storage_path }}/assembled/for_deployment" mode: '0644' - name: Clean up the fragments @@ -48,4 +48,4 @@ state: absent mode: '0755' with_fileglob: - - "/var/tmp/ansible_run_{{ opid }}/assembled/0*" + - "{{ play_storage_path }}/assembled/0*" diff --git a/geant/gap_ansible/roles/deploy_service_config/tasks/push_config.yml b/geant/gap_ansible/roles/deploy_service_config/tasks/push_config.yml index 59c2a28b118b305357d73583ad63dec0bd315344..655885aaad3c5a6bc1eb995c1aee7ba01e479ffa 100644 --- a/geant/gap_ansible/roles/deploy_service_config/tasks/push_config.yml +++ b/geant/gap_ansible/roles/deploy_service_config/tasks/push_config.yml @@ -7,7 +7,7 @@ geant.gap_ansible.nokia_netconf_config: format: xml default_operation: merge - content: "{{ lookup('ansible.builtin.file', '/var/tmp/ansible_run_{{ opid }}/assembled/for_deployment') }}" + content: "{{ lookup('ansible.builtin.file', '{{ play_storage_path }}/assembled/for_deployment') }}" commit: true validate: true config_mode: private @@ -47,7 +47,7 @@ geant.gap_ansible.nokia_netconf_config: format: xml default_operation: merge - content: "{{ lookup('ansible.builtin.file', '/var/tmp/ansible_run_{{ opid }}/assembled/for_deployment') }}" + content: "{{ lookup('ansible.builtin.file', '{{ play_storage_path }}/assembled/for_deployment') }}" commit: true commit_comment: "{{ commit_comment }}" config_mode: private @@ -61,7 +61,7 @@ vendor == "juniper" junipernetworks.junos.junos_config: update: 'replace' - src: "/var/tmp/ansible_run_{{ opid }}/assembled/for_deployment" + src: "{{ play_storage_path }}/assembled/for_deployment" src_format: set check_commit: true diff: true @@ -73,7 +73,7 @@ vendor == "juniper" junipernetworks.junos.junos_config: update: 'replace' - src: "/var/tmp/ansible_run_{{ opid }}/assembled/for_deployment" + src: "{{ play_storage_path }}/assembled/for_deployment" src_format: set comment: "{{ commit_comment }}" diff: true diff --git a/geant/gap_ansible/roles/edge_port/tasks/compile.yaml b/geant/gap_ansible/roles/edge_port/tasks/compile.yaml index 6c7fc2c36ec3ad7da2d1fb2bc4fcceb37fe21693..0cdaff1aaa784e4c48778753bd9be200075ef2ea 100644 --- a/geant/gap_ansible/roles/edge_port/tasks/compile.yaml +++ b/geant/gap_ansible/roles/edge_port/tasks/compile.yaml @@ -6,18 +6,11 @@ ansible_host: "localhost" ansible_connection: local -- name: Create a folder for all the things - ansible.builtin.file: - path: "/var/tmp/ansible_run_{{ opid }}" - state: directory - mode: '0755' - delegate_to: localhost - -- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/edge_port_{{ verb }}.conf" +- name: Print the template in "{{ play_storage_path }}/edge_port_{{ verb }}.conf" when: verb == "create" ansible.builtin.template: src: "{{ router.vendor }}/edge_port_{{ verb }}.j2" - dest: "/var/tmp/ansible_run_{{ opid }}/edge_port_{{ verb }}.conf" + dest: "{{ play_storage_path }}/edge_port_{{ verb }}.conf" lstrip_blocks: true trim_blocks: true mode: '0755' diff --git a/geant/gap_ansible/roles/edge_port/tasks/configure_storage.yaml b/geant/gap_ansible/roles/edge_port/tasks/configure_storage.yaml new file mode 120000 index 0000000000000000000000000000000000000000..0998fc94da841acab1668c1a80098f9f4e47bbb0 --- /dev/null +++ b/geant/gap_ansible/roles/edge_port/tasks/configure_storage.yaml @@ -0,0 +1 @@ +../../../tasks/configure_storage.yaml \ No newline at end of file diff --git a/geant/gap_ansible/roles/edge_port/tasks/main.yml b/geant/gap_ansible/roles/edge_port/tasks/main.yml index 5116435732b10ec1a640d2baf6e2439bc6d14f70..2381bf691acb66f348966795bb9b8ac739e08c74 100644 --- a/geant/gap_ansible/roles/edge_port/tasks/main.yml +++ b/geant/gap_ansible/roles/edge_port/tasks/main.yml @@ -3,6 +3,9 @@ - name: Include Standard role tasks ansible.builtin.include_tasks: standard_tasks.yaml +- name: Include configure storage tasks + ansible.builtin.include_tasks: configure_storage.yaml + - name: Include templates compilation when: verb in verbs ansible.builtin.include_tasks: compile.yaml diff --git a/geant/gap_ansible/roles/edge_port/tasks/standard_tasks.yaml b/geant/gap_ansible/roles/edge_port/tasks/standard_tasks.yaml index 4642e967b7ec2030e1fd6ce82a896733d5e9bb5b..413c0516ac11ddfdb1a398f2f6ce602768deadab 100644 --- a/geant/gap_ansible/roles/edge_port/tasks/standard_tasks.yaml +++ b/geant/gap_ansible/roles/edge_port/tasks/standard_tasks.yaml @@ -27,11 +27,3 @@ - name: Import variables for Edge Ports hold times ansible.builtin.include_vars: file: /opt/ansible_inventory/group_vars/routers/nokia/edge_ports.yaml - -- name: Generate an ID for this run - ansible.builtin.set_fact: - opid: "{{ lookup('community.general.random_string', length=18, special=false) }}" - -- name: Print the ID - ansible.builtin.debug: - msg: "{{ opid }}" diff --git a/geant/gap_ansible/roles/fw_filters/tasks/compile.yaml b/geant/gap_ansible/roles/fw_filters/tasks/compile.yaml index 542c04d554e9fd07eeb9ec4f15c05b2958d4a2c9..f8ab6589947a5de275c3093a8bdc37f71f6b0424 100644 --- a/geant/gap_ansible/roles/fw_filters/tasks/compile.yaml +++ b/geant/gap_ansible/roles/fw_filters/tasks/compile.yaml @@ -4,11 +4,11 @@ ansible_host: "localhost" ansible_connection: local -- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_filters.conf" +- name: Print the template in "{{ play_storage_path }}/{{ partner_name }}_filters.conf" # when: verb in ["deploy", "update", "terminate"] ansible.builtin.template: src: "filters/gen_filters.j2" - dest: "/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_filters.conf" + dest: "{{ play_storage_path }}/{{ partner_name }}_filters.conf" lstrip_blocks: true trim_blocks: true mode: '0755' diff --git a/geant/gap_ansible/roles/fw_filters/tasks/deploy_fw.yaml b/geant/gap_ansible/roles/fw_filters/tasks/deploy_fw.yaml index 1d7d8d4cd2900597ca030251eca823b1fc84de7a..fe5e515b7644b4bfad3296be92f932f2ade84b01 100644 --- a/geant/gap_ansible/roles/fw_filters/tasks/deploy_fw.yaml +++ b/geant/gap_ansible/roles/fw_filters/tasks/deploy_fw.yaml @@ -19,7 +19,7 @@ geant.gap_ansible.nokia_netconf_config: format: xml default_operation: merge - content: "{{ lookup('ansible.builtin.file', '/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_filters.conf') }}" + content: "{{ lookup('ansible.builtin.file', '{{ play_storage_path }}/{{ partner_name }}_filters.conf') }}" commit: true validate: true config_mode: private @@ -32,7 +32,7 @@ geant.gap_ansible.nokia_netconf_config: format: xml default_operation: merge - content: "{{ lookup('ansible.builtin.file', '/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_filters.conf') }}" + content: "{{ lookup('ansible.builtin.file', '{{ play_storage_path }}/{{ partner_name }}_filters.conf') }}" commit: true commit_comment: "{{ commit_comment }}" config_mode: private diff --git a/geant/gap_ansible/roles/ibgp_update/tasks/compile.yaml b/geant/gap_ansible/roles/ibgp_update/tasks/compile.yaml index 538be40b68a52990d906439e3ae37cbb4272fa49..15fe74195953fd59bf2770dd3a08d96aa99a95f3 100644 --- a/geant/gap_ansible/roles/ibgp_update/tasks/compile.yaml +++ b/geant/gap_ansible/roles/ibgp_update/tasks/compile.yaml @@ -7,17 +7,10 @@ ( wfo_router.router.router_access_via_ts | ansible.builtin.bool ) is true and inventory_hostname == wfo_router.router.router_fqdn -- name: Create a folder for all the things - ansible.builtin.file: - path: "/var/tmp/ansible_run_{{ opid }}" - state: directory - mode: '0755' - delegate_to: localhost - -- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/{{ verb }}.conf" +- name: Print the template in "{{ play_storage_path }}/{{ verb }}.conf" ansible.builtin.template: src: "{{ vendor }}/{{ verb }}.j2" - dest: "/var/tmp/ansible_run_{{ opid }}/{{ verb }}.conf" + dest: "{{ play_storage_path }}/{{ verb }}.conf" lstrip_blocks: true trim_blocks: true mode: '0755' diff --git a/geant/gap_ansible/roles/ibgp_update/tasks/configure_storage.yaml b/geant/gap_ansible/roles/ibgp_update/tasks/configure_storage.yaml new file mode 120000 index 0000000000000000000000000000000000000000..0998fc94da841acab1668c1a80098f9f4e47bbb0 --- /dev/null +++ b/geant/gap_ansible/roles/ibgp_update/tasks/configure_storage.yaml @@ -0,0 +1 @@ +../../../tasks/configure_storage.yaml \ No newline at end of file diff --git a/geant/gap_ansible/roles/ibgp_update/tasks/deploy.yaml b/geant/gap_ansible/roles/ibgp_update/tasks/deploy.yaml index 5d60a579b71ccf9486564458910bd1fab9d46470..8954f0fe7122f0095237db46e938e6a03e3f5ec0 100644 --- a/geant/gap_ansible/roles/ibgp_update/tasks/deploy.yaml +++ b/geant/gap_ansible/roles/ibgp_update/tasks/deploy.yaml @@ -2,7 +2,7 @@ - name: Update iBGP mesh ["{{ verb }}"] on "{{ inventory_hostname }}" [CHECK ONLY][Juniper] junipernetworks.junos.junos_config: update: 'replace' - src: "/var/tmp/ansible_run_{{ opid }}/{{ verb }}.conf" + src: "{{ play_storage_path }}/{{ verb }}.conf" src_format: set check_commit: true diff: true @@ -13,7 +13,7 @@ - name: Update iBGP mesh ["{{ verb }}"] on "{{ inventory_hostname }}" [AND COMMIT][Juniper] junipernetworks.junos.junos_config: update: 'replace' - src: "/var/tmp/ansible_run_{{ opid }}/{{ verb }}.conf" + src: "{{ play_storage_path }}/{{ verb }}.conf" src_format: set comment: "{{ commit_comment }}" diff: true diff --git a/geant/gap_ansible/roles/ibgp_update/tasks/main.yml b/geant/gap_ansible/roles/ibgp_update/tasks/main.yml index b76edb3b2b155db9834e8a2a817b4d3df70d1628..46ab54a6e49781534d0285e7af625fdc3a21e1cd 100644 --- a/geant/gap_ansible/roles/ibgp_update/tasks/main.yml +++ b/geant/gap_ansible/roles/ibgp_update/tasks/main.yml @@ -26,14 +26,12 @@ ansible.builtin.include_vars: dir: /opt/ansible_inventory/group_vars/all -- name: Generate an ID for this run +- name: Set config_is_different var ansible.legacy.set_fact: - opid: "{{ lookup('community.general.random_string', length=18, special=false) }}" config_is_different: "False" -- name: Print the ID - ansible.builtin.debug: - msg: "{{ opid }}" +- name: Include configure storage tasks + ansible.builtin.include_tasks: configure_storage.yaml - name: Include list of routers modification tasks ansible.builtin.include_tasks: modify_router_list.yaml diff --git a/geant/gap_ansible/roles/ip_prefix_lists/tasks/compile.yaml b/geant/gap_ansible/roles/ip_prefix_lists/tasks/compile.yaml index f8ce4b6eb8746b431bbfc3ce1e043e76e128e40c..50f159a08e20e8f6264c8c4517a8495a4ed522ec 100644 --- a/geant/gap_ansible/roles/ip_prefix_lists/tasks/compile.yaml +++ b/geant/gap_ansible/roles/ip_prefix_lists/tasks/compile.yaml @@ -4,12 +4,12 @@ ansible_host: "localhost" ansible_connection: local -- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/IP_PREFIX_LISTS.conf" +- name: Print the template in "{{ play_storage_path }}/IP_PREFIX_LISTS.conf" # when: verb in ["deploy", "update", "terminate"] when: final_ip_prefix_lists is defined ansible.builtin.template: src: "ip_prefix_list.j2" - dest: "/var/tmp/ansible_run_{{ opid }}/IP_PREFIX_LISTS.conf" + dest: "{{ play_storage_path }}/IP_PREFIX_LISTS.conf" lstrip_blocks: true trim_blocks: true mode: '0755' diff --git a/geant/gap_ansible/roles/iptrunk/tasks/compile_object.yaml b/geant/gap_ansible/roles/iptrunk/tasks/compile_object.yaml index f248c392804407ce71365a6186d6eae365e7d372..6c56467a5e41e4148d8de25dbef5b1ec05aae320 100644 --- a/geant/gap_ansible/roles/iptrunk/tasks/compile_object.yaml +++ b/geant/gap_ansible/roles/iptrunk/tasks/compile_object.yaml @@ -5,17 +5,10 @@ when: ( local_side.iptrunk_side_node.router_access_via_ts | ansible.builtin.bool ) is true -- name: Create a folder for all the templates - ansible.builtin.file: - path: "/var/tmp/ansible_run_{{ opid }}" - state: directory - mode: '0755' - delegate_to: localhost - -- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" +- name: Print the template in "{{ play_storage_path }}/{{ config_object }}.conf" ansible.builtin.template: src: "{{ local_side.iptrunk_side_node.vendor }}/{{ config_object }}.j2" - dest: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" + dest: "{{ play_storage_path }}/{{ config_object }}.conf" lstrip_blocks: true trim_blocks: true mode: '0755' diff --git a/geant/gap_ansible/roles/iptrunk/tasks/configure_storage.yaml b/geant/gap_ansible/roles/iptrunk/tasks/configure_storage.yaml new file mode 120000 index 0000000000000000000000000000000000000000..0998fc94da841acab1668c1a80098f9f4e47bbb0 --- /dev/null +++ b/geant/gap_ansible/roles/iptrunk/tasks/configure_storage.yaml @@ -0,0 +1 @@ +../../../tasks/configure_storage.yaml \ No newline at end of file diff --git a/geant/gap_ansible/roles/iptrunk/tasks/deploy_object.yaml b/geant/gap_ansible/roles/iptrunk/tasks/deploy_object.yaml index acbaade50ce347b6ccd125a15cd06806d601a3e5..81267508d5bdbe4a899fb570540d58a9162ea8c2 100644 --- a/geant/gap_ansible/roles/iptrunk/tasks/deploy_object.yaml +++ b/geant/gap_ansible/roles/iptrunk/tasks/deploy_object.yaml @@ -2,7 +2,7 @@ - name: Deploy "{{ config_object }}" on "{{ inventory_hostname }}" [CHECK ONLY][JUNIPER] junipernetworks.junos.junos_config: update: 'replace' - src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" + src: "{{ play_storage_path }}/{{ config_object }}.conf" src_format: text check_commit: true diff: true @@ -25,7 +25,7 @@ - name: Deploy "{{ config_object }}" on "{{ inventory_hostname }}" [AND COMMIT][JUNIPER] junipernetworks.junos.junos_config: update: 'replace' - src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" + src: "{{ play_storage_path }}/{{ config_object }}.conf" src_format: text comment: "{{ commit_comment }}" diff: true diff --git a/geant/gap_ansible/roles/iptrunk/tasks/main.yml b/geant/gap_ansible/roles/iptrunk/tasks/main.yml index d7f1c2d576a5b9d27c9ded4e602e0d0d0175e219..f3f0860e6251ffd94694bdad8e7e3e81705bdc06 100644 --- a/geant/gap_ansible/roles/iptrunk/tasks/main.yml +++ b/geant/gap_ansible/roles/iptrunk/tasks/main.yml @@ -20,10 +20,8 @@ ansible.builtin.include_vars: dir: /opt/ansible_inventory/group_vars/all -- name: Set an ID for this run - ansible.builtin.set_fact: - opid: "{{ lookup('community.general.random_string', length=18, special=false) }}" - config_is_different: "False" +- name: Include configure storage tasks + ansible.builtin.include_tasks: configure_storage.yaml - name: Load local info ansible.builtin.set_fact: @@ -56,10 +54,6 @@ when: ( local_side.iptrunk_side_node.router_access_via_ts | ansible.builtin.bool ) is true -- name: Print the ID - ansible.builtin.debug: - msg: "{{ opid }}" - - name: Include compiling the template ansible.builtin.include_tasks: compile_object.yaml when: (verb in verbs) diff --git a/geant/gap_ansible/roles/iptrunk/tasks/modify_trunk.yaml b/geant/gap_ansible/roles/iptrunk/tasks/modify_trunk.yaml index f99b0df4f0adccded7e53d3db70af9536f23d880..459701f307c98088e3bcbc33778edfc929735056 100644 --- a/geant/gap_ansible/roles/iptrunk/tasks/modify_trunk.yaml +++ b/geant/gap_ansible/roles/iptrunk/tasks/modify_trunk.yaml @@ -12,7 +12,7 @@ - name: Update ISIS metric [CHECK ONLY] junipernetworks.junos.junos_config: update: 'replace' - src: "/var/tmp/ansible_run_{{ opid }}/isis_interface.conf" + src: "{{ play_storage_path }}/isis_interface.conf" src_format: text check_commit: true diff: true @@ -21,7 +21,7 @@ - name: Update ISIS metric [FOR REAL] junipernetworks.junos.junos_config: update: 'replace' - src: "/var/tmp/ansible_run_{{ opid }}/isis_interface.conf" + src: "{{ play_storage_path }}/isis_interface.conf" src_format: text comment: "{{ commit_comment }}" diff: true diff --git a/geant/gap_ansible/roles/iptrunk/tasks/remove_trunk.yaml b/geant/gap_ansible/roles/iptrunk/tasks/remove_trunk.yaml index 271c8efe7707494557653099930c5ed9d1562951..075bed9b240773b8a9d1f11eaad483ae53522255 100644 --- a/geant/gap_ansible/roles/iptrunk/tasks/remove_trunk.yaml +++ b/geant/gap_ansible/roles/iptrunk/tasks/remove_trunk.yaml @@ -2,7 +2,7 @@ - name: Remove "{{ config_object }}" on "{{ inventory_hostname }}" [CHECK ONLY][JUNIPER] junipernetworks.junos.junos_config: update: 'merge' - src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" + src: "{{ play_storage_path }}/{{ config_object }}.conf" src_format: set check_commit: true diff: true @@ -14,7 +14,7 @@ - name: Remove "{{ config_object }}" on "{{ inventory_hostname }}" [AND COMMIT][JUNIPER] junipernetworks.junos.junos_config: update: 'merge' - src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" + src: "{{ play_storage_path }}/{{ config_object }}.conf" src_format: set comment: "{{ commit_comment }}" diff: true diff --git a/geant/gap_ansible/roles/iptrunk_migration/tasks/bfd_update.yaml b/geant/gap_ansible/roles/iptrunk_migration/tasks/bfd_update.yaml index 74842b76c7c56a6580a31d0f192e74002fa695cd..10e8292abab576c546627e063c48615b21074cde 100644 --- a/geant/gap_ansible/roles/iptrunk_migration/tasks/bfd_update.yaml +++ b/geant/gap_ansible/roles/iptrunk_migration/tasks/bfd_update.yaml @@ -8,7 +8,7 @@ dry_run | ansible.builtin.bool junipernetworks.junos.junos_config: update: 'replace' - src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" + src: "{{ play_storage_path }}/{{ config_object }}.conf" src_format: set check_commit: true diff: true @@ -22,7 +22,7 @@ not (dry_run | ansible.builtin.bool) junipernetworks.junos.junos_config: update: 'replace' - src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" + src: "{{ play_storage_path }}/{{ config_object }}.conf" src_format: set comment: "{{ commit_comment }}" diff: true diff --git a/geant/gap_ansible/roles/iptrunk_migration/tasks/compile_template.yaml b/geant/gap_ansible/roles/iptrunk_migration/tasks/compile_template.yaml index 80e59fe72ce21a8147d987979f5b2261ab9a647e..89d9c063738e9596fe45d78e7dab4ee60d18f08f 100644 --- a/geant/gap_ansible/roles/iptrunk_migration/tasks/compile_template.yaml +++ b/geant/gap_ansible/roles/iptrunk_migration/tasks/compile_template.yaml @@ -13,37 +13,30 @@ ( new_node.router.router_access_via_ts | ansible.builtin.bool ) is true and (verb == "deploy") -- name: Create a folder for all the templates - ansible.builtin.file: - path: "/var/tmp/ansible_run_{{ opid }}" - state: directory - mode: '0755' - delegate_to: localhost - -- name: Print template for the old node "{{ old_node.fqdn }}" in "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" +- name: Print template for the old node "{{ old_node.fqdn }}" in "{{ play_storage_path }}/{{ config_object }}.conf" ansible.builtin.template: src: "{{ old_node.vendor }}/{{ config_object }}.j2" - dest: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" + dest: "{{ play_storage_path }}/{{ config_object }}.conf" lstrip_blocks: true trim_blocks: true mode: '0755' delegate_to: localhost when: (verb == "delete" or verb == "deactivate") and inventory_hostname != new_node.router.router_fqdn -- name: Print template for the new node in "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" +- name: Print template for the new node in "{{ play_storage_path }}/{{ config_object }}.conf" ansible.builtin.template: src: "{{ new_node.router.vendor }}/{{ config_object }}.j2" - dest: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" + dest: "{{ play_storage_path }}/{{ config_object }}.conf" lstrip_blocks: true trim_blocks: true mode: '0755' delegate_to: localhost when: (verb == "deploy") and inventory_hostname == new_node.router.router_fqdn -- name: Print template for the remaining node in "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" +- name: Print template for the remaining node in "{{ play_storage_path }}/{{ config_object }}.conf" ansible.builtin.template: src: "{{ remaining_side.vendor }}/{{ config_object }}.j2" - dest: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" + dest: "{{ play_storage_path }}/{{ config_object }}.conf" lstrip_blocks: true trim_blocks: true mode: '0755' diff --git a/geant/gap_ansible/roles/iptrunk_migration/tasks/configure_storage.yaml b/geant/gap_ansible/roles/iptrunk_migration/tasks/configure_storage.yaml new file mode 120000 index 0000000000000000000000000000000000000000..0998fc94da841acab1668c1a80098f9f4e47bbb0 --- /dev/null +++ b/geant/gap_ansible/roles/iptrunk_migration/tasks/configure_storage.yaml @@ -0,0 +1 @@ +../../../tasks/configure_storage.yaml \ No newline at end of file diff --git a/geant/gap_ansible/roles/iptrunk_migration/tasks/deactivate_trunk_side.yaml b/geant/gap_ansible/roles/iptrunk_migration/tasks/deactivate_trunk_side.yaml index 2eb8ec6c0ec7a0003e805302fdb4ee1a2496de21..46e618bcff6671f67ec50cf851938034477a78b6 100644 --- a/geant/gap_ansible/roles/iptrunk_migration/tasks/deactivate_trunk_side.yaml +++ b/geant/gap_ansible/roles/iptrunk_migration/tasks/deactivate_trunk_side.yaml @@ -8,7 +8,7 @@ dry_run | ansible.builtin.bool junipernetworks.junos.junos_config: update: 'replace' - src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" + src: "{{ play_storage_path }}/{{ config_object }}.conf" src_format: set check_commit: true diff: true @@ -22,7 +22,7 @@ not (dry_run | ansible.builtin.bool) junipernetworks.junos.junos_config: update: 'replace' - src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" + src: "{{ play_storage_path }}/{{ config_object }}.conf" src_format: set comment: "{{ commit_comment }}" diff: true diff --git a/geant/gap_ansible/roles/iptrunk_migration/tasks/delete_trunk_side.yaml b/geant/gap_ansible/roles/iptrunk_migration/tasks/delete_trunk_side.yaml index ec7b2da440a2d55afd08349d97831b13ec73b129..af48e7363fed0a4b229cd5037c957e22a21893cb 100644 --- a/geant/gap_ansible/roles/iptrunk_migration/tasks/delete_trunk_side.yaml +++ b/geant/gap_ansible/roles/iptrunk_migration/tasks/delete_trunk_side.yaml @@ -2,7 +2,7 @@ - name: Delete Trunk interface on "{{ inventory_hostname }}" [CHECK ONLY][JUNIPER] junipernetworks.junos.junos_config: update: 'replace' - src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" + src: "{{ play_storage_path }}/{{ config_object }}.conf" src_format: set check_commit: true diff: true @@ -14,7 +14,7 @@ - name: Delete Trunk interface on "{{ inventory_hostname }}" [AND COMMIT][JUNIPER] junipernetworks.junos.junos_config: update: 'replace' - src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" + src: "{{ play_storage_path }}/{{ config_object }}.conf" src_format: set comment: "{{ commit_comment }}" diff: true diff --git a/geant/gap_ansible/roles/iptrunk_migration/tasks/deploy_object.yaml b/geant/gap_ansible/roles/iptrunk_migration/tasks/deploy_object.yaml index e9fd16833566c902c6398e0bfeb130fe9df77dd3..0eb196917003f0498405dc4afd7e7700036ab5d8 100644 --- a/geant/gap_ansible/roles/iptrunk_migration/tasks/deploy_object.yaml +++ b/geant/gap_ansible/roles/iptrunk_migration/tasks/deploy_object.yaml @@ -2,7 +2,7 @@ - name: Deploy "{{ config_object }}" on "{{ inventory_hostname }}" [CHECK ONLY][JUNIPER] junipernetworks.junos.junos_config: update: 'replace' - src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" + src: "{{ play_storage_path }}/{{ config_object }}.conf" src_format: set check_commit: true diff: true @@ -14,7 +14,7 @@ - name: Deploy "{{ config_object }}" on "{{ inventory_hostname }}" [AND COMMIT][JUNIPER] junipernetworks.junos.junos_config: update: 'replace' - src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" + src: "{{ play_storage_path }}/{{ config_object }}.conf" src_format: set comment: "{{ commit_comment }}" diff: true diff --git a/geant/gap_ansible/roles/iptrunk_migration/tasks/main.yml b/geant/gap_ansible/roles/iptrunk_migration/tasks/main.yml index 92983df4e78f4c1f93853991324d3e1d2184efcb..6b475754590499acbc2d2c17a21779c3e4fd8c66 100644 --- a/geant/gap_ansible/roles/iptrunk_migration/tasks/main.yml +++ b/geant/gap_ansible/roles/iptrunk_migration/tasks/main.yml @@ -20,11 +20,6 @@ ansible.builtin.include_vars: dir: /opt/ansible_inventory/group_vars/routers -- name: Set an ID for this run - ansible.builtin.set_fact: - opid: "{{ lookup('community.general.random_string', length=18, special=false) }}" - config_is_different: "False" - - name: The old node is ansible.builtin.debug: msg: "{{ old_node.fqdn }}" @@ -33,6 +28,9 @@ ansible.builtin.debug: msg: "{{ new_node.router.router_fqdn }}" +- name: Include configure storage tasks + ansible.builtin.include_tasks: configure_storage.yaml + - name: Select the correct IPaddresses ansible.builtin.include_tasks: calculate_ips.yaml when: verb == "deploy" @@ -60,10 +58,6 @@ when: verb == "deploy" -- name: Print the ID - ansible.builtin.debug: - msg: "{{ opid }}" - - name: Include compiling the template for the old node ansible.builtin.include_tasks: compile_template.yaml when: (verb == "deactivate" or verb == "delete") diff --git a/geant/gap_ansible/roles/iptrunk_twamp/tasks/compile_object.yaml b/geant/gap_ansible/roles/iptrunk_twamp/tasks/compile_object.yaml index f421942c70263a9e2c2570f18a310d01c09ff95b..dccffc09092edf6a86b14b2917947b4c5e070028 100644 --- a/geant/gap_ansible/roles/iptrunk_twamp/tasks/compile_object.yaml +++ b/geant/gap_ansible/roles/iptrunk_twamp/tasks/compile_object.yaml @@ -7,15 +7,15 @@ - name: Create a folder for all the templates ansible.builtin.file: - path: "/var/tmp/ansible_run_{{ opid }}" + path: "{{ play_storage_path }}" state: directory mode: '0755' delegate_to: localhost -- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" +- name: Print the template in "{{ play_storage_path }}/{{ config_object }}.conf" ansible.builtin.template: src: "{{ local_side.iptrunk_side_node.vendor }}/{{ config_object }}.j2" - dest: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" + dest: "{{ play_storage_path }}/{{ config_object }}.conf" lstrip_blocks: true trim_blocks: true mode: '0755' diff --git a/geant/gap_ansible/roles/iptrunk_twamp/tasks/configure_storage.yaml b/geant/gap_ansible/roles/iptrunk_twamp/tasks/configure_storage.yaml new file mode 120000 index 0000000000000000000000000000000000000000..0998fc94da841acab1668c1a80098f9f4e47bbb0 --- /dev/null +++ b/geant/gap_ansible/roles/iptrunk_twamp/tasks/configure_storage.yaml @@ -0,0 +1 @@ +../../../tasks/configure_storage.yaml \ No newline at end of file diff --git a/geant/gap_ansible/roles/iptrunk_twamp/tasks/deploy_object.yaml b/geant/gap_ansible/roles/iptrunk_twamp/tasks/deploy_object.yaml index b67902ad4315576cbb4cf4b0354161175b349f30..4d356fc2a4766abd958c759f94fba48c0b7c8ca2 100644 --- a/geant/gap_ansible/roles/iptrunk_twamp/tasks/deploy_object.yaml +++ b/geant/gap_ansible/roles/iptrunk_twamp/tasks/deploy_object.yaml @@ -2,7 +2,7 @@ - name: Deploy "{{ config_object }}" on "{{ inventory_hostname }}" [CHECK ONLY][JUNIPER] junipernetworks.junos.junos_config: update: 'replace' - src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" + src: "{{ play_storage_path }}/{{ config_object }}.conf" src_format: text check_commit: true diff: true @@ -25,7 +25,7 @@ - name: Deploy "{{ config_object }}" on "{{ inventory_hostname }}" [AND COMMIT][JUNIPER] junipernetworks.junos.junos_config: update: 'replace' - src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" + src: "{{ play_storage_path }}/{{ config_object }}.conf" src_format: text comment: "{{ commit_comment }}" diff: true diff --git a/geant/gap_ansible/roles/iptrunk_twamp/tasks/main.yml b/geant/gap_ansible/roles/iptrunk_twamp/tasks/main.yml index be13f4729a6a475fcbd50fbbc05b79c114a43b71..11aba4de4dd72055e3273f8c8c28f236a18ae4e8 100644 --- a/geant/gap_ansible/roles/iptrunk_twamp/tasks/main.yml +++ b/geant/gap_ansible/roles/iptrunk_twamp/tasks/main.yml @@ -9,10 +9,12 @@ ansible.builtin.include_vars: dir: /opt/ansible_inventory/group_vars/routers -- name: Set an ID for this run - ansible.builtin.set_fact: - opid: "{{ lookup('community.general.random_string', length=18, special=false) }}" - config_is_different: "False" +- name: Include configure storage tasks + ansible.builtin.include_tasks: configure_storage.yaml + +# - name: Set "config_is_different" var +# ansible.builtin.set_fact: +# config_is_different: "False" - name: Load local info ansible.builtin.set_fact: @@ -38,10 +40,6 @@ when: ( local_side.iptrunk_side_node.router_access_via_ts | ansible.builtin.bool ) -- name: Print the ID - ansible.builtin.debug: - msg: "{{ opid }}" - - name: Set short router names for local and remote sides ansible.builtin.set_fact: local_side_short_name: '{{ local_side.iptrunk_side_node.router_fqdn | replace(domain_name_regex, "") }}' diff --git a/geant/gap_ansible/roles/l2circuits/tasks/compile.yaml b/geant/gap_ansible/roles/l2circuits/tasks/compile.yaml index 86f50fbb0360f53919afeda3c994437eecfe0591..87b81c45c6320c841e976dfdb07be14da9492f7e 100644 --- a/geant/gap_ansible/roles/l2circuits/tasks/compile.yaml +++ b/geant/gap_ansible/roles/l2circuits/tasks/compile.yaml @@ -4,11 +4,11 @@ ansible_host: "localhost" ansible_connection: local -- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/{{ l2circuits_fqdn }}_l2c.conf" +- name: Print the template in "{{ play_storage_path }}/{{ l2circuits_fqdn }}_l2c.conf" # when: verb in ["deploy", "update", "terminate"] ansible.builtin.template: src: "{{ l2circuits_vendor }}/{{ verb }}/l2circuit.j2" - dest: "/var/tmp/ansible_run_{{ opid }}/{{ l2circuits_fqdn }}_l2c.conf" + dest: "{{ play_storage_path }}/{{ l2circuits_fqdn }}_l2c.conf" lstrip_blocks: true trim_blocks: true mode: "0755" diff --git a/geant/gap_ansible/roles/l2circuits/tasks/configure_storage.yaml b/geant/gap_ansible/roles/l2circuits/tasks/configure_storage.yaml new file mode 120000 index 0000000000000000000000000000000000000000..0998fc94da841acab1668c1a80098f9f4e47bbb0 --- /dev/null +++ b/geant/gap_ansible/roles/l2circuits/tasks/configure_storage.yaml @@ -0,0 +1 @@ +../../../tasks/configure_storage.yaml \ No newline at end of file diff --git a/geant/gap_ansible/roles/l2circuits/tasks/main.yml b/geant/gap_ansible/roles/l2circuits/tasks/main.yml index 85f499527bf20bf25117f3a1c3a8dbe8ca70b2c4..bebc96b905dcf2c4ebad76ca547c9248e4d75914 100644 --- a/geant/gap_ansible/roles/l2circuits/tasks/main.yml +++ b/geant/gap_ansible/roles/l2circuits/tasks/main.yml @@ -7,8 +7,8 @@ - name: Produce the config for the current l2circuit endpoint when: inventory_hostname == l2circuits_fqdn block: - - name: Include standard tasks - ansible.builtin.include_tasks: standard_tasks.yaml + - name: Include configure storage tasks + ansible.builtin.include_tasks: configure_storage.yaml - name: Merge vars ansible.builtin.include_tasks: merge_vars.yaml diff --git a/geant/gap_ansible/roles/l2circuits/tasks/push_config.yaml b/geant/gap_ansible/roles/l2circuits/tasks/push_config.yaml index 3153a8cb9fe29fecdd1ebf02d898f5385a3d146f..a5f59cc4365b39eaf3372e9a845fb04a77964ff2 100644 --- a/geant/gap_ansible/roles/l2circuits/tasks/push_config.yaml +++ b/geant/gap_ansible/roles/l2circuits/tasks/push_config.yaml @@ -7,7 +7,7 @@ geant.gap_ansible.nokia_netconf_config: format: xml default_operation: merge - content: "{{ lookup('ansible.builtin.file', '/var/tmp/ansible_run_{{ opid }}/{{ l2circuits_fqdn }}_l2c.conf') }}" + content: "{{ lookup('ansible.builtin.file', '{{ play_storage_path }}/{{ l2circuits_fqdn }}_l2c.conf') }}" commit: true validate: true config_mode: private @@ -32,7 +32,7 @@ geant.gap_ansible.nokia_netconf_config: format: xml default_operation: merge - content: "{{ lookup('ansible.builtin.file', '/var/tmp/ansible_run_{{ opid }}/{{ l2circuits_fqdn }}_l2c.conf') }}" + content: "{{ lookup('ansible.builtin.file', '{{ play_storage_path }}/{{ l2circuits_fqdn }}_l2c.conf') }}" commit: true commit_comment: "{{ commit_comment }}" config_mode: private @@ -46,7 +46,7 @@ l2circuits_vendor == "juniper" junipernetworks.junos.junos_config: update: "replace" - src: "/var/tmp/ansible_run_{{ opid }}/{{ l2circuits_fqdn }}_l2c.conf" + src: "{{ play_storage_path }}/{{ l2circuits_fqdn }}_l2c.conf" src_format: set check_commit: true diff: true @@ -58,7 +58,7 @@ l2circuits_vendor == "juniper" junipernetworks.junos.junos_config: update: "replace" - src: "/var/tmp/ansible_run_{{ opid }}/{{ l2circuits_fqdn }}_l2c.conf" + src: "{{ play_storage_path }}/{{ l2circuits_fqdn }}_l2c.conf" src_format: set comment: "{{ commit_comment }}" diff: true diff --git a/geant/gap_ansible/roles/l2circuits/tasks/standard_tasks.yaml b/geant/gap_ansible/roles/l2circuits/tasks/standard_tasks.yaml index 4772e5bba9ad6a0f39f7a8cc6bd4b019e4cf568d..359cfd6d6c3ba14e0cb9b480d613fa22a7cd1481 100644 --- a/geant/gap_ansible/roles/l2circuits/tasks/standard_tasks.yaml +++ b/geant/gap_ansible/roles/l2circuits/tasks/standard_tasks.yaml @@ -7,9 +7,13 @@ ansible.builtin.debug: msg: "{{ opid }}" +- name: Generate FS path for artifacts storage + ansible.builtin.set_fact: + play_storage_path: "{{ storage_mount_prefix | default('/var/tmp') }}/{{ gso_process_id | default('gso_pid_undefined') }}/ansible_run_{{ opid }}" + - name: Create a folder for all compiled output ansible.builtin.file: - path: "/var/tmp/ansible_run_{{ opid }}" + path: "{{ play_storage_path }}" state: directory mode: "0755" delegate_to: localhost diff --git a/geant/gap_ansible/roles/pim/tasks/compile.yaml b/geant/gap_ansible/roles/pim/tasks/compile.yaml index 8bccce4c06cbaa792e994efb517d473cc5782add..770fd7984e4880d9328dac7b9b13297719de0f42 100644 --- a/geant/gap_ansible/roles/pim/tasks/compile.yaml +++ b/geant/gap_ansible/roles/pim/tasks/compile.yaml @@ -4,11 +4,11 @@ ansible_host: "localhost" ansible_connection: local -- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_pim.conf" +- name: Print the template in "{{ play_storage_path }}/{{ partner_name }}_pim.conf" # when: verb in ["deploy", "update", "terminate"] ansible.builtin.template: src: "pim.j2" - dest: "/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_pim.conf" + dest: "{{ play_storage_path }}/{{ partner_name }}_pim.conf" lstrip_blocks: true trim_blocks: true mode: '0755' diff --git a/geant/gap_ansible/roles/po_prefix_lists/tasks/deploy_prefix_lists.yaml b/geant/gap_ansible/roles/po_prefix_lists/tasks/deploy_prefix_lists.yaml index 0062393ff9a211b22c303fd2af8457b326e8856a..f8d4c231ee506f9b37668ed25a1c4cba3d96719e 100644 --- a/geant/gap_ansible/roles/po_prefix_lists/tasks/deploy_prefix_lists.yaml +++ b/geant/gap_ansible/roles/po_prefix_lists/tasks/deploy_prefix_lists.yaml @@ -19,7 +19,7 @@ geant.gap_ansible.nokia_netconf_config: format: xml default_operation: merge - content: "{{ lookup('ansible.builtin.file', '/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_prefix_lists.conf') }}" + content: "{{ lookup('ansible.builtin.file', '{{ play_storage_path }}/{{ partner_name }}_prefix_lists.conf') }}" commit: true validate: true config_mode: private @@ -32,7 +32,7 @@ geant.gap_ansible.nokia_netconf_config: format: xml default_operation: merge - content: "{{ lookup('ansible.builtin.file', '/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_prefix_lists.conf') }}" + content: "{{ lookup('ansible.builtin.file', '{{ play_storage_path }}/{{ partner_name }}_prefix_lists.conf') }}" commit: true commit_comment: "{{ commit_comment }}" config_mode: private diff --git a/geant/gap_ansible/roles/po_prefix_lists/tasks/main.yml b/geant/gap_ansible/roles/po_prefix_lists/tasks/main.yml index 5b80b08be225ad6c4a7d39683b29e20b01fe1cbb..1b021390f935404ffabc7dd4e5ddad0b77a6d11c 100644 --- a/geant/gap_ansible/roles/po_prefix_lists/tasks/main.yml +++ b/geant/gap_ansible/roles/po_prefix_lists/tasks/main.yml @@ -140,11 +140,11 @@ nren_prefix_lists: "{{ nren_prefix_lists | default([]) + [{'name': ipv4_prefix_list_name, 'prefixes': bgpq_routes_ipv4}, {'name': ipv6_prefix_list_name, 'prefixes': bgpq_routes_ipv6}] }}" -- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_prefix_lists.conf" +- name: Print the template in "{{ play_storage_path }}/{{ partner_name }}_prefix_lists.conf" delegate_to: localhost ansible.builtin.template: src: "nokia/prefix_lists.j2" - dest: "/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_prefix_lists.conf" + dest: "{{ play_storage_path }}/{{ partner_name }}_prefix_lists.conf" lstrip_blocks: true trim_blocks: true mode: '0755' diff --git a/geant/gap_ansible/roles/policy_options/tasks/compile.yaml b/geant/gap_ansible/roles/policy_options/tasks/compile.yaml index 81eeb4058305c9d99cac8bf18f797a1288faa674..c2d08b6c1594869f7f1f39c3941e9f35ffc1fa26 100644 --- a/geant/gap_ansible/roles/policy_options/tasks/compile.yaml +++ b/geant/gap_ansible/roles/policy_options/tasks/compile.yaml @@ -4,11 +4,11 @@ ansible_host: "localhost" ansible_connection: local -- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/PO.conf" +- name: Print the template in "{{ play_storage_path }}/PO.conf" # when: verb in ["deploy", "update", "terminate"] ansible.builtin.template: src: "policy_options.j2" - dest: "/var/tmp/ansible_run_{{ opid }}/PO.conf" + dest: "{{ play_storage_path }}/PO.conf" lstrip_blocks: true trim_blocks: true mode: '0755' diff --git a/geant/gap_ansible/roles/policy_options/tasks/deploy_po.yaml b/geant/gap_ansible/roles/policy_options/tasks/deploy_po.yaml index 70b027dec1eda014c9c26bf09c5914df8c39ee7d..440a98269ec7c1a5e8c088c4937893f78ece9c25 100644 --- a/geant/gap_ansible/roles/policy_options/tasks/deploy_po.yaml +++ b/geant/gap_ansible/roles/policy_options/tasks/deploy_po.yaml @@ -19,7 +19,7 @@ geant.gap_ansible.nokia_netconf_config: format: xml default_operation: merge - content: "{{ lookup('ansible.builtin.file', '/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_po.conf') }}" + content: "{{ lookup('ansible.builtin.file', '{{ play_storage_path }}/{{ partner_name }}_po.conf') }}" commit: true validate: true config_mode: private @@ -32,7 +32,7 @@ geant.gap_ansible.nokia_netconf_config: format: xml default_operation: merge - content: "{{ lookup('ansible.builtin.file', '/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_po.conf') }}" + content: "{{ lookup('ansible.builtin.file', '{{ play_storage_path }}/{{ partner_name }}_po.conf') }}" commit: true commit_comment: "{{ commit_comment }}" config_mode: private diff --git a/geant/gap_ansible/roles/promote_p_to_pe/tasks/compile.yaml b/geant/gap_ansible/roles/promote_p_to_pe/tasks/compile.yaml index 5303efd345a44a711b932bb80c0e919d8e879dce..1ff554555b44b9f06975bcb25dc9eae2c10cde5e 100644 --- a/geant/gap_ansible/roles/promote_p_to_pe/tasks/compile.yaml +++ b/geant/gap_ansible/roles/promote_p_to_pe/tasks/compile.yaml @@ -9,57 +9,50 @@ ansible_host: "localhost" ansible_connection: local -- name: Create a folder for all the things - ansible.builtin.file: - path: "/var/tmp/ansible_run_{{ opid }}" - state: directory - mode: '0755' - delegate_to: localhost - -- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/pe_promotion_base_config.conf" +- name: Print the template in "{{ play_storage_path }}/pe_promotion_base_config.conf" when: verb == "deploy_pe_base_config" ansible.builtin.template: src: "routers/{{ subscription.router.vendor }}/pe_promotion_base_config.j2" - dest: "/var/tmp/ansible_run_{{ opid }}/pe_promotion_base_config.conf" + dest: "{{ play_storage_path }}/pe_promotion_base_config.conf" lstrip_blocks: true trim_blocks: true mode: '0755' delegate_to: localhost -- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/pe_promotion_base_vprn.conf" +- name: Print the template in "{{ play_storage_path }}/pe_promotion_base_vprn.conf" when: verb == "deploy_routing_instances" ansible.builtin.template: src: "routers/{{ subscription.router.vendor }}/pe_promotion_base_vprn.j2" - dest: "/var/tmp/ansible_run_{{ opid }}/pe_promotion_base_vprn.conf" + dest: "{{ play_storage_path }}/pe_promotion_base_vprn.conf" lstrip_blocks: true trim_blocks: true mode: '0755' -- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/pe_update_sdp.conf" +- name: Print the template in "{{ play_storage_path }}/pe_update_sdp.conf" when: verb == "update_sdp_mesh" ansible.builtin.template: src: "routers/{{ subscription.router.vendor }}/pe_update_sdp.j2" - dest: "/var/tmp/ansible_run_{{ opid }}/pe_update_sdp.conf" + dest: "{{ play_storage_path }}/pe_update_sdp.conf" lstrip_blocks: true trim_blocks: true mode: '0755' delegate_to: localhost -- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/delete_default_static_routes.conf" +- name: Print the template in "{{ play_storage_path }}/delete_default_static_routes.conf" when: verb == "delete_default_routes" ansible.builtin.template: src: "routers/{{ subscription.router.vendor }}/router/delete_default_static_routes.j2" - dest: "/var/tmp/ansible_run_{{ opid }}/delete_default_static_routes.conf" + dest: "{{ play_storage_path }}/delete_default_static_routes.conf" lstrip_blocks: true trim_blocks: true mode: '0755' delegate_to: localhost -- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/pe_promotion_static_routes.conf" +- name: Print the template in "{{ play_storage_path }}/pe_promotion_static_routes.conf" when: verb == "add_pe_static_routes" ansible.builtin.template: src: "routers/{{ subscription.router.vendor }}/router/pe_promotion_static_routes.j2" - dest: "/var/tmp/ansible_run_{{ opid }}/pe_promotion_static_routes.conf" + dest: "{{ play_storage_path }}/pe_promotion_static_routes.conf" lstrip_blocks: true trim_blocks: true mode: '0755' diff --git a/geant/gap_ansible/roles/promote_p_to_pe/tasks/configure_storage.yaml b/geant/gap_ansible/roles/promote_p_to_pe/tasks/configure_storage.yaml new file mode 120000 index 0000000000000000000000000000000000000000..0998fc94da841acab1668c1a80098f9f4e47bbb0 --- /dev/null +++ b/geant/gap_ansible/roles/promote_p_to_pe/tasks/configure_storage.yaml @@ -0,0 +1 @@ +../../../tasks/configure_storage.yaml \ No newline at end of file diff --git a/geant/gap_ansible/roles/promote_p_to_pe/tasks/main.yml b/geant/gap_ansible/roles/promote_p_to_pe/tasks/main.yml index c31c8db5370dc25ccb42f15d01c06c7a0dab4cfd..08e188e5e28ba3e661864948b9019076a10a3192 100644 --- a/geant/gap_ansible/roles/promote_p_to_pe/tasks/main.yml +++ b/geant/gap_ansible/roles/promote_p_to_pe/tasks/main.yml @@ -37,18 +37,13 @@ ansible_connection: "{{ netconf_access[subscription.router.vendor].ansible_connection }}" ansible_network_os: "{{ netconf_access[subscription.router.vendor].ansible_network_os }}" -- name: Generate an ID for this run - ansible.builtin.set_fact: - opid: "{{ lookup('community.general.random_string', length=18, special=false) }}" - -- name: Print the ID - ansible.builtin.debug: - msg: "{{ opid }}" -# # - name: Include ISIS overload tasks # when: verb in ['set_isis_overload', 'remove_isis_overload'] # ansible.builtin.include_tasks: configure_isis_overload.yaml +- name: Include configure storage tasks + ansible.builtin.include_tasks: configure_storage.yaml + - name: Include templates compilation when: verb in [ 'deploy_pe_base_config', 'update_sdp_mesh', 'deploy_routing_instances', 'delete_default_routes', 'add_pe_static_routes' ] ansible.builtin.include_tasks: compile.yaml diff --git a/geant/gap_ansible/roles/sbp/tasks/compile.yaml b/geant/gap_ansible/roles/sbp/tasks/compile.yaml index 839952fee0b66e282d7afd97e8f75ca70aeb4f14..9608d66d2d5c203f47dfb323dad973c6710f8be0 100644 --- a/geant/gap_ansible/roles/sbp/tasks/compile.yaml +++ b/geant/gap_ansible/roles/sbp/tasks/compile.yaml @@ -4,11 +4,11 @@ ansible_host: "localhost" ansible_connection: local -- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_sbp.conf" +- name: Print the template in "{{ play_storage_path }}/{{ partner_name }}_sbp.conf" # when: verb in ["deploy", "update", "terminate"] ansible.builtin.template: src: "{{ vendor }}/{{ verb }}/sbp.j2" - dest: "/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_sbp.conf" + dest: "{{ play_storage_path }}/{{ partner_name }}_sbp.conf" lstrip_blocks: true trim_blocks: true mode: '0755' diff --git a/geant/gap_ansible/roles/sbp/tasks/deploy_sbp.yaml b/geant/gap_ansible/roles/sbp/tasks/deploy_sbp.yaml index 89bdd754d41c1a836a7a4d220367cb7b0c8dea04..fa45477bdb5b5650933735b79d30c62d7eb97de7 100644 --- a/geant/gap_ansible/roles/sbp/tasks/deploy_sbp.yaml +++ b/geant/gap_ansible/roles/sbp/tasks/deploy_sbp.yaml @@ -19,7 +19,7 @@ geant.gap_ansible.nokia_netconf_config: format: xml default_operation: merge - content: "{{ lookup('ansible.builtin.file', '/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_sbp.conf') }}" + content: "{{ lookup('ansible.builtin.file', '{{ play_storage_path }}/{{ partner_name }}_sbp.conf') }}" commit: true validate: true config_mode: private @@ -32,7 +32,7 @@ geant.gap_ansible.nokia_netconf_config: format: xml default_operation: merge - content: "{{ lookup('ansible.builtin.file', '/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_sbp.conf') }}" + content: "{{ lookup('ansible.builtin.file', '{{ play_storage_path }}/{{ partner_name }}_sbp.conf') }}" commit: true commit_comment: "{{ commit_comment }}" config_mode: private diff --git a/geant/gap_ansible/roles/sdp/tasks/compile.yaml b/geant/gap_ansible/roles/sdp/tasks/compile.yaml index 8e1281163e67790903a49fc69a537e0810a14cb4..665ac32ce76272898383a278dcde55223da318ce 100644 --- a/geant/gap_ansible/roles/sdp/tasks/compile.yaml +++ b/geant/gap_ansible/roles/sdp/tasks/compile.yaml @@ -4,10 +4,10 @@ ansible_host: "localhost" ansible_connection: local -- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/SDP.conf" +- name: Print the template in "{{ play_storage_path }}/SDP.conf" ansible.builtin.template: src: "routers/nokia/{{ verb }}/sdp.j2" - dest: "/var/tmp/ansible_run_{{ opid }}/SDP.conf" + dest: "{{ play_storage_path }}/SDP.conf" lstrip_blocks: true trim_blocks: true mode: "0755" diff --git a/geant/gap_ansible/roles/sdp/tasks/configure_storage.yaml b/geant/gap_ansible/roles/sdp/tasks/configure_storage.yaml new file mode 120000 index 0000000000000000000000000000000000000000..0998fc94da841acab1668c1a80098f9f4e47bbb0 --- /dev/null +++ b/geant/gap_ansible/roles/sdp/tasks/configure_storage.yaml @@ -0,0 +1 @@ +../../../tasks/configure_storage.yaml \ No newline at end of file diff --git a/geant/gap_ansible/roles/sdp/tasks/main.yml b/geant/gap_ansible/roles/sdp/tasks/main.yml index 356a4abd942d0e77e8a9daae199953741ab35a35..874d3e68cfe6b8585b22e3e55f7cf7573e5ee883 100644 --- a/geant/gap_ansible/roles/sdp/tasks/main.yml +++ b/geant/gap_ansible/roles/sdp/tasks/main.yml @@ -18,8 +18,11 @@ when: (verb is not defined) or (verb not in verbs) ansible.builtin.meta: end_play -- name: Include standard tasks - ansible.builtin.include_tasks: standard_tasks.yaml +# - name: Include standard tasks +# ansible.builtin.include_tasks: standard_tasks.yaml + +- name: Include configure storage tasks + ansible.builtin.include_tasks: configure_storage.yaml - name: Include merge vars tasks ansible.builtin.include_tasks: merge_vars.yaml diff --git a/geant/gap_ansible/roles/sdp/tasks/push_config.yaml b/geant/gap_ansible/roles/sdp/tasks/push_config.yaml index 8ac1c0e9a8037fc185bd0ef1d5934e40dd5df92c..314cd995c5d8d453d5654bb0a6d7036034a3e0ff 100644 --- a/geant/gap_ansible/roles/sdp/tasks/push_config.yaml +++ b/geant/gap_ansible/roles/sdp/tasks/push_config.yaml @@ -5,7 +5,7 @@ geant.gap_ansible.nokia_netconf_config: format: xml default_operation: merge - content: "{{ lookup('ansible.builtin.file', '/var/tmp/ansible_run_{{ opid }}/SDP.conf') }}" + content: "{{ lookup('ansible.builtin.file', '{{ play_storage_path }}/SDP.conf') }}" commit: true validate: true config_mode: private @@ -28,7 +28,7 @@ geant.gap_ansible.nokia_netconf_config: format: xml default_operation: merge - content: "{{ lookup('ansible.builtin.file', '/var/tmp/ansible_run_{{ opid }}/SDP.conf') }}" + content: "{{ lookup('ansible.builtin.file', '{{ play_storage_path }}/SDP.conf') }}" commit: true commit_comment: "{{ commit_comment }}" config_mode: private diff --git a/geant/gap_ansible/roles/sdp/tasks/standard_tasks.yaml b/geant/gap_ansible/roles/sdp/tasks/standard_tasks.yaml index 4772e5bba9ad6a0f39f7a8cc6bd4b019e4cf568d..a575a9ca8d05d55d4d7c5b37b7b5b427d71bd02a 100644 --- a/geant/gap_ansible/roles/sdp/tasks/standard_tasks.yaml +++ b/geant/gap_ansible/roles/sdp/tasks/standard_tasks.yaml @@ -7,9 +7,17 @@ ansible.builtin.debug: msg: "{{ opid }}" +- name: Import group_vars/all + ansible.builtin.include_vars: + dir: /opt/ansible_inventory/group_vars/all + +- name: Generate FS path for artifacts storage + ansible.builtin.set_fact: + play_storage_path: "{{ storage_mount_prefix | default('/var/tmp') }}/{{ gso_process_id | default('gso_pid_undefined') }}/ansible_run_{{ opid }}" + - name: Create a folder for all compiled output ansible.builtin.file: - path: "/var/tmp/ansible_run_{{ opid }}" + path: "{{ play_storage_path }}" state: directory - mode: "0755" + mode: '0755' delegate_to: localhost diff --git a/geant/gap_ansible/roles/vrf/tasks/compile.yaml b/geant/gap_ansible/roles/vrf/tasks/compile.yaml index 528322063f97bf1bde4e63b087664ffac4ad2734..2458cc3c08dbafb0c55e8deb3cb6f1f9115bc338 100644 --- a/geant/gap_ansible/roles/vrf/tasks/compile.yaml +++ b/geant/gap_ansible/roles/vrf/tasks/compile.yaml @@ -4,11 +4,11 @@ ansible_host: "localhost" ansible_connection: local -- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/VRF.conf" +- name: Print the template in "{{ play_storage_path }}/VRF.conf" # when: verb in ["deploy", "update", "terminate"] ansible.builtin.template: src: "service.j2" - dest: "/var/tmp/ansible_run_{{ opid }}/VRF.conf" + dest: "{{ play_storage_path }}/VRF.conf" lstrip_blocks: true trim_blocks: true mode: '0755' diff --git a/geant/gap_ansible/tasks/configure_storage.yaml b/geant/gap_ansible/tasks/configure_storage.yaml new file mode 100644 index 0000000000000000000000000000000000000000..fe07aa325b0c46a494a655ffc3e70f5bb9bf4970 --- /dev/null +++ b/geant/gap_ansible/tasks/configure_storage.yaml @@ -0,0 +1,22 @@ +- name: Generate an ID for this run + ansible.builtin.set_fact: + opid: "{{ lookup('community.general.random_string', length=18, special=false) }}" + +- name: Import group_vars/all + ansible.builtin.include_vars: + dir: /opt/ansible_inventory/group_vars/all + +- name: Generate FS path for artifacts storage + ansible.builtin.set_fact: + play_storage_path: "{{ storage_mount_prefix | default('/var/tmp') }}/{{ gso_process_id | default('gso_pid_undefined') }}/ansible_run_{{ opid }}" + +- name: Create a folder for all compiled output + ansible.builtin.file: + path: "{{ play_storage_path }}" + state: directory + mode: '0755' + delegate_to: localhost + +- name: Print storage path for the play + ansible.builtin.debug: + msg: "{{ play_storage_path }}"