Andreas Jaeger 0bf3827550 Fix prep-zanata
We download already on the remote system, so tell unarchive that the
content is there already and does not need to copied over.

The role currently fails since ansible tries to copy the file over from
the local host.

Change-Id: I8b879b976b19ab5672a95db35346cdea8467e726
2018-03-02 12:46:01 +01:00

107 lines
3.0 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: install necessary packages
apt:
name: default-jre-headless
become: true
- 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"
remote_src: yes
dest: /opt/zanata
creates: "/opt/zanata/zanata-cli-{{ zanata_client_version }}/bin/zanata-cli"
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 }}"
when: not cached_client.stat.exists
register: result
until: result | success
retries: 5
delay: 5
- name: Extract Zanata client archive
unarchive:
remote_src: yes
src: "/tmp/zanata-cli-{{ zanata_client_version }}-dist.tar.gz"
dest: /opt/zanata
creates: "/opt/zanata/zanata-cli-{{ zanata_client_version }}/bin/zanata-cli"
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