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

Merge branch 'feature/nat-1090-common-storage' into 'develop'

Feature/nat 1090 common storage

See merge request !260
parents be68df6b 830536bf
No related branches found
No related tags found
1 merge request!260Feature/nat 1090 common storage
Pipeline #93687 passed
Showing
with 46 additions and 152 deletions
......@@ -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:
......
......@@ -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:
......
......@@ -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:
......
......@@ -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:
......
......@@ -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:
......
......@@ -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'
......
../../../tasks/configure_storage.yaml
\ No newline at end of file
- 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
......
......@@ -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
......
......@@ -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'
......
......@@ -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
......
......@@ -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*"
......@@ -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
......@@ -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'
......
../../../tasks/configure_storage.yaml
\ No newline at end of file
......@@ -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
......
......@@ -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 }}"
......@@ -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'
......
......@@ -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
......
......@@ -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'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment