Rename extra-atcs to extra-acs on ansible

Update tox ansible environment to rename from extra-atcs
to extra-acs and work with environment.

1. Renaming to extra-acs aligns with a governance patch
: https://review.opendev.org/c/openstack/governance/+/893831

2. Update minimum ansible version since older version causes errors
: https://github.com/ansible/ansible/issues/77413

Change-Id: If5c69efddcdf4854f8db95cfa2356cda0cb6f98a
This commit is contained in:
Ian Y. Choi 2023-09-13 16:28:01 +09:00
parent 266eebaf7d
commit 245815010a
4 changed files with 26 additions and 25 deletions

View File

@ -6,7 +6,7 @@
# target configuration in each role.
# The Ansible version used for testing
ansible==2.3.0.0
ansible==2.9.22
# The Ansible lint version used for lint tests
ansible-lint==3.4.18

View File

@ -3,19 +3,20 @@ Ansible playbooks for I18n maintenance
This folder contains Ansible playbooks for maintenance I18n work.
Typically the playbooks are running locally on user's workstation.
Ansible >= 2.2.0.0 is required to work with json_query.
Ansible >= 2.9.22 is required to work with json_query and Jinja2.
Usage: "ansible-playbook <playbook.yml>"
More convenient way is to use **tox** like
``tox -e ansible -- ansible-playbook <playbook.yml>``.
generate_atc.yml
generate_ac.yml
----------------
This playbook uses the output of zanata_stats.py, zanata_userinfo.py
and zanata_users.py and generates a list of Extra-ATCS in the target
formats for the proposal to the governance repo and the Wiki page:
and zanata_users.py and generates a list of extra-ACs (previously
extra-ATCs) in the target formats for the proposal to the governance repo
and the Wiki page:
http://git.openstack.org/cgit/openstack/governance/tree/reference/projects.yaml
https://wiki.openstack.org/wiki/I18nTeam/ATC_statistics
https://opendev.org/openstack/governance/src/branch/master/reference/sigs-repos.yaml
https://wiki.openstack.org/wiki/I18nTeam/AC_statistics

View File

@ -1,31 +1,31 @@
---
# Ansible playbook to generate extra-atc snippets for projects.yaml in
# Ansible playbook to generate extra-ac snippets for sigs-repos.yaml in
# governance repo.
# Requires 3 source files
# - userstatsfile: generated output from zanata_stats.py
# (default: zanata_stats_output.csv)
# - userinfofile: generated output from zanata_userinfo.py
# (default: zanata_userinfo_output.csv)
# - the current projects.yaml file from governance repo
# https://git.openstack.org/cgit/openstack/governance/plain/reference/projects.yaml
# - the current sig-repos.yaml file from governance repo
# https://opendev.org/openstack/governance/raw/branch/master/reference/sigs-repos.yaml
#
# minimum translation count is to configure (default 300 words/30
# phrases)
#
# Old extra-atc list will be reviewed and refreshed with new data
# Old extra-ac list will be reviewed and refreshed with new data
#
# usage: ansible-playbook generate_atc.yml
# usage: ansible-playbook generate_ac.yml
#
# The output can be found in /tmp/atc.stats
# The output can be found in /tmp/ac.stats
#
# The full workflow is described in https://wiki.openstack.org/wiki/I18n_Extra-ATC_collection
# The full workflow is described in https://wiki.openstack.org/wiki/I18n_Extra-AC_collection
- hosts: localhost
gather_facts: "no"
vars:
userstatsfile: "vars/zanata_stats_output.csv"
userinfofile: "vars/zanata_userinfo_output.csv"
translatecount: 300
workingdir: "/tmp/atc.output"
workingdir: "/tmp/ac.output"
tasks:
- name: create working dir
@ -35,16 +35,16 @@
- name: fetch projects list
get_url:
url: https://git.openstack.org/cgit/openstack/governance/plain/reference/projects.yaml
url: https://opendev.org/openstack/governance/raw/branch/master/reference/sigs-repos.yaml
dest: vars/
force: True
- name: include projects.yaml var
include_vars: vars/projects.yaml
- name: include sigs-repos.yaml var
include_vars: vars/sigs-repos.yaml
- name: read old atc list
- name: read old ac list
vars:
extraatcs: "{{ I18n['extra-atcs'] }}"
extraacs: "{{ i18n[0]['extra-acs'] }}"
useremail: "{{ item.email }}"
username: "{{ item.name }}"
usercomment: "{{ item.comment }}"
@ -53,11 +53,11 @@
udateuser: "{{lookup('pipe','LANG=en date -d \"' + expiredate + '\" \"+%s\"')}}"
udatecur: "{{lookup('pipe','LANG=en date -d \"+1 month\" \"+%s\"') }}"
template:
src: atc.json.j2
src: ac.json.j2
dest: "{{ workingdir }}/user.{{ usercomment.split(' ')[0] }}"
when: udateuser|int > udatecur|int
with_items:
- "{{ extraatcs }}"
- "{{ extraacs }}"
- name: read user stats
vars:
@ -68,7 +68,7 @@
usercomment: "{{ userdata[0] }} ({{ userlang }})"
userexpires: "{{lookup('pipe','LANG=en date \"+%B %Y\" -d \"+1 year\"')}}"
template:
src: atc.json.j2
src: ac.json.j2
dest: "{{ workingdir }}/user.{{ userdata[0] }}"
force: "yes"
with_lines: cat "{{ userstatsfile }}"
@ -98,10 +98,10 @@
with_items: "{{ api|json_query('results[].{ item: item, userdata: json.data[].{email_verified: email_verified, groups: groups[?id==`5`].code|[0]}}') }}"
- name: create stats file proposal
shell: cat "{{ workingdir }}"/user.* > /tmp/atc.stats
shell: cat "{{ workingdir }}"/user.* > /tmp/ac.stats
- name: create stats file wiki
shell: cat "{{ workingdir }}"/stats.* > /tmp/atc.wiki
shell: cat "{{ workingdir }}"/stats.* > /tmp/ac.wiki
- name: delete working dir
file: