openstack-zuul-jobs/roles/prepare-zanata-client/tasks/main.yaml
Jeremy Stanley 6ced4627bd Address breakage due to ansible-lint 6.5
Pin ansible-lint<6.5 for now due to the
https://github.com/ansible/ansible-lint/issues/2320 regression which
ignores our skip tags.

Also add the zuul.d directory to the list of directories to avoid
linting, since those YAML files aren't Ansible files and it doesn't
seem to know not to try parsing them anyway.

While we're here, "fix" a task name not starting with an upper-case
letter, which for some reason ansible-lint now seems to think is
important. If we decide to continue using ansible-lint, it's
probably going to persist in complaining about that.

Change-Id: I46826210dfa4442af5c36d1439d1a1047ca0ba90
2022-09-07 19:22:50 +00:00

114 lines
3.1 KiB
YAML

---
# This is all bad and I feel bad, but it's translated from
# https://github.com/opendev/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 }}"
- gettext
- libpcre3-dev
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