Skip to content
Snippets Groups Projects
Commit ac2f824f authored by Aleksandr Kurbatov's avatar Aleksandr Kurbatov
Browse files

`iptrunk_migration` - update to use the new storage path

parent 8e29c450
No related branches found
No related tags found
1 merge request!260Feature/nat 1090 common storage
Pipeline #93684 failed
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
dry_run | ansible.builtin.bool dry_run | ansible.builtin.bool
junipernetworks.junos.junos_config: junipernetworks.junos.junos_config:
update: 'replace' update: 'replace'
src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" src: "{{ play_storage_path }}/{{ config_object }}.conf"
src_format: set src_format: set
check_commit: true check_commit: true
diff: true diff: true
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
not (dry_run | ansible.builtin.bool) not (dry_run | ansible.builtin.bool)
junipernetworks.junos.junos_config: junipernetworks.junos.junos_config:
update: 'replace' update: 'replace'
src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" src: "{{ play_storage_path }}/{{ config_object }}.conf"
src_format: set src_format: set
comment: "{{ commit_comment }}" comment: "{{ commit_comment }}"
diff: true diff: true
......
...@@ -13,37 +13,30 @@ ...@@ -13,37 +13,30 @@
( new_node.router.router_access_via_ts | ansible.builtin.bool ) is true and ( new_node.router.router_access_via_ts | ansible.builtin.bool ) is true and
(verb == "deploy") (verb == "deploy")
- name: Create a folder for all the templates - name: Print template for the old node "{{ old_node.fqdn }}" in "{{ play_storage_path }}/{{ config_object }}.conf"
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"
ansible.builtin.template: ansible.builtin.template:
src: "{{ old_node.vendor }}/{{ config_object }}.j2" 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 lstrip_blocks: true
trim_blocks: true trim_blocks: true
mode: '0755' mode: '0755'
delegate_to: localhost delegate_to: localhost
when: (verb == "delete" or verb == "deactivate") and inventory_hostname != new_node.router.router_fqdn 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: ansible.builtin.template:
src: "{{ new_node.router.vendor }}/{{ config_object }}.j2" 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 lstrip_blocks: true
trim_blocks: true trim_blocks: true
mode: '0755' mode: '0755'
delegate_to: localhost delegate_to: localhost
when: (verb == "deploy") and inventory_hostname == new_node.router.router_fqdn 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: ansible.builtin.template:
src: "{{ remaining_side.vendor }}/{{ config_object }}.j2" 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 lstrip_blocks: true
trim_blocks: true trim_blocks: true
mode: '0755' mode: '0755'
......
../../../playbooks/configure_storage.yaml
\ No newline at end of file
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
dry_run | ansible.builtin.bool dry_run | ansible.builtin.bool
junipernetworks.junos.junos_config: junipernetworks.junos.junos_config:
update: 'replace' update: 'replace'
src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" src: "{{ play_storage_path }}/{{ config_object }}.conf"
src_format: set src_format: set
check_commit: true check_commit: true
diff: true diff: true
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
not (dry_run | ansible.builtin.bool) not (dry_run | ansible.builtin.bool)
junipernetworks.junos.junos_config: junipernetworks.junos.junos_config:
update: 'replace' update: 'replace'
src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" src: "{{ play_storage_path }}/{{ config_object }}.conf"
src_format: set src_format: set
comment: "{{ commit_comment }}" comment: "{{ commit_comment }}"
diff: true diff: true
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
- name: Delete Trunk interface on "{{ inventory_hostname }}" [CHECK ONLY][JUNIPER] - name: Delete Trunk interface on "{{ inventory_hostname }}" [CHECK ONLY][JUNIPER]
junipernetworks.junos.junos_config: junipernetworks.junos.junos_config:
update: 'replace' update: 'replace'
src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" src: "{{ play_storage_path }}/{{ config_object }}.conf"
src_format: set src_format: set
check_commit: true check_commit: true
diff: true diff: true
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
- name: Delete Trunk interface on "{{ inventory_hostname }}" [AND COMMIT][JUNIPER] - name: Delete Trunk interface on "{{ inventory_hostname }}" [AND COMMIT][JUNIPER]
junipernetworks.junos.junos_config: junipernetworks.junos.junos_config:
update: 'replace' update: 'replace'
src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" src: "{{ play_storage_path }}/{{ config_object }}.conf"
src_format: set src_format: set
comment: "{{ commit_comment }}" comment: "{{ commit_comment }}"
diff: true diff: true
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
- name: Deploy "{{ config_object }}" on "{{ inventory_hostname }}" [CHECK ONLY][JUNIPER] - name: Deploy "{{ config_object }}" on "{{ inventory_hostname }}" [CHECK ONLY][JUNIPER]
junipernetworks.junos.junos_config: junipernetworks.junos.junos_config:
update: 'replace' update: 'replace'
src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" src: "{{ play_storage_path }}/{{ config_object }}.conf"
src_format: set src_format: set
check_commit: true check_commit: true
diff: true diff: true
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
- name: Deploy "{{ config_object }}" on "{{ inventory_hostname }}" [AND COMMIT][JUNIPER] - name: Deploy "{{ config_object }}" on "{{ inventory_hostname }}" [AND COMMIT][JUNIPER]
junipernetworks.junos.junos_config: junipernetworks.junos.junos_config:
update: 'replace' update: 'replace'
src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" src: "{{ play_storage_path }}/{{ config_object }}.conf"
src_format: set src_format: set
comment: "{{ commit_comment }}" comment: "{{ commit_comment }}"
diff: true diff: true
......
...@@ -20,11 +20,6 @@ ...@@ -20,11 +20,6 @@
ansible.builtin.include_vars: ansible.builtin.include_vars:
dir: /opt/ansible_inventory/group_vars/routers 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 - name: The old node is
ansible.builtin.debug: ansible.builtin.debug:
msg: "{{ old_node.fqdn }}" msg: "{{ old_node.fqdn }}"
...@@ -33,6 +28,9 @@ ...@@ -33,6 +28,9 @@
ansible.builtin.debug: ansible.builtin.debug:
msg: "{{ new_node.router.router_fqdn }}" msg: "{{ new_node.router.router_fqdn }}"
- name: Include configure storage tasks
ansible.builtin.include_tasks: configure_storage.yaml
- name: Select the correct IPaddresses - name: Select the correct IPaddresses
ansible.builtin.include_tasks: calculate_ips.yaml ansible.builtin.include_tasks: calculate_ips.yaml
when: verb == "deploy" when: verb == "deploy"
...@@ -60,10 +58,6 @@ ...@@ -60,10 +58,6 @@
when: when:
verb == "deploy" verb == "deploy"
- name: Print the ID
ansible.builtin.debug:
msg: "{{ opid }}"
- name: Include compiling the template for the old node - name: Include compiling the template for the old node
ansible.builtin.include_tasks: compile_template.yaml ansible.builtin.include_tasks: compile_template.yaml
when: (verb == "deactivate" or verb == "delete") when: (verb == "deactivate" or verb == "delete")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment