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..67d67dcb2717062e2e9158d3ed1da000bb66e932 --- /dev/null +++ b/geant/gap_ansible/roles/iptrunk_migration/tasks/configure_storage.yaml @@ -0,0 +1 @@ +../../../playbooks/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")