
This role is currently in project-config where it is untested. Move it to o-z-j, and rename to prepare-zanata-client for consistency with other names. Add integration test. We will migrate the jobs to the new name when this merges. Change-Id: I26ee7057b9ad70507959286acc17d9c7bc1471db
111 lines
3.1 KiB
YAML
111 lines
3.1 KiB
YAML
---
|
|
# This is all bad and I feel bad, but it's translated from
|
|
# https://github.com/openstack-infra/puppet-zanata/blob/master/manifests/client.pp
|
|
|
|
- name: Find java package name
|
|
include_vars: "{{ ansible_os_family }}.yaml"
|
|
|
|
- name: install necessary packages
|
|
package:
|
|
name: "{{ zanata_jre_package }}"
|
|
state: present
|
|
become: yes
|
|
|
|
- name: ensure zanata install dir
|
|
file:
|
|
path: /opt/zanata
|
|
owner: "{{ ansible_ssh_user }}"
|
|
state: directory
|
|
become: true
|
|
|
|
- name: Look for cached zanata client
|
|
stat:
|
|
path: "/opt/cache/files/zanata-cli-{{ zanata_client_version }}-dist.tar.gz"
|
|
checksum_algorithm: sha256
|
|
register: cached_client
|
|
|
|
- name: Ensure correct checksum of cached client
|
|
assert:
|
|
that:
|
|
- cached_client.stat.checksum == "{{ zanata_client_checksum }}"
|
|
when: cached_client.stat.exists
|
|
|
|
- name: Extract cached client tarball
|
|
unarchive:
|
|
src: "/opt/cache/files/zanata-cli-{{ zanata_client_version }}-dist.tar.gz"
|
|
dest: /opt/zanata
|
|
creates: "/opt/zanata/zanata-cli-{{ zanata_client_version }}/bin/zanata-cli"
|
|
remote_src: yes
|
|
when: cached_client.stat.exists
|
|
|
|
- name: Download Zanata client archive
|
|
get_url:
|
|
url: "https://search.maven.org/remotecontent?filepath=org/zanata/zanata-cli/{{ zanata_client_version }}/zanata-cli-{{ zanata_client_version }}-dist.tar.gz"
|
|
dest: "/tmp/zanata-cli-{{ zanata_client_version }}-dist.tar.gz"
|
|
checksum: "sha256:{{ zanata_client_checksum }}"
|
|
register: result
|
|
until: result | success
|
|
retries: 5
|
|
delay: 5
|
|
when: not cached_client.stat.exists
|
|
|
|
- name: Extract Zanata client archive
|
|
unarchive:
|
|
src: "/tmp/zanata-cli-{{ zanata_client_version }}-dist.tar.gz"
|
|
dest: /opt/zanata
|
|
creates: "/opt/zanata/zanata-cli-{{ zanata_client_version }}/bin/zanata-cli"
|
|
remote_src: yes
|
|
when: not cached_client.stat.exists
|
|
|
|
- name: ensure zanata-cli perms
|
|
file:
|
|
path: "/opt/zanata/zanata-cli-{{ zanata_client_version }}/bin/zanata-cli"
|
|
mode: 0755
|
|
|
|
- name: link zanata-cli
|
|
file:
|
|
path: /usr/local/bin/zanata-cli
|
|
src: "/opt/zanata/zanata-cli-{{ zanata_client_version }}/bin/zanata-cli"
|
|
state: link
|
|
become: true
|
|
|
|
# This is a preview module in Ansible 2.3. It may not work.
|
|
- name: import cert to java keystore
|
|
java_cert:
|
|
cert_url: "{{ zanata_api_credentials.fqdn }}"
|
|
keystore_path: /etc/ssl/certs/java/cacerts
|
|
keystore_pass: changeit
|
|
keystore_create: true
|
|
become: true
|
|
# Use sudo to ensure root ownership
|
|
|
|
- name: set permissions for cacert
|
|
file:
|
|
path: /etc/ssl/certs/java/cacerts
|
|
mode: 0644
|
|
become: true
|
|
|
|
- name: ensure zanata config dir
|
|
file:
|
|
path: ~/.config
|
|
state: directory
|
|
|
|
- name: write out zanata config
|
|
template:
|
|
src: zanata.ini
|
|
dest: ~/.config/zanata.ini
|
|
|
|
- name: Copy translation scripts to the script dir on the node
|
|
copy:
|
|
dest: '{{ ansible_user_dir }}/scripts/'
|
|
src: '{{ item }}'
|
|
mode: 0755
|
|
with_items:
|
|
- common_translation_update.sh
|
|
- create-zanata-xml.py
|
|
- get-modulename.py
|
|
- propose_translation_update.sh
|
|
- query-zanata-project-version.py
|
|
- upstream_translation_update.sh
|
|
- ZanataUtils.py
|