---
# Small suite of smoke tests to execute to ensure that the playbook has deployed as expected

- meta: flush_handlers
  tags:
    - smoke-tests


- name: Make sure packs are reloaded
  become: yes
  command: st2ctl reload --register-all
  tags:
    - smoke-tests

- name: st2 installed
  command: st2 --version
  tags:
    - smoke-tests

- name: get authentication token
  command: st2 auth {{ st2_auth_username }} -p {{ st2_auth_password }} -t
  register: st2_token
  tags:
    - smoke-tests

- name: Ensuring action runners are listening before proceeding
  shell: cat /var/log/st2/st2actionrunner.*.log | grep amqp
  register: output
  until: output.stdout_lines|length > 1
  retries: 5

- name: st2 run core.local -- date -R
  command: st2 run core.local -- date -R
  environment:
    ST2_AUTH_TOKEN: "{{ st2_token.stdout }}"
  tags:
    - smoke-tests

- name: Check web-ui is up
  uri:
    url: https://{{ ansible_hostname }}/
    validate_certs: no
  tags:
    - smoke-tests

---
# Small suite of smoke tests to execute to ensure that the playbook has deployed as expected

- meta: flush_handlers
  tags:
    - smoke-tests

- name: Make sure packs are reloaded
  become: yes
  command: st2ctl reload --register-all
  changed_when: no
  tags:
    - smoke-tests

- name: st2 installed
  command: st2 --version
  changed_when: no
  tags:
    - smoke-tests

- name: get authentication token
  command: st2 auth {{ st2_auth_username }} -p {{ st2_auth_password }} -t
  register: st2_token
  changed_when: no
  tags:
    - smoke-tests

- name: Ensuring action runners are listening before proceeding
  shell: cat /var/log/st2/st2actionrunner.*.log | grep amqp
  register: output
  until: output.stdout_lines|length > 1
  retries: 5
  changed_when: no
  tags:
    - smoke-tests

- name: st2 run core.local -- date -R
  command: st2 run core.local -- date -R
  environment:
    ST2_AUTH_TOKEN: "{{ st2_token.stdout }}"
  changed_when: no
  tags:
    - smoke-tests

- name: Check web-ui is up
  uri:
    url: https://{{ ansible_hostname }}/
    validate_certs: no
  changed_when: no
  tags:
    - smoke-tests

Mark all Smoketests as idempotent
Mark all Smoketests as idempotent
