--- - name: Create installation directories file: path: "{{ item }}" state: directory mode: 0750 owner: "{{ atl_product_user }}" group: "{{ atl_product_user }}" with_items: - "{{ atl_installer_temp }}" - "{{ atl_product_home }}" - "{{ atl_product_installation_versioned }}" - "{{ atl_product_version_cache_dir }}" changed_when: false # For Molecule idempotence check - name: Check for existing version cache file stat: path: "{{ atl_product_version_cache }}" register: cached # Case: File exists, always use its value - name: Use version for product version block: - name: Read cached version from file command: "cat {{ atl_product_version_cache }}" register: atl_product_version_file changed_when: false - name: Set the local var to cached version set_fact: atl_product_version: "{{ atl_product_version_file.stdout }}" when: cached.stat.exists # Case: File doesn't exist and no version has been set; find latest. - name: Fetch and cache latest version when no override block: - name: Fetch the latest edition version include_tasks: "{{ atl_product_edition }}_version_latest.yml" when: not cached.stat.exists and (atl_product_version is undefined or not atl_product_version or atl_product_version == "latest") - name: Perform any additional per-edition version setup include_tasks: "{{ atl_product_edition }}_extra_tasks.yml" # At this point atl_product_version should be set, cache if necessary. - name: Write override cached version when specified template: src: version.j2 dest: "{{ atl_product_version_cache }}" force: false # Note: We don't the cache binary in the shared drive to the complexity # around download race-conditions if multiple nodes are starting at # the same time. When downloading from product-downloads.atlassian.com # (which is a CDN) takes seconds anyway. - name: Fetch product installer get_url: url: "{{ atl_product_download_url }}" dest: "{{ atl_product_download }}" mode: 0755 force: false - name: Create installer varfile template: src: "{{ atl_product_family }}.varfile.j2" dest: "{{ atl_product_varfile }}" mode: 0755 # NOTE: We run the installer as the user rather than root to limit its # actions. For example, if root and the 'jira' user exists then it # will create 'jira1'; this potentially creates idempotency/upgrade # issues down the line. - name: Run the installer command: /bin/sh "{{ atl_product_download }}" -q -varfile "{{ atl_product_varfile }}" args: creates: "{{ atl_product_installation_versioned }}/.install4j/" become: true become_user: "{{ atl_product_user }}" - name: Symlink the installed version to current file: src: "{{ atl_product_installation_versioned }}" dest: "{{ atl_product_installation_current }}" state: link force: true