---
- name: Install libffi-devel on EL6
  become: yes
  package:
    name: ftp://fr2.rpmfind.net/linux/centos/6/os/x86_64/Packages/libffi-devel-3.0.5-3.2.el6.x86_64.rpm
    state: latest
  when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "6"
  ignore_errors: yes  # Ignore error when already installed

- name: Install latest st2 package (stable)
  become: yes
  package:
    name: st2
    state: latest
  when: st2_version == "latest"
  notify:
    - restart st2
  tags: skip_ansible_lint

- name: Install latest st2 package (not stable)
  become: yes
  package:
    name: st2={{ st2_version }}-{{ st2_revision }}
    state: present
  when: st2_version != "latest"
  notify:
    - restart st2

- name: Create and configure StackStorm system user
  include: user.yml

- name: Configure StackStorm authentication
  include: config_auth.yml
  when: st2_auth_enable

- name: Ensure StackStorm services are enabled and running
  become: yes
  service:
    name: "{{ item }}"
    enabled: yes
    state: started
  with_items: "{{ st2_services }}"

---
- name: Install libffi-devel on EL6
  become: yes
  package:
    name: ftp://fr2.rpmfind.net/linux/centos/6/os/x86_64/Packages/libffi-devel-3.0.5-3.2.el6.x86_64.rpm
    state: present
  when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "6"
  ignore_errors: yes  # Ignore error when already installed

- name: Install latest st2 package (stable)
  become: yes
  package:
    name: st2
    state: latest
  when: st2_version == "latest"
  notify:
    - restart st2
  tags: skip_ansible_lint

- name: Install latest st2 package (not stable)
  become: yes
  package:
    name: st2={{ st2_version }}-{{ st2_revision }}
    state: present
  when: st2_version != "latest"
  notify:
    - restart st2

- name: Create and configure StackStorm system user
  include: user.yml

- name: Configure StackStorm authentication
  include: config_auth.yml
  when: st2_auth_enable

- name: Ensure StackStorm services are enabled and running
  become: yes
  service:
    name: "{{ item }}"
    enabled: yes
    state: started
  with_items: "{{ st2_services }}"

Change 'latest' to 'present' to address ansible-lint error
Change 'latest' to 'present' to address ansible-lint error
