IBM-Security / isam-ansible-roles

Ansible Custom Modules, Handlers and Tasks for ISAM. Requires "ibmsecurity" python package.
Apache License 2.0
24 stars 43 forks source link

Provide support for ZIP archive upload and deletion of unneeded locales #112

Closed sygilber closed 5 years ago

sygilber commented 5 years ago

Sample code snippet to use the revised 'update_management_root' role shared here. Adapt it to your working environment and own variables names.

In this sample, we assume that A) only "en" and "fr" locales ressources are to be preserved on the Appliance's WRP, and B) generates an archive (ZIP) before uploading it to the WRP.

- name: setup runtime component (ISAM_RP) (archive content)
  hosts: localhost
  vars:
    rp_web_management_root: "{{ lookup('ini', 'management-root type=properties file={{ fact_rp_file }} default=default_root') }}"
  tasks:
    - name: create archive
      archive:
        path:
          - "{{ ansible_env.ISAM_TEMPLATES_HOME }}/isam/web/html/{{ rp_web_management_root }}/*"
        dest: "{{ ansible_env.ISAM_TMP }}/{{ rp_web_management_root }}.zip"
        format: zip
      run_once: True

- name: setup runtime component (ISAM_RP) (upload content)
  hosts: rp_dynamic_list
  serial: 1
  vars:
    username: "{{ fact_va_username }}"
    password: "{{ fact_va_password }}"
    update_management_root_instance_id: "{{ lookup('ini', 'server-name type=properties file={{ fact_rp_file }}') }}"
    rp_web_management_root: "{{ lookup('ini', 'management-root type=properties file={{ fact_rp_file }} default=default_root') }}"
  roles:
    - role: update_management_root
      update_management_root_zip_filename: "{{ ansible_env.ISAM_TMP }}/{{ rp_web_management_root }}.zip"
      update_management_root_locale_exclusion: 
        - "ar"
        - "cs"
        - "de"
        - "es"
        - "hu"
        - "it"
        - "ja"
        - "ko"
        - "pl"
        - "pt_BR"
        - "ru"
        - "zh_CN"
        - "zh_TW"