- name: Install packages
  package:
    name:
    - po4a
    - git
    - perl-gettext
    - perl-Pod-Parser
    - perl(YAML::Tiny)
    - perl(Unicode::GCString)
    - python36-PyYAML
    - python-virtualenv
    - python2-pip
    - translate-toolkit
    state: present
  tags:
  - fedora-docs-translation

- name: Create a non root user to run the code
  user:
    name: _update_docs_trans
    generate_ssh_key: yes
    ssh_key_file: .ssh/id_rsa_docs_trans
  register: user_result
  tags:
  - fedora-docs-translation

- name: Display the public key to add it to pagure
  debug:
    var: user_result.ssh_public_key

- copy:
    src: ssh_config
    dest: ~_update_docs_trans/.ssh/config
    owner: _update_docs_trans
    group: _update_docs_trans
    mode: 0644
  tags:
  - fedora-docs-translation
 
- copy:
    src: docs-translation-update
    dest: /usr/local/bin/docs-translation-update
    owner: root
    group: root
    mode: 0755
  tags:
  - fedora-docs-translation

- copy:
    src: cron-docs-translation-update
    dest: /etc/cron.d/cron-docs-translation-update
    owner: root
    group: root
    mode: 0644
  tags:
  - fedora-docs-translation
  when: env == "production" and inventory_hostname.startswith('sundries01')


