Domino on Linux/Unix, Troubleshooting, Best Practices, Tips and more ...

 
alt

Daniel Nashed

 

    Ansible for automating everything

    Daniel Nashed  28 July 2021 05:18:51

    Ansible is very very cool. Not only that you don't have to install any software on the machine because it just runs over SSH.
    But it has so many build-in modules which allow almost everything to be done without writing any bash script.

    The key element is that you describe what your result should look like and Ansible makes all the changes for you.

    For our Lab environment for Domino on Docker and K8s I prepared our Lab servers with Ansible before.
    And I just added some details like creating notes:notes user and group and downloading the software.

    With planned 20 participants the software download could take some time.

    I am also patching existing lab example scripts with the server's IP address and hostname to avoid typos in setup.

    Let me share one of the latest changes I made to show the principle.

    I have defined my lab hosts in a configuration file, which I can create already from my Notes database where I registered my hosts via REST API calls to the Hetzner APIs (My German provider where I host all my servers).
    During setup I already registered a SSH key for authentication which I use for all my scripts.

    After defining variables for the software download I make sure the /local/software directory exists and describe the software to download including the SHA256 hashes.

    If you make changes to the definition -- for example if you forgot to specify the owner of the downloaded files, you just change the definition and run the script again.

    So you don't need to think about how to do it.
    You just need to describe your environment.

    The following downloads Domino for Linux and Domino for Docker web-kit files.
    For download I am just starting our software repository NGINX Docker container, which hosts files from the host-machine /local/software and is stopped once the installation is done.

    -- Daniel


    #!/bin/ansible-playbook

    - hosts: lab
      remote_user: root

      vars:
        ansible_ssh_private_key_file: /local/ansible/lab_ec_key.pem

        DOWNLOAD: http://software.acme.com:7777
        SOFTWARE_DIR: /local/software
        DOMINO_USER: notes

        DOMINO_LINUX_TAR: Domino_12.0_Linux_English.tar
        DOMINO_DOCKER_TAR: Domino_12.0_DockerImage.tgz
        DOMINO_LINUX_SHA256: f8a8618c20717a04826344ca4fec808351c523d754737a688d86edd4f445ff40
        DOMINO_DOCKER_SHA256: 4db06a78b5cabcc5cdf11a71ae949d72c99b0b62dcc375a37af7e2ccdeaa3667

      gather_facts: False

      tasks:

      - name: Create software directory

        file:
          path: /local/software
          state: directory
          owner: "{{ DOMINO_USER }}"
          group: "{{ DOMINO_USER }}"
          mode: 0775
          recurse: yes

      - name: Download Domino Linux

        get_url:
          url: "{{ DOWNLOAD }}/{{ DOMINO_LINUX_TAR }}"
          dest: "{{ SOFTWARE_DIR }}/{{ DOMINO_LINUX_TAR }}"
          checksum: "sha256:{{ DOMINO_LINUX_SHA256 }}"
          owner: "{{ DOMINO_USER }}"

      - name: Download Domino Docker

        get_url:
          url: "{{ DOWNLOAD }}/{{ DOMINO_DOCKER_TAR }}"
          dest: "{{ SOFTWARE_DIR }}/{{ DOMINO_DOCKER_TAR }}"
          checksum: "sha256:{{ DOMINO_DOCKER_SHA256 }}"
          owner: "{{ DOMINO_USER }}"


    Links

      Archives


      • [HCL Domino]
      • [Domino on Linux]
      • [Nash!Com]
      • [Daniel Nashed]