Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Nurmukhamed/3c58c10ad69d7277e4169954b484d9ff to your computer and use it in GitHub Desktop.
Save Nurmukhamed/3c58c10ad69d7277e4169954b484d9ff to your computer and use it in GitHub Desktop.
Use Ansible to install NCALayer bundles
---
- hosts: localhost
connection: local
name: "Download all ncalayers bundles and install them"
vars:
install_bundles:
- symname: kz.gov.pki.kalkan.knca_provider_jce_kalkan
install: true
- symname: kz.gov.pki.kalkan.xmldsig
install: true
- symname: kz.gov.pki.provider.knca_provider_util
install: true
- symname: kz.gov.pki.api.layer.NCALayerServices
install: true
- symname: kz.gov.pki.knca.applet.knca_applet
install: true
- symname: kz.gov.pki.osgi.layer.websocket
install: true
- symname: kz.gov.pki.osgi.layer.common
install: true
- symname: kz.gov.pki.cms.NLDocSignerModule
install: true
- symname: org.skf.osgi.SKFModule
install: true
- symname: kz.ecc.NurSignBundle
install: true
- symname: kz.inessoft.kgd.knp.sono_knp_ncalayer_module
install: true
- symname: ru.letograf.crypto.KadagalauBundle
install: true
- symname: kz.ecc.consSignBundle
install: true
- symname: kz.ecc.K2SignBundle
install: true
- symname: kz.qiwi.osgi.SecurityUtils
install: true
- symname: kz.sapa.eproc.osgi.EprocModule
install: true
- symname: com.osdkz.esf.signer
install: true
- symname: kz.nitec.eup.eupsigner
install: true
- symname: kz.smartdoc.osgi.CmsSigner
install: true
- symname: kz.uchet.signUtil
install: true
- symname: asia.dbt.thundercrypt.osgi.ThunderCryptModule
install: true
- symname: kz.webkassa.osgi.SignerBundle
install: true
install: true
- symname: kz.ecc.MarketSignBundle
install: true
- symname: kz.sapa.ztender.osgi.ZTenderModule
install: true
- symname: kz.akkamal.tinysigner
install: true
- symname: kz.btsdigital.qoltanba
install: true
- symname: kz.Simourg.SimBASE
install: true
- symname: kz.efactoring.EfactoringSignBundle
install: true
- symname: kz.documentolog.Agent
install: true
ncalayer_der_path: "$HOME/.config/NCALayer/ncalayer.der"
ncalayer_bundles_path: "$HOME/.config/NCALayer/bundles"
pre_tasks:
- name: Ensure that jq is installed
ansible.builtin.package:
name: jq
state: present
- name: Cut ncalayer.der file
ansible.builtin.shell:
cmd: "tail +66c {{ ncalayer_der_path }} | jq -r . | tee /tmp/ncalayer.der"
- name: Load ncalayer info as JSON file
ansible.builtin.set_fact:
ncalayer: "{{ lookup('file', '/tmp/ncalayer.der') | from_json }}"
tasks:
- name: Show ncalayer
ansible.builtin.debug:
msg: "{{ ncalayer }}"
- name: Set bundles array from ncalayer json
ansible.builtin.set_fact:
ncalayer_all_bundles: "{{ ncalayer.ncalayer.bundles }}"
- name: Show ncalayer.allbundles
ansible.builtin.debug:
msg: "{{ ncalayer_all_bundles }}"
- name: Show install_bundles loop
ansible.builtin.debug:
msg: "{{ item }}"
when: item.install
with_items:
- "{{ install_bundles }}"
- name: Debug bundles
ansible.builtin.get_url:
url: "{{ (ncalayer_all_bundles|selectattr('symname', 'contains', item.symname)|first).url }}"
dest: "{{ ncalayer_bundles_path }}"
checksum: "sha256:{{ (ncalayer_all_bundles|selectattr('symname', 'contains', item.symname)|first).hash }}"
when: item.install
with_items:
- "{{ install_bundles }}"
#!/usr/bin/env bash
sudo apt -y update
sudo apt -y install python3-venv python3-pip
python3 -m venv ~/python3/ansible
source ~/python3/ansible/bin/activate
pip install pip --upgrade
pip install ansible ansible-lint
mkdir ~/ansible-playbooks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment