# Copyright (c) 2019 Dell Inc. or its subsidiaries. All Rights Reserved.
---
# AWX secret key
- name: Generate AWX secret key
  ngci_pass_gen:
    length: 40
    chars: ["digits", "lowercasealpha", "uppercasealpha"]
  register: random_key
  no_log: "{{ enforce_no_log }}"

- name: Set users fact
  set_fact:
    secret_key: "{{ random_key.generated_password }}"
  no_log: "{{ enforce_no_log }}"

# RabbitMQ password
- name:  Generate RabbitMq password
  ngci_pass_gen:
    chars: ["digits", "lowercasealpha", "uppercasealpha"]
  register: random_rabbitmq_password
  no_log: "{{ enforce_no_log }}"

- name: Set users fact
  set_fact:
    rabbitmq_password: "{{ random_rabbitmq_password.generated_password }}"
  no_log: "{{ enforce_no_log }}"

# RabbitMQ Earlang cookie
- name: Generate Rabbit MQ Earlang cookie
  ngci_pass_gen:
    length: 40
    chars: ["digits", "lowercasealpha", "uppercasealpha"]
  register: random_rabbitmq_earlang
  no_log: "{{ enforce_no_log }}"

- name: Set users fact
  set_fact:
    rabbitmq_erlang_cookie: "{{ random_rabbitmq_earlang.generated_password }}"
  no_log: "{{ enforce_no_log }}"
