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

ors-amarisoft: fixup for d1e5311d

parent d1e5311d
......@@ -32,120 +32,125 @@
when: certificate.stat.exists == True
- debug:
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 }}"
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
- name: Get new amarisoft version if available
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"
shell: "networkcache-download -c /opt/amarisoft/shacache.cfg -k key-private:amarisoft 'cn==\"{{ cn }}\"' 'version<=\"{{ license_expiration.stdout }}\"' 'timestamp>=\"0\"' 'version>>\"0\"' 'timestamp>>\"0\"' --list | grep version | cut -d\\\" -f4"
register: new_version
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"
- name: Get new amarisoft timestamp if available
shell: "networkcache-download -c /opt/amarisoft/shacache.cfg -k key-private:amarisoft 'cn==\"{{ cn }}\"' 'version<=\"{{ license_expiration.stdout }}\"' 'timestamp>=\"0\"' 'version>>\"0\"' 'timestamp>>\"0\"' --list | grep timestamp | cut -d\\\" -f4"
register: new_timestamp
when: (certificate.stat.exists == True) and (new_version.stdout != "")
when: certificate.stat.exists == True
- set_fact: new_version_found=False
- set_fact: new_version_found=True
when: new_version.stdout > current_version.stdout or (new_version.stdout == current_version.stdout and new_timestamp.stdout > current_timestamp.stdout)
- debug:
msg: "[{{ ansible_date_time.date }} {{ ansible_date_time.time }}] Found new version: {{ new_version.stdout }}"
when: (certificate.stat.exists == True) and (new_version.stdout != "")
msg: "[{{ ansible_date_time.date }} {{ ansible_date_time.time }}] Found version {{ new_version.stdout }}.{{ new_timestamp.stdout }}"
when: certificate.stat.exists == True
- 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>>\"{{ current_version.stdout }}\"' 'timestamp>>\"{{ current_timestamp.stdout }}\"' --list | grep nonce | cut -d\\\" -f4 > {{ install_folder }}/download/nonce"
shell: "networkcache-download -c /opt/amarisoft/shacache.cfg -k file-private:amarisoft 'version==\"{{ new_version.stdout }}\"' 'timestamp==\"{{ new_timestamp.stdout }}\"' --list | grep nonce | cut -d\\\" -f4 > {{ install_folder }}/download/nonce"
register: nonce
when: (certificate.stat.exists == True) and (new_version.stdout != "")
when: (certificate.stat.exists == True) and (new_version_found == True)
- set_fact: version="{{ new_version.stdout }}"
when: (certificate.stat.exists == True) and (new_version.stdout != "")
when: (certificate.stat.exists == True) and (new_version_found == True)
- name: Download new amarisoft version
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 != "")
shell: "networkcache-download -c /opt/amarisoft/shacache.cfg -k file-private:amarisoft 'version==\"{{ new_version.stdout }}\"' 'timestamp==\"{{ new_timestamp.stdout }}\"' > {{ install_folder }}/download/amarisoft.tar.gz.enc"
when: (certificate.stat.exists == True) and (new_version_found == True)
- name: Download encrypted symmetric key for new amarisoft version
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 != "")
shell: "networkcache-download -c /opt/amarisoft/shacache.cfg -k key-private:amarisoft 'cn==\"{{ cn }}\"' 'version==\"{{ new_version.stdout }}\"' 'timestamp==\"{{ new_timestamp.stdout }}\"' > {{ install_folder }}/download/symmetric_key.bin.enc"
when: (certificate.stat.exists == True) and (new_version_found == True)
- name: Create directory if it does not exist
file: path={{ install_folder }}/{{ version }} state=directory mode=0755
when: (certificate.stat.exists == True) and (new_version.stdout != "")
when: (certificate.stat.exists == True) and (new_version_found == True)
- name: Create directory if it does not exist
file: path={{ install_folder }}/_{{ version }} state=directory mode=0755
when: (certificate.stat.exists == True) and (new_version.stdout != "")
when: (certificate.stat.exists == True) and (new_version_found == True)
- name: Decrypt key
shell: 'openssl pkeyutl -decrypt -in {{ install_folder }}/download/symmetric_key.bin.enc -inkey /opt/private-key/{{ cn }}.key -out /opt/private-key/symmetric_key-{{ version }}.key'
when: (certificate.stat.exists == True) and (new_version.stdout != "")
when: (certificate.stat.exists == True) and (new_version_found == True)
- name: Decrypt archive
script: encrypt-data.sh /opt/private-key/symmetric_key-{{ version }}.key {{ install_folder }}/download/nonce decrypt {{ install_folder }}/download/amarisoft.tar.gz.enc {{ install_folder }}/amarisoft.tar.gz
when: (certificate.stat.exists == True) and (new_version.stdout != "")
when: (certificate.stat.exists == True) and (new_version_found == True)
- name: Extract archive
unarchive:
src: "{{ install_folder }}/amarisoft.tar.gz"
dest: "{{ install_folder }}"
when: (certificate.stat.exists == True) and (new_version.stdout != "")
when: (certificate.stat.exists == True) and (new_version_found == True)
- name: Extract lteenb archive
unarchive:
src: "{{ install_folder }}/{{ version }}/lteenb-linux-{{ version }}.tar.gz"
dest: "{{ install_folder }}/_{{ version }}"
when: (certificate.stat.exists == True) and (new_version.stdout != "")
when: (certificate.stat.exists == True) and (new_version_found == True)
- name: Extract ltemme archive
unarchive:
src: "{{ install_folder }}/{{ version }}/ltemme-linux-{{ version }}.tar.gz"
dest: "{{ install_folder }}/_{{ version }}"
when: (certificate.stat.exists == True) and (new_version.stdout != "")
when: (certificate.stat.exists == True) and (new_version_found == True)
- name: Extract trx_sdr archive
unarchive:
src: "{{ install_folder }}/{{ version }}/trx_sdr-linux-{{ version }}.tar.gz"
dest: "{{ install_folder }}/_{{ version }}"
when: (certificate.stat.exists == True) and (new_version.stdout != "")
when: (certificate.stat.exists == True) and (new_version_found == True)
- name: Create a symbolic link for lteenb
file:
src: "lteenb-linux-{{ version }}"
dest: "{{ install_folder }}/_{{ version }}/enb"
state: link
when: (certificate.stat.exists == True) and (new_version.stdout != "")
when: (certificate.stat.exists == True) and (new_version_found == True)
- name: Create a symbolic link for ltemme
file:
src: "ltemme-linux-{{ version }}"
dest: "{{ install_folder }}/_{{ version }}/mme"
state: link
when: (certificate.stat.exists == True) and (new_version.stdout != "")
when: (certificate.stat.exists == True) and (new_version_found == True)
- name: Create a symbolic link for trx_sdr
file:
src: "trx_sdr-linux-{{ version }}"
dest: "{{ install_folder }}/_{{ version }}/trx_sdr"
state: link
when: (certificate.stat.exists == True) and (new_version.stdout != "")
when: (certificate.stat.exists == True) and (new_version_found == True)
- name: Copy trx_sdr libraries
shell: 'cp {{ install_folder }}/_{{ version }}/trx_sdr/*.so* {{ install_folder }}/_{{ version }}/enb/'
when: (certificate.stat.exists == True) and (new_version.stdout != "")
when: (certificate.stat.exists == True) and (new_version_found == True)
- name: Copy libraries to mme
shell: 'cp {{ install_folder }}/{{ version }}/libs/*.so* {{ install_folder }}/_{{ version }}/mme/'
when: (certificate.stat.exists == True) and (new_version.stdout != "")
when: (certificate.stat.exists == True) and (new_version_found == True)
ignore_errors: True
- name: Copy libraries to mme
shell: 'cp {{ install_folder }}/{{ version }}/libs/linux/*.so* {{ install_folder }}/_{{ version }}/mme/'
when: (certificate.stat.exists == True) and (new_version.stdout != "")
when: (certificate.stat.exists == True) and (new_version_found == True)
ignore_errors: True
- name: Move amarisoft folder
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_found == True)
- name: Remove extraction folder
file:
path: "{{ install_folder }}/{{ version }}"
state: absent
when: (certificate.stat.exists == True) and (new_version.stdout != "")
when: (certificate.stat.exists == True) and (new_version_found == True)
#!/bin/bash
OLD_AMARISOFT_PATH="/opt/amarisoft/$(ls -1 /opt/amarisoft | grep "^v2021-[0-9]\{2\}-[0-9]\{2\}$" | sort | tail -n1)"
AMARISOFT_PATH="/opt/amarisoft/$(ls -1 /opt/amarisoft | grep "^v[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}$" | sort | tail -n1)"
OLD_AMARISOFT_PATH="/opt/amarisoft/$(ls -1 /opt/amarisoft | grep "^v2021-[0-9]\{2\}-[0-9]\{2\}.[0-9]*$" | sort | tail -n1)"
AMARISOFT_PATH="/opt/amarisoft/$(ls -1 /opt/amarisoft | grep "^v[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}.[0-9]*$" | sort | tail -n1)"
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH"
$AMARISOFT_PATH/trx_sdr/sdr_util version && exit;
......
923f60fc3e28c6ac4828dbbf9ac09e5e255d46f9c63619e060bf4cced6cdd45f -
a3959abc72e7e6f50a709b7f5af6adc7a18c45dadb5fa9bab09b435689248856 -
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