From d843015818d5c54858d065f16711dc9e23d8ffa5 Mon Sep 17 00:00:00 2001 From: Ranabir Chakraborty Date: Thu, 14 Nov 2024 20:41:55 +0530 Subject: [PATCH] Restructuring the collection for validated content proposal --- playbooks/datagrid.yml | 2 +- playbooks/prerequisites.yml | 41 ++++++----- playbooks/rhbk.yml | 4 +- playbooks/roles/certificates/README.md | 45 ------------ .../roles/certificates/defaults/main.yml | 6 -- .../roles/certificates/files/keystore.jks | Bin 2265 -> 0 bytes .../certificates/files/my-root-ca.crt.pem | 23 ------- .../roles/certificates/handlers/main.yml | 4 -- playbooks/roles/certificates/meta/main.yml | 21 ------ playbooks/roles/certificates/tasks/main.yml | 37 ---------- playbooks/roles/fastpackages/README.md | 39 ----------- .../roles/fastpackages/defaults/main.yml | 2 - playbooks/roles/fastpackages/meta/main.yml | 20 ------ playbooks/roles/fastpackages/tasks/main.yml | 17 ----- playbooks/roles/promtail/README.md | 45 ------------ playbooks/roles/promtail/defaults/main.yml | 8 --- playbooks/roles/promtail/handlers/main.yml | 12 ---- playbooks/roles/promtail/meta/main.yml | 20 ------ playbooks/roles/promtail/tasks/main.yml | 64 ------------------ .../promtail/templates/promtail.service.j2 | 19 ------ .../roles/promtail/templates/promtail.yml.j2 | 33 --------- roles/certificates/README.md | 9 +-- roles/fastpackages/README.md | 7 +- roles/promtail/README.md | 7 +- roles/roles | 1 - 25 files changed, 33 insertions(+), 453 deletions(-) delete mode 100644 playbooks/roles/certificates/README.md delete mode 100644 playbooks/roles/certificates/defaults/main.yml delete mode 100644 playbooks/roles/certificates/files/keystore.jks delete mode 100644 playbooks/roles/certificates/files/my-root-ca.crt.pem delete mode 100644 playbooks/roles/certificates/handlers/main.yml delete mode 100644 playbooks/roles/certificates/meta/main.yml delete mode 100644 playbooks/roles/certificates/tasks/main.yml delete mode 100644 playbooks/roles/fastpackages/README.md delete mode 100644 playbooks/roles/fastpackages/defaults/main.yml delete mode 100644 playbooks/roles/fastpackages/meta/main.yml delete mode 100644 playbooks/roles/fastpackages/tasks/main.yml delete mode 100644 playbooks/roles/promtail/README.md delete mode 100644 playbooks/roles/promtail/defaults/main.yml delete mode 100644 playbooks/roles/promtail/handlers/main.yml delete mode 100644 playbooks/roles/promtail/meta/main.yml delete mode 100644 playbooks/roles/promtail/tasks/main.yml delete mode 100644 playbooks/roles/promtail/templates/promtail.service.j2 delete mode 100644 playbooks/roles/promtail/templates/promtail.yml.j2 delete mode 120000 roles/roles diff --git a/playbooks/datagrid.yml b/playbooks/datagrid.yml index 76f5018..94611bd 100644 --- a/playbooks/datagrid.yml +++ b/playbooks/datagrid.yml @@ -8,7 +8,7 @@ pre_tasks: - name: Configure promtail ansible.builtin.include_role: - name: promtail + name: infra.rhbk_ha_cluster.promtail when: not skip_promtail is defined vars: promtail_job_name: datagrid diff --git a/playbooks/prerequisites.yml b/playbooks/prerequisites.yml index b6f3b90..af0c630 100644 --- a/playbooks/prerequisites.yml +++ b/playbooks/prerequisites.yml @@ -1,23 +1,26 @@ --- - name: Playbook for installing prerequisites hosts: all - tasks: - - name: "Install packages" + vars: + fastpackages_packages_list: + - procps-ng + - mailcap + - unzip + - firewalld + - ca-certificates + - python3-lxml + - net-tools + - python3-policycoreutils + - policycoreutils-python-utils + - "{{ jvm_package }}" + + pre_tasks: + - name: Install fastpackages prerequisites ansible.builtin.include_role: - name: fastpackages - vars: - fastpackages_packages_list: - - procps-ng - - mailcap - - unzip - - firewalld - - ca-certificates - - python3-lxml - - net-tools - - python3-policycoreutils - - policycoreutils-python-utils - - "{{ jvm_package }}" - - name: "Get FQDN" + name: infra.rhbk_ha_cluster.fastpackages + + tasks: + - name: "Set SELinux to Permissive mode" ansible.builtin.command: "setenforce Permissive" become: yes changed_when: false @@ -31,6 +34,8 @@ become: yes when: current_fqdn.stdout != (inventory_hostname + domain_name) changed_when: true - - name: "Install certificates" + + post_tasks: + - name: Install certificates prerequisites ansible.builtin.include_role: - name: certificates + name: infra.rhbk_ha_cluster.certificates diff --git a/playbooks/rhbk.yml b/playbooks/rhbk.yml index 3dd85d1..663f6c5 100644 --- a/playbooks/rhbk.yml +++ b/playbooks/rhbk.yml @@ -4,15 +4,17 @@ roles: - role: redhat.rhbk.rhbk rhbk_admin_pass: "{{ admin_pass }}" + pre_tasks: - name: Configure promtail ansible.builtin.include_role: - name: promtail + name: infra.rhbk_ha_cluster.promtail when: not skip_promtail is defined vars: promtail_job_name: rhbk promtail_logfile: /var/log/sso/server.log promtail_region: "{{ hostvars[inventory_hostname].tags.Region }}" + post_tasks: - name: Running rhbk_realm role ansible.builtin.include_role: diff --git a/playbooks/roles/certificates/README.md b/playbooks/roles/certificates/README.md deleted file mode 100644 index ed3c502..0000000 --- a/playbooks/roles/certificates/README.md +++ /dev/null @@ -1,45 +0,0 @@ -certificates -======== - -The role is used to install required certificates and keystore. - - -Role Defaults -------------- - -* No defaults - -Role Variables --------------- - -| Variable | Description | Default | -|:-------------------------------------|:----------------------------------------------------|:-------------------| -| `certificates_install_keystore` | Certificates inatll keystore boolean value | `False` | -| `certificates_install_trust_ca` | Certificates inatll keystore CA certs boolean value | `True` | -| `certificates_ca_cn` | CA certificate for which url | `rhssocrossdc.com` | -| `certificates_trust_ca_password` | Certificate CA password | `changeit` | -| `certificates_tls_certs_lookup_path` | Certificates TLS certs lookup path | ` ` | - - - -Dependencies ------------- - -* amazon.aws -* community.aws -* community.general - -Example Playbook ----------------- - -License -------- - -[Apache License Version 2.0](https://github.com/ansible-middleware/rhbk-ha-cluster/blob/main/LICENSE) - -Author Information ------------------- - -* [Guido Grazioli](https://github.com/guidograzioli) -* [Harsha Cherukuri](https://github.com/hcherukuri) -* [Ranabir Chakraborty](https://github.com/RanabirChakraborty) diff --git a/playbooks/roles/certificates/defaults/main.yml b/playbooks/roles/certificates/defaults/main.yml deleted file mode 100644 index 2d036c7..0000000 --- a/playbooks/roles/certificates/defaults/main.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -certificates_install_keystore: False -certificates_install_trust_ca: True -certificates_ca_cn: rhssocrossdc.com -certificates_trust_ca_password: changeit -certificates_tls_certs_lookup_path: '' diff --git a/playbooks/roles/certificates/files/keystore.jks b/playbooks/roles/certificates/files/keystore.jks deleted file mode 100644 index 43259876269097046dee32913f52296b3b021430..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2265 zcmcIlX*|@68vf6WnV6YKMOi||I-wax#@bk7uIwTt8e=k+A;w;orWj)E$C86WWQ(*& zvW%rgAAV~*3MW))780O`gT9v56_3^eVz~R@AfQ2ZK0Bm66mD=)`n!u!1 zXPP@V5s%$|Y#;WF@)k)-&s3?+ya<>-ROXHkuMY}V>F_#!+)|Iz>vL7Z^tn8H&5vel zeL0;@+u3ZX==UQVr8$y2fl-`(+V357>fMw^il@0A!>EH8s92d1q1bbJz$XST0M7fw z4J?ZKMCwU%I(kuL+oYG8ofd04r3)IG$~fCrM)78875Q4vOeJQQ7?qsPUc2jwkLe+P z2l@K<;qW3GiegV8kD9TYQuex^_J3b#Q~- z7(3>p(_)23vfa&n?JcK^-5hT(S*c1+l(^CV z+Y{MBvTrrY-`Gml7KmgbWQ=LO#xXR5A`xtH*4*V%MmOsXxi#dny{0>8X4>+~Zpj-o zEkjJoEIV(sYzZhza+(sgaTf=L#3fzAnQ3y`%bO?89Z<<@^V2g3pX`GJ_^VkbmPZOPz=;peYvWgU#s z{I9k8^FA#&k6kCd5HF=HP3i6t67KFjm#Ivx=fBl-&CHleOZur_H9NQ-^0!nLuysZs z$s3FtbCI^M0tJswZB2u_+50VU zE2pDgWTH3nlt@D3wnv;=&_d-jQHtJ=-A;gG25MHt6Tjdj&L6y>b#+H-yyflV;NW)2 z7P`(`$pd`3x#TkIYb$zeX9h(f7TCk*72)t4PAc=r7c5Uhqsb1wAHIGge0 zj-{bbHOfHIO?%e0=mQM%T%-_zDqPb3O)-T_WCc?Vg)QA=@ER+XI@cz=6rrP`1~OU8 z8GMI06=VS+>1dMZnXvo*yj>Pln2NvB_zdnoYoPv_uR5}n%`Pps9-d!sXTB6nS1F%w z(Cw^|3{0(xBgb;uJo556wVCLwWXZ0@?HyhX4P^i@iIPJ--*%KR??x-nGt;uv6_W30 zx@K~l5%C3InBJy-!o~H+1ak7&I59{6ilLt44_ObtTAA?Gg=RrEIc^FI#)ixbA8oQX z+^<}^a3vp^Yxz%QLR~bpF}eT%iNG)*bPNN00en~;KpZ7VWYBDyScg8Mq#yjL>vjUO zA0~uOBqna|2Z0b!027EsV1!^0CjrG3zUnAQ4B@hNk z1lXIy!3+=x_@GI&=hEI>Th8%J5f=zt>xuM-`n(mCu|-2%Ym64R+ex) zs@Gpdb?wC>bTyEmno$`Bz^>LgE2(U)IOv5AO@->lPnQ^4=-tWV2oRRy?bdv!a2Lmh zYp*X)Em3cM@?7;HN8eY*rWA_T7Tp_(aRC-PPf+uUCZDE$k0|Ju)$p7HJl@l4A4_lO z{*DmDf*~LP^lL(UN3@p^2yop&yL?7gbxemBT~!o08R=)M)g_&K_`#WLYZ@W{l0`oZ z``(4F>5?Z@n|htP*eYPyhjXnE753@&Gv5g7EZ=v^J;@qPbjh~e$v#__|B@~ -Role Defaults -------------- - -* No defaults - -Role Variables --------------- - -| Variable | Description | Default | -|:-----------------------------|:--------------------------------------------------|:--------| -| `fastpackages_packages_list` | Provide the packages list which will be installed | ` ` | - - - -Dependencies ------------- - -* community.general - -Example Playbook ----------------- - -License -------- - -[Apache License Version 2.0](https://github.com/ansible-middleware/rhbk-ha-cluster/blob/main/LICENSE) - -Author Information ------------------- - -* [Guido Grazioli](https://github.com/guidograzioli) -* [Harsha Cherukuri](https://github.com/hcherukuri) -* [Ranabir Chakraborty](https://github.com/RanabirChakraborty) diff --git a/playbooks/roles/fastpackages/defaults/main.yml b/playbooks/roles/fastpackages/defaults/main.yml deleted file mode 100644 index 4c059d5..0000000 --- a/playbooks/roles/fastpackages/defaults/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -fastpackages_packages_list: '' \ No newline at end of file diff --git a/playbooks/roles/fastpackages/meta/main.yml b/playbooks/roles/fastpackages/meta/main.yml deleted file mode 100644 index 4810ffa..0000000 --- a/playbooks/roles/fastpackages/meta/main.yml +++ /dev/null @@ -1,20 +0,0 @@ ---- -galaxy_info: - role_name: fastpackages - namespace: infra - author: Guido Grazioli, Ranabir Chakraborty - description: The role is used to install required packages into the system. - company: Red Hat - - license: Apache License 2.0 - - min_ansible_version: "2.14" - - galaxy_tags: - - java - - rhbk - - ansible - - datagrid - - packages - -dependencies: [] diff --git a/playbooks/roles/fastpackages/tasks/main.yml b/playbooks/roles/fastpackages/tasks/main.yml deleted file mode 100644 index 38d0991..0000000 --- a/playbooks/roles/fastpackages/tasks/main.yml +++ /dev/null @@ -1,17 +0,0 @@ ---- -- name: "Check if packages are already installed" # noqa command-instead-of-module this runs faster - ansible.builtin.command: "rpm -q {{ fastpackages_packages_list | join(' ') }}" - register: rpm_info - changed_when: false - failed_when: false - -- name: "Add missing packages to the yum install list" - ansible.builtin.set_fact: - packages_to_install: "{{ packages_to_install | default([]) + rpm_info.stdout_lines | map('regex_findall', 'package (.+) is not installed$') | default([]) | flatten }}" - -- name: "Install packages: {{ packages_to_install }}" - become: true - ansible.builtin.dnf: - name: "{{ packages_to_install }}" - state: present - when: packages_to_install | default([]) | length > 0 diff --git a/playbooks/roles/promtail/README.md b/playbooks/roles/promtail/README.md deleted file mode 100644 index 35d30a0..0000000 --- a/playbooks/roles/promtail/README.md +++ /dev/null @@ -1,45 +0,0 @@ -promtail -======== - -The role is used to setup and configure Promtail. - - -Role Defaults -------------- - -* No defaults - -Role Variables --------------- - -| Variable | Description | Default | -|:---------------------|:-------------------------------------|:----------------------------------------------------------------------| -| `promtail_directory` | promtail directory path | `/opt/promtail` | -| `promtail_loki_url` | promtail loki URL | `http://grafana.internal.ansiblemiddleware.com:3100/loki/api/v1/push` | -| `promtail_job_name` | promtail job name | `default` | -| `promtail_logfile` | promtail logfile path | `/var/log/messages` | -| `promtail_region` | promtail configured for which region | `us-east-1` | -| `promtail_host` | promtail hostnames | `"{{ inventory_hostname }}"` | -| `promtail_version` | promtail versions | `2.5.0` | - - - -Dependencies ------------- - -* community.general - -Example Playbook ----------------- - -License -------- - -[Apache License Version 2.0](https://github.com/ansible-middleware/rhbk-ha-cluster/blob/main/LICENSE) - -Author Information ------------------- - -* [Guido Grazioli](https://github.com/guidograzioli) -* [Harsha Cherukuri](https://github.com/hcherukuri) -* [Ranabir Chakraborty](https://github.com/RanabirChakraborty) diff --git a/playbooks/roles/promtail/defaults/main.yml b/playbooks/roles/promtail/defaults/main.yml deleted file mode 100644 index 1814d6a..0000000 --- a/playbooks/roles/promtail/defaults/main.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -promtail_directory: /opt/promtail -promtail_loki_url: http://grafana.internal.ansiblemiddleware.com:3100/loki/api/v1/push -promtail_job_name: default -promtail_logfile: /var/log/messages -promtail_region: us-east-1 -promtail_host: "{{ inventory_hostname }}" -promtail_version: 2.5.0 diff --git a/playbooks/roles/promtail/handlers/main.yml b/playbooks/roles/promtail/handlers/main.yml deleted file mode 100644 index c59b969..0000000 --- a/playbooks/roles/promtail/handlers/main.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -- name: Systemd reload - become: True - ansible.builtin.systemd: - daemon_reload: yes - -- name: Restart promtail - become: True - ansible.builtin.service: - name: promtail.service - state: restarted - enabled: yes diff --git a/playbooks/roles/promtail/meta/main.yml b/playbooks/roles/promtail/meta/main.yml deleted file mode 100644 index 9e4f5d8..0000000 --- a/playbooks/roles/promtail/meta/main.yml +++ /dev/null @@ -1,20 +0,0 @@ ---- -galaxy_info: - role_name: promtail - namespace: infra - author: Guido Grazioli, Ranabir Chakraborty - description: The role is used to setup and configure Promtail. - company: Red Hat - - license: Apache License 2.0 - - min_ansible_version: "2.14" - - galaxy_tags: - - java - - rhbk - - ansible - - datagrid - - promtail - -dependencies: [] diff --git a/playbooks/roles/promtail/tasks/main.yml b/playbooks/roles/promtail/tasks/main.yml deleted file mode 100644 index b58c0d1..0000000 --- a/playbooks/roles/promtail/tasks/main.yml +++ /dev/null @@ -1,64 +0,0 @@ ---- -- name: Ensure unzip is installed - ansible.builtin.include_role: - name: fastpackages - vars: - fastpackages_packages_list: - - unzip - -- name: Setup promtail data directory - become: True - ansible.builtin.file: - state: directory - dest: "{{ promtail_directory }}" - owner: root - group: root - mode: 0750 - -- name: Fetch promtail binary - become: True - ansible.builtin.get_url: - url: "https://github.com/grafana/loki/releases/download/v{{ promtail_version }}/promtail-linux-amd64.zip" - dest: "{{ promtail_directory }}/" - mode: 0750 - register: new_archive - -- name: Unarchive promtail - become: True - ansible.builtin.unarchive: - src: "{{ promtail_directory }}/promtail-linux-amd64.zip" - dest: "{{ promtail_directory }}/" - copy: no - when: new_archive.changed - notify: - - Restart promtail - -- name: Grant exec bit to promtail binary - become: True - ansible.builtin.file: - dest: "{{ promtail_directory }}/promtail-linux-amd64" - mode: a+x - when: new_archive.changed - -- name: Setup promtail systemd unit - become: True - ansible.builtin.template: - dest: "/etc/systemd/system/promtail.service" - src: promtail.service.j2 - owner: root - group: root - mode: 0444 - notify: - - Systemd reload - - Restart promtail - -- name: Configure promtail - become: True - ansible.builtin.template: - dest: '{{ promtail_directory }}/promtail.yml' - src: 'promtail.yml.j2' - owner: root - group: root - mode: 0440 - notify: - - Restart promtail diff --git a/playbooks/roles/promtail/templates/promtail.service.j2 b/playbooks/roles/promtail/templates/promtail.service.j2 deleted file mode 100644 index f0a02ca..0000000 --- a/playbooks/roles/promtail/templates/promtail.service.j2 +++ /dev/null @@ -1,19 +0,0 @@ -# {{ansible_managed}} - -[Unit] -Description=promtail service -After=network.target - -[Service] -Type=simple -WorkingDirectory={{ promtail_directory }} -ExecStartPre=/bin/sleep 3 -ExecStart={{ promtail_directory }}/promtail-linux-amd64 -config.file {{ promtail_directory }}/promtail.yml -SuccessExitStatus=143 -TimeoutStopSec=10 -Restart=on-failure -RestartSec=5 - -[Install] -WantedBy=multi-user.target - diff --git a/playbooks/roles/promtail/templates/promtail.yml.j2 b/playbooks/roles/promtail/templates/promtail.yml.j2 deleted file mode 100644 index 3f54758..0000000 --- a/playbooks/roles/promtail/templates/promtail.yml.j2 +++ /dev/null @@ -1,33 +0,0 @@ ---- -server: - http_listen_port: 28080 - grpc_listen_port: 0 - -positions: - filename: {{ promtail_directory }}/positions.yaml - -clients: - - url: {{ promtail_loki_url }} - -scrape_configs: - - job_name: {{ promtail_job_name }} - pipeline_stages: - - regex: - expression: '(?P\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}[,]\d{3}) (?P[A-Z]{4,8}) \[.*?\]( \(.*?\))? (?P[A-Z0-9]*): ' - - labels: - level: - code: - - timestamp: - source: timestamp - format: '2006-01-02 15:04:05,000' - - multiline: - firstline: '^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}[,]\d{3}' - max_wait_time: 3s - static_configs: - - targets: - - localhost - labels: - job: {{ promtail_job_name }} - __path__: {{ promtail_logfile }} - region: {{ promtail_region }} - host: {{ promtail_host }} diff --git a/roles/certificates/README.md b/roles/certificates/README.md index ed3c502..f90bb85 100644 --- a/roles/certificates/README.md +++ b/roles/certificates/README.md @@ -22,16 +22,11 @@ Role Variables -Dependencies ------------- - -* amazon.aws -* community.aws -* community.general - Example Playbook ---------------- +Available under `playbooks` directory + License ------- diff --git a/roles/fastpackages/README.md b/roles/fastpackages/README.md index 6d0bf2d..5ae76ff 100644 --- a/roles/fastpackages/README.md +++ b/roles/fastpackages/README.md @@ -18,14 +18,11 @@ Role Variables -Dependencies ------------- - -* community.general - Example Playbook ---------------- +Available under `playbooks` directory + License ------- diff --git a/roles/promtail/README.md b/roles/promtail/README.md index 35d30a0..71b9c5f 100644 --- a/roles/promtail/README.md +++ b/roles/promtail/README.md @@ -24,14 +24,11 @@ Role Variables -Dependencies ------------- - -* community.general - Example Playbook ---------------- +Available under `playbooks` directory + License ------- diff --git a/roles/roles b/roles/roles deleted file mode 120000 index 35e03fc..0000000 --- a/roles/roles +++ /dev/null @@ -1 +0,0 @@ -playbooks/roles \ No newline at end of file