<commit_before>---

- name: Extract easy-rsa files
  unarchive: src=easy-rsa.tar.gz dest={{openvpn_etcdir}}
  when: not openvpn_use_system_easyrsa

- name: Check if easy-rsa 2.x is available from the system
  stat: path=/usr/share/easy-rsa/build-ca
  register: openvpn_easyrsa_check
  when: openvpn_use_system_easyrsa

- fail:
    msg: >
      EasyRSA 2.x is not present in /usr/share/easy-rsa.
      Ensure the easy-rsa package is installed or disable the `openvpn_use_system_easyrsa` option.
  when: openvpn_use_system_easyrsa and not openvpn_easyrsa_check.stat.exists

- name: Generate scripts
  template: src={{item}}.j2 dest={{openvpn_etcdir}}/{{item}} mode=0700
  with_items: [vars, build-server.sh, build-client.sh, revoke-client.sh]

- name: Generate Server keys
  command: "{{openvpn_etcdir}}/build-server.sh"
  args: { creates: "{{ openvpn_keydir }}" }

- name: Generate tls-auth key
  command: openvpn --genkey --secret {{ openvpn_tls_key }}
    chdir="{{ openvpn_keydir }}"
    creates="{{ openvpn_tls_key }}"
  args: { creates: "{{ openvpn_keydir }}/{{ openvpn_tls_key }}" }
  when: openvpn_tls_auth

- name: Generate Clients keys
  command: "{{openvpn_etcdir}}/build-client.sh {{item}}"
  args: { creates: "{{ openvpn_keydir }}/{{item}}.crt" }
  with_items: "{{ openvpn_clients }}"

- name: Revoke Clients keys
  command: "{{openvpn_etcdir}}/revoke-client.sh {{item}}"
  args: { removes: "{{ openvpn_keydir }}/{{item}}.crt" }
  with_items: "{{ openvpn_clients_revoke }}"

- name: Create client configuration directory if requested
  file: >
    path={{openvpn_client_config_dir}}
    mode=755
    state=directory<commit_msg>Allow to work in check mode<commit_after>---

- name: Extract easy-rsa files
  unarchive: src=easy-rsa.tar.gz dest={{openvpn_etcdir}}
  when: not openvpn_use_system_easyrsa

- name: Check if easy-rsa 2.x is available from the system
  stat: path=/usr/share/easy-rsa/build-ca
  register: openvpn_easyrsa_check
  when: openvpn_use_system_easyrsa

- fail:
    msg: >
      EasyRSA 2.x is not present in /usr/share/easy-rsa.
      Ensure the easy-rsa package is installed or disable the `openvpn_use_system_easyrsa` option.
  when:
     - not ansible_check_mode|d(False)
     - openvpn_use_system_easyrsa
     - not openvpn_easyrsa_check.stat.exists

- name: Generate scripts
  template: src={{item}}.j2 dest={{openvpn_etcdir}}/{{item}} mode=0700
  with_items: [vars, build-server.sh, build-client.sh, revoke-client.sh]

- name: Generate Server keys
  command: "{{openvpn_etcdir}}/build-server.sh"
  args: { creates: "{{ openvpn_keydir }}" }

- name: Generate tls-auth key
  command: openvpn --genkey --secret {{ openvpn_tls_key }}
    chdir="{{ openvpn_keydir }}"
    creates="{{ openvpn_tls_key }}"
  args: { creates: "{{ openvpn_keydir }}/{{ openvpn_tls_key }}" }
  when: openvpn_tls_auth

- name: Generate Clients keys
  command: "{{openvpn_etcdir}}/build-client.sh {{item}}"
  args: { creates: "{{ openvpn_keydir }}/{{item}}.crt" }
  with_items: "{{ openvpn_clients }}"

- name: Revoke Clients keys
  command: "{{openvpn_etcdir}}/revoke-client.sh {{item}}"
  args: { removes: "{{ openvpn_keydir }}/{{item}}.crt" }
  with_items: "{{ openvpn_clients_revoke }}"

- name: Create client configuration directory if requested
  file: >
    path={{openvpn_client_config_dir}}
    mode=755
    state=directory
{'fraction_non_alphanumeric': 0.14315663372267146, 'fraction_numerical': 0.005989817310572028, 'mean_word_length': 4.186335403726708, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2715562', 'n_tokens_mistral': 1298, 'n_tokens_neox': 1259, 'n_words': 263}