Skip to content

Commit

Permalink
wip identity role
Browse files Browse the repository at this point in the history
  • Loading branch information
gionn committed Sep 19, 2023
1 parent 010eef1 commit 4b4d17a
Show file tree
Hide file tree
Showing 15 changed files with 161 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/community.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
- name: activemq
- name: common
- name: elasticsearch
- name: identity
- name: java
- name: nginx
- name: postgres
Expand Down
7 changes: 6 additions & 1 deletion requirements.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
---
# Install with ansible-galaxy coillection install -vr requirements.yml
collections:
- name: community.general
version: 4.4.0
- name: community.postgresql
version: 2.1.0
- name: ansible.posix
version: 1.3.0
version: 1.5.4
- name: ansible.utils
version: 2.6.0
- name: community.crypto
version: 2.10.0
- name: middleware_automation.keycloak
version: 1.2.8
# molecule ec2 tests
- name: amazon.aws
version: 6.3.0
Expand All @@ -18,6 +21,8 @@ collections:
# molecule roles tests
- name: community.docker
version: 2.1.1

# Install with ansible-galaxy role install -vr requirements.yml
roles:
- name: buluma.elastic_repo
version: v0.1.2
Expand Down
1 change: 1 addition & 0 deletions roles/identity/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
keycloak-*.zip
38 changes: 38 additions & 0 deletions roles/identity/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Role Name
=========

A brief description of the role goes here.

Requirements
------------

Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.

Role Variables
--------------

A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.

Dependencies
------------

A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.

Example Playbook
----------------

Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:

- hosts: servers
roles:
- { role: username.rolename, x: 42 }

License
-------

BSD

Author Information
------------------

An optional section for the role authors to include contact information, or a website (HTML is not allowed).
2 changes: 2 additions & 0 deletions roles/identity/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
# defaults file for identity
2 changes: 2 additions & 0 deletions roles/identity/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
# handlers file for identity
24 changes: 24 additions & 0 deletions roles/identity/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
galaxy_info:
author: Alfresco
namespace: alfresco
description: Install Keycloak to enable SSO in Alfresco
company: Hyland Software

license: Apache-2.0

min_ansible_version: "2.12"

platforms:
- name: Ubuntu
versions:
- focal
- bionic
- name: EL
versions:
- "7"
- "8"

galaxy_tags: []

dependencies:
- role: common
7 changes: 7 additions & 0 deletions roles/identity/molecule/default/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
- name: Converge
hosts: all
tasks:
- name: "Include identity"
ansible.builtin.include_role:
name: "identity"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ansible_user: ansible
29 changes: 29 additions & 0 deletions roles/identity/molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
dependency:
name: galaxy
driver:
name: docker
platforms:
- name: identity-instance
image: $MOLECULE_ROLE_IMAGE
dockerfile: ../../../../tests/molecule/Dockerfile-noprivs.j2
command: "/lib/systemd/systemd"
privileged: true
tmpfs:
- /run
- /run/lock
- /tmp
volume_mounts:
- "/sys/fs/cgroup:/sys/fs/cgroup:ro"
groups:
- identity
published_ports:
- 0.0.0.0:8080:8080/tcp
provisioner:
name: ansible
inventory:
links:
host_vars: host_vars
group_vars: ../../../../group_vars
verifier:
name: ansible
34 changes: 34 additions & 0 deletions roles/identity/molecule/default/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
- name: Verify
hosts: all
gather_facts: false
tasks:

- name: Stat the tmp folder for identity
ansible.builtin.stat:
path: "/usr/share/identity/tmp"
register: tmp_path_stat

- name: Assert that tmp folder is setup correctly
ansible.builtin.assert:
that:
- tmp_path_stat.stat.exists
- tmp_path_stat.stat.isdir
- tmp_path_stat.stat.mode == '0777'
- tmp_path_stat.stat.uid == 0
- tmp_path_stat.stat.gid == 0

- name: Check if port 9200/tcp is listening
ansible.builtin.wait_for:
port: 9200
timeout: 30
connect_timeout: 1
msg: "Timeout waiting for 9200/tcp to respond"

- name: Populate service facts
ansible.builtin.service_facts:

- name: Identity service is up and running
ansible.builtin.assert:
that:
- ansible_facts.services['identity.service'] is defined
- ansible_facts.services['identity.service'].state == 'running'
8 changes: 8 additions & 0 deletions roles/identity/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
# tasks file for identity
- name: Install Keycloak
vars:
keycloak_quarkus_admin_pass: "alfrescoalfrescoadmin"
keycloak_quarkus_version: 21.1.2
ansible.builtin.include_role:
name: middleware_automation.keycloak.keycloak_quarkus
1 change: 1 addition & 0 deletions roles/identity/tests/inventory
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
localhost
5 changes: 5 additions & 0 deletions roles/identity/tests/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- hosts: localhost

Check failure on line 2 in roles/identity/tests/test.yml

View workflow job for this annotation

GitHub Actions / pre-commit

name[play]

All plays should be named.
remote_user: root
roles:
- identity
2 changes: 2 additions & 0 deletions roles/identity/vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
# vars file for identity

0 comments on commit 4b4d17a

Please sign in to comment.