Commit d1e5311d authored by Joanne Hugé's avatar Joanne Hugé

playbook/ors: adapt playbook to new amarisoft version format

parent b47c4bbf
Pipeline #36744 failed with stage
in 0 seconds
...@@ -21,26 +21,36 @@ ...@@ -21,26 +21,36 @@
register: license_expiration register: license_expiration
when: certificate.stat.exists == True when: certificate.stat.exists == True
- name: Get license version - name: Get current version
shell: '/opt/amarisoft/get-license-info -v || echo 0000-00-00' shell: '/opt/amarisoft/get-license-info -v || echo 0000-00-00.0 | cut -d. -f1'
register: license_version register: current_version
when: certificate.stat.exists == True
- name: Get current version timestamp
shell: '/opt/amarisoft/get-license-info -v | grep "\." || echo 0000-00-00.0 | cut -d. -f2'
register: current_timestamp
when: certificate.stat.exists == True when: certificate.stat.exists == True
- debug: - debug:
msg: "[{{ ansible_date_time.date }} {{ ansible_date_time.time }}] License will expire on {{ license_expiration.stdout }}, current version is {{ license_version.stdout }}" msg: "[{{ ansible_date_time.date }} {{ ansible_date_time.time }}] License will expire on {{ license_expiration.stdout }}, current version is {{ current_version.stdout }}-{{ current_timestamp.stdout }}"
when: certificate.stat.exists == True when: certificate.stat.exists == True
- name: Get new amarisoft version if available - name: Get new amarisoft version if available
shell: "networkcache-download -c /opt/amarisoft/shacache.cfg -k key-private:amarisoft 'version<=\"{{ license_expiration.stdout }}\"' 'version>>\"{{ license_version.stdout }}\"' 'cn==\"{{ cn }}\"' --list | grep version | cut -d\\\" -f4" shell: "networkcache-download -c /opt/amarisoft/shacache.cfg -k key-private:amarisoft 'cn==\"{{ cn }}\"' 'version<=\"{{ license_expiration.stdout }}\"' 'version>>\"{{ current_version.stdout }}\"' 'timestamp>>\"{{ current_timestamp.stdout }}\"' --list | grep version | cut -d\\\" -f4"
register: new_version register: new_version
when: certificate.stat.exists == True when: certificate.stat.exists == True
- name: Get new amarisoft timestamp
shell: "networkcache-download -c /opt/amarisoft/shacache.cfg -k key-private:amarisoft 'cn==\"{{ cn }}\"' 'version<=\"{{ license_expiration.stdout }}\"' 'version>>\"{{ current_version.stdout }}\"' 'timestamp>>\"{{ current_timestamp.stdout }}\"' --list | grep timestamp | cut -d\\\" -f4"
register: new_timestamp
when: (certificate.stat.exists == True) and (new_version.stdout != "")
- debug: - debug:
msg: "[{{ ansible_date_time.date }} {{ ansible_date_time.time }}] Found new version: {{ new_version.stdout }}" msg: "[{{ ansible_date_time.date }} {{ ansible_date_time.time }}] Found new version: {{ new_version.stdout }}"
when: (certificate.stat.exists == True) and (new_version.stdout != "") when: (certificate.stat.exists == True) and (new_version.stdout != "")
- name: Download nonce to decrypt new amarisoft version - name: Download nonce to decrypt new amarisoft version
shell: "networkcache-download -c /opt/amarisoft/shacache.cfg -k file-private:amarisoft 'version<=\"{{ license_expiration.stdout }}\"' 'version>>\"{{ license_version.stdout }}\"' --list | grep nonce | cut -d\\\" -f4 > {{ install_folder }}/download/nonce" shell: "networkcache-download -c /opt/amarisoft/shacache.cfg -k file-private:amarisoft 'version<=\"{{ license_expiration.stdout }}\"' 'version>>\"{{ current_version.stdout }}\"' 'timestamp>>\"{{ current_timestamp.stdout }}\"' --list | grep nonce | cut -d\\\" -f4 > {{ install_folder }}/download/nonce"
register: nonce register: nonce
when: (certificate.stat.exists == True) and (new_version.stdout != "") when: (certificate.stat.exists == True) and (new_version.stdout != "")
...@@ -48,11 +58,11 @@ ...@@ -48,11 +58,11 @@
when: (certificate.stat.exists == True) and (new_version.stdout != "") when: (certificate.stat.exists == True) and (new_version.stdout != "")
- name: Download new amarisoft version - name: Download new amarisoft version
shell: "networkcache-download -c /opt/amarisoft/shacache.cfg -k file-private:amarisoft 'version<=\"{{ license_expiration.stdout }}\"' 'version>>\"{{ license_version.stdout }}\"' > {{ install_folder }}/download/amarisoft.tar.gz.enc" shell: "networkcache-download -c /opt/amarisoft/shacache.cfg -k file-private:amarisoft 'version<=\"{{ license_expiration.stdout }}\"' 'version>>\"{{ current_version.stdout }}\"' 'timestamp>>\"{{ current_timestamp.stdout }}\"' > {{ install_folder }}/download/amarisoft.tar.gz.enc"
when: (certificate.stat.exists == True) and (new_version.stdout != "") when: (certificate.stat.exists == True) and (new_version.stdout != "")
- name: Download encrypted symmetric key for new amarisoft version - name: Download encrypted symmetric key for new amarisoft version
shell: "networkcache-download -c /opt/amarisoft/shacache.cfg -k key-private:amarisoft 'version<=\"{{ license_expiration.stdout }}\"' 'version>>\"{{ license_version.stdout }}\"' 'cn==\"{{ cn }}\"' > {{ install_folder }}/download/symmetric_key.bin.enc" shell: "networkcache-download -c /opt/amarisoft/shacache.cfg -k key-private:amarisoft 'cn==\"{{ cn }}\"' 'version<=\"{{ license_expiration.stdout }}\"' 'version>>\"{{ current_version.stdout }}\"' 'timestamp>>\"{{ current_timestamp.stdout }}\"' > {{ install_folder }}/download/symmetric_key.bin.enc"
when: (certificate.stat.exists == True) and (new_version.stdout != "") when: (certificate.stat.exists == True) and (new_version.stdout != "")
- name: Create directory if it does not exist - name: Create directory if it does not exist
...@@ -131,7 +141,7 @@ ...@@ -131,7 +141,7 @@
ignore_errors: True ignore_errors: True
- name: Move amarisoft folder - name: Move amarisoft folder
shell: 'mv {{ install_folder }}/_{{ version }} {{ install_folder }}/v{{ version }}' shell: 'mv {{ install_folder }}/_{{ version }} {{ install_folder }}/v{{ version }}.{{ new_timestamp.stdout }}'
when: (certificate.stat.exists == True) and (new_version.stdout != "") when: (certificate.stat.exists == True) and (new_version.stdout != "")
- name: Remove extraction folder - name: Remove extraction folder
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
when: (monitor_path is succeeded) and (playbook_report | bool) when: (monitor_path is succeeded) and (playbook_report | bool)
- name: Check Amarisoft version - name: Check Amarisoft version
shell: 'find /opt/amarisoft -maxdepth 1 | grep "^/opt/amarisoft/v[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}$" | cut -d/ -f4 | sort | tail -n1' shell: 'find /opt/amarisoft -maxdepth 1 | grep "^/opt/amarisoft/v[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}.[0-9]*$" | cut -d/ -f4 | sort | tail -n1'
register: amarisoft_version register: amarisoft_version
ignore_errors: yes ignore_errors: yes
...@@ -101,7 +101,7 @@ ...@@ -101,7 +101,7 @@
copy: src=rm-tmp-lte dest=/opt/amarisoft owner=root mode=770 copy: src=rm-tmp-lte dest=/opt/amarisoft owner=root mode=770
- name: Get Amarisoft path - name: Get Amarisoft path
shell: 'find /opt/amarisoft -maxdepth 1 | grep "^/opt/amarisoft/v[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}$" | sort | tail -n1' shell: 'find /opt/amarisoft -maxdepth 1 | grep "^/opt/amarisoft/v[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}.[0-9]*$" | sort | tail -n1'
register: amarisoft_path register: amarisoft_path
- name: Check if lteenb has capabilities - name: Check if lteenb has capabilities
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment