60acea0da6
We bump the Ansible version to the version that Zuul runs. We then set ansible-lint to the current latest version. This results in a number of new linter violations which we fix. These violations include: * Needing to name plays * Needing to start names with a capital letter * Using fully qualified names for action modules * Quoting permissions strings to avoid octal conversion errors * Using explicit yaml structures for tasks We also tell ansible-lint to mock zuul_return so that we don't get errors from it complaining that this module is not defined. Change-Id: Ic881313fea58f4482f70e493f3d256541d31860a
114 lines
3.1 KiB
YAML
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
|
|
community.general.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
|