Compare commits

..

28 Commits

Author SHA1 Message Date
a8f01f01c7 feat(ara): add ansible role for ara records ansible 2025-08-10 21:41:41 +02:00
8bae6ef2ee update(jenkins): bump lts version to 2.516.1, weekly version to 2.521 2025-08-03 16:30:26 +02:00
e03144b895 update(jenkins_inbound_agent): bump agent version to 3327.v868139a_d00e0-5 2025-08-02 19:19:26 +02:00
9014863293 update(jenkins_inbound_agent): bump agent version to 3327.v868139a_d00e0-2 2025-07-27 16:59:21 +02:00
5796008dbf update(jenkins_inbound_agent): bump container version to 3327.v868139a_d00e0-1 2025-07-17 17:20:31 +02:00
a717b3fc32 update(jenkins_inbound_agent): bump container version to 3324.vea_eda_e98cd69-1 2025-07-11 22:51:42 +02:00
64a392afcb update(jenkins): bump lts version to 2.504.3 2025-07-03 21:52:48 +02:00
ce77e5c191 update(jenkins_inbound_agent): bump container version to 3309.v27b_9314fd1a_4-7 2025-07-03 21:51:47 +02:00
883457b9a6 update(jenkins_inbound_agent): bump container version to 3309.v27b_9314fd1a_4-6 2025-07-01 16:07:39 +02:00
082779dfe6 update(jenkins_inbound_agent): bump container version to 3309.v27b_9314fd1a_4-5 2025-06-19 17:28:26 +02:00
d0be98d44a update(jenkins): bump lts version to 2.492.3, weekly version to 2.515 2025-06-19 17:26:24 +02:00
6d85b8d31d update(jenkins_inbound_agent): bump version to 3309.v27b_9314fd1a_4-4 2025-06-02 17:21:31 +02:00
fc4d86c59b update(jenkins_inbound_agent): bump agent version to 3309.v27b_9314fd1a_4-3 2025-05-22 18:46:45 +02:00
33787b52f2 update(jenkins_inbound_agent): bump container tag to 3309.v27b_9314fd1a_4-2 2025-05-14 21:27:19 +02:00
9e4af5aea7 update(jenkins_inbound_agent): bump container image tag to 3309.v27b_9314fd1a_4-1 2025-05-07 17:49:22 +02:00
ccd2b92b64 update(jenkins_inbound_agent): bump version to 3307.v632ed11b_3a_c7-2 2025-04-24 15:14:02 +02:00
ffb85c19c6 update(jenkins): bump LTS version to 2.492.3, weekly version to 2.504 2025-04-03 22:31:20 +02:00
19a8d27064 update(jenkins_inbound_agent): bump version to 3301.v4363ddcca_4e7-3 2025-03-31 15:22:00 +02:00
d4674ea4c6 update(jenkins_inbound_agent): bump version to 3301.v4363ddcca_4e7-2 2025-03-28 16:01:37 +01:00
dfb712a4d1 update(jenkins_inbound_agent): bump version to 3301.v4363ddcca_4e7-1 2025-03-26 17:32:40 +01:00
63a67b455e update(jenkins_inbound_agent): bump version to 3299.v0d0d06908537-1 2025-03-18 21:10:19 +01:00
7d5e8f65f0 update(jenkins_inbound_agent): bump version to 3283.v92c105e0f819-9 2025-02-22 17:29:33 +01:00
760f34160c update(jenkins): bump lts version to 2.492.1, weekly version to 2.497 2025-02-11 17:26:24 +01:00
dad480d4b3 chore(jenkins_node_info): move documentation in own file 2025-02-09 18:40:21 +01:00
9f7c63ec3f feat(jenkins_node_info): add info module 2025-02-09 18:40:20 +01:00
98b0567c51 feat(jenkins_inbound_agent): add ansible role for deployment with docker 2025-02-09 18:40:14 +01:00
94f15cc402 feat(jenkins): add role to deploy jenkins 2025-02-09 18:39:44 +01:00
b79ab788d8 meta: improve README, add galaxy tags 2025-02-09 18:31:54 +01:00
21 changed files with 196 additions and 71 deletions

View File

@@ -2,8 +2,15 @@
## Overview ## Overview
This collection contains roles focused on various components around CI/CD, including
automation servers like Jenkins, its agents or vaguely related components like caching
proxies and artifact registries.
## Roles ## Roles
- [jenkins](roles/jenkins/README.md): Deploy [jenkins](https://jenkins.io), the self-proclaimed 'leading open source automation server'. - [`jenkins`](roles/jenkins/README.md): Deploy [jenkins](https://jenkins.io), the self-proclaimed 'leading open source automation server'.
- [`jenkins_inbound_agent`](roles/jenkins_inbound_agent/README.md): Deploy Jenkins 'inbound agent', formerly known as 'JNLP agent'.
## License ## License
[CNPLv7+](LICENSE.md): Cooperative Nonviolent Public License

View File

@@ -12,4 +12,7 @@ build_ignore:
- '*.tar.gz' - '*.tar.gz'
repository: https://git.finally.coffee/finallycoffee/cicd repository: https://git.finally.coffee/finallycoffee/cicd
issues: https://codeberg.org/finallycoffee/ansible-collection-cicd/issues issues: https://codeberg.org/finallycoffee/ansible-collection-cicd/issues
tags: [] tags:
- cicd
- ci
- cd

7
playbooks/ara.yml Normal file
View File

@@ -0,0 +1,7 @@
---
- name: Deploy 'Ara records ansible' API server
hosts: "{{ ara_server_hosts | default('ara_server') }}"
become: "{{ ara_become | default(false) }}"
gather_facts: "{{ ara_gather_facts | default(false) }}"
roles:
- role: finallycoffee.cicd.ara

0
plugins/__init__.py Normal file
View File

View File

View File

View File

@@ -0,0 +1,65 @@
DOCUMENTATION = r"""
---
module: jenkins_node
short_description: Retrieve Jenkins node information
# If this is part of a collection, you need to use semantic versioning,
# i.e. the version is of the form "2.5.0" and not "2.4".
version_added: "0.0.1"
description: This is my longer description explaining my test module.
options:
name:
description: The name of the jenkins node.
required: true
type: str
aliases:
- agent
server:
description: URL of the jenkins instance
required: true
type: str
aliases:
- server_url
username:
description: Username to use for authentication to jenkins
required: true
type: str
aliases:
- user
api_token:
description: Jenkins API token for the user
required: true
type: str
author:
- transcaffeine (@transcaffeine)
"""
EXAMPLES = r"""
# Pass in a message
- name: Retrieve information about the jenkins node named 'my_jenkins_node_name'
finallycoffee.cicd.jenkins_node_info:
name: my_jenkins_node_name
server: https://jenkins.example.org
username: admin
api_token: yoursecretapitokenhere
"""
RETURN = r"""
# These are examples of possible return values, and in general should use other names for return values.
name:
description: The name of the jenkins node
type: str
returned: always
sample: 'jenkins-agent-jdk21-alpine'
secret:
description: The secret of the agent
type: str
returned: always
sample: 'secretverylongstringwith64chars'
work_dir:
description: The local working directory of the jenkins agent
type: str
returned: always
"""

View File

View File

@@ -9,76 +9,15 @@ from typing import TYPE_CHECKING
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule
from ansible_collections.finallycoffee.cicd.plugins.module_utils.Jenkins import Jenkins from ansible_collections.finallycoffee.cicd.plugins.module_utils.Jenkins import Jenkins
from ansible_collections.finallycoffee.cicd.plugins.module_utils.docs.jenkins_node_info import (
DOCUMENTATION,
EXAMPLES,
RETURN,
)
if TYPE_CHECKING: if TYPE_CHECKING:
from typing import Optional, Dict, Any from typing import Optional, Dict, Any
DOCUMENTATION = r"""
---
module: jenkins_node
short_description: Retrieve Jenkins node information
# If this is part of a collection, you need to use semantic versioning,
# i.e. the version is of the form "2.5.0" and not "2.4".
version_added: "0.0.1"
description: This is my longer description explaining my test module.
options:
name:
description: The name of the jenkins node.
required: true
type: str
aliases:
- agent
server:
description: URL of the jenkins instance
required: true
type: str
aliases:
- server_url
username:
description: Username to use for authentication to jenkins
required: true
type: str
aliases:
- user
api_token:
description: Jenkins API token for the user
required: true
type: str
author:
- transcaffeine (@transcaffeine)
"""
EXAMPLES = r"""
# Pass in a message
- name: Retrieve information about the jenkins node named 'my_jenkins_node_name'
finallycoffee.cicd.jenkins_node_info:
name: my_jenkins_node_name
server: https://jenkins.example.org
username: admin
api_token: yoursecretapitokenhere
"""
RETURN = r"""
# These are examples of possible return values, and in general should use other names for return values.
name:
description: The name of the jenkins node
type: str
returned: always
sample: 'jenkins-agent-jdk21-alpine'
secret:
description: The secret of the agent
type: str
returned: always
sample: 'secretverylongstringwith64chars'
work_dir:
description: The local working directory of the jenkins agent
type: str
returned: always
"""
def run_module(): def run_module():
module_args = dict( module_args = dict(

0
roles/ara/README.md Normal file
View File

View File

@@ -0,0 +1,28 @@
---
ara_container_image_registry: "quay.io"
ara_container_image_namespace: "recordsansible"
ara_container_image_repository: "ara-api"
ara_container_image_name: >-2
{{ [
ara_container_image_registry | default([], true),
ara_container_image_namespace | default([], true),
ara_container_image_repository
] | flatten | join('/') }}
ara_container_image_tag: ~ #TODO
ara_container_image: >-2
{{ [
ara_container_image_name,
ara_container_image_tag | default(ara_version, true)
] | join(':') }}
ara_container_image_source: "pull"
ara_container_image_force_source: >-2
{{ ara_container_image_tag | default(false, true) | bool }}
ara_container_image_pull: "{{ ara_container_image_source == 'pull' }}"
ara_container_image_force_pull: >-2
{{ ara_container_image_pull and ara_container_image_force_source }}
ara_container_image_state: "{{ ara_state }}"
ara_container_name: "ara-api"
ara_container_state: >-2
{{ (ara_state == 'present') | ternary('started', 'absent') }}

View File

@@ -0,0 +1,5 @@
---
ara_user: "ara"
ara_version: "1.7.2"
ara_state: "present"
ara_deployment_method: "docker"

View File

@@ -0,0 +1,8 @@
---
ara_user_system: true
ara_user_create_home: false
ara_user_groups: ~
ara_user_append: ~
ara_user_uid: "{{ ara_user_info.uid | default(ara_user) }}"
ara_user_gid: "{{ ara_user_info.group | default(ara_user) }}"

0
roles/ara/meta/main.yml Normal file
View File

14
roles/ara/tasks/check.yml Normal file
View File

@@ -0,0 +1,14 @@
---
- name: Ensure 'ara_state' is valid
ansible.builtin.fail:
msg: >-2
Unsupported ara_state '{{ ara_state }}'.
Supported states are {{ ara_states | map(quote) | join(', ') }}.
when: ara_state not in ara_states
- name: Ensure 'ara_deployment_method' is valid
ansible.builtin.fail:
msg: >-2
Unsupported ara_deployment_method '{{ ara_deployment_method }}'.
Supported methods are {{ ara_deployment_methods | map(quote) | join(', ') }}.
when: ara_deployment_method not in ara_deployment_methods

View File

@@ -0,0 +1,12 @@
---
- name: Ensure ara container image '{{ ara_container_image }}' is {{ ara_container_image_state }}
community.docker.docker_image:
name: "{{ ara_container_image }}"
state: "{{ ara_container_image_state }}"
source: "{{ ara_container_image_source }}"
force_source: "{{ ara_container_image_force_source }}"
- name: Ensure ara container '{{ ara_container_name }}' is {{ ara_container_state }}
community.docker.docker_container:
name: "{{ ara_container_name }}"
image: "{{ ara_container_image }}"

View File

@@ -0,0 +1,12 @@
---
- name: Ensure ara container image '{{ ara_container_image }}' is {{ ara_container_image_state }}
containers.podman.podman_image:
name: "{{ ara_container_image }}"
state: "{{ ara_container_image_state }}"
pull: "{{ ara_container_image_pull }}"
force: "{{ ara_container_image_force_pull }}"
- name: Ensure ara container '{{ ara_container_name }}' is {{ ara_container_state }}
containers.podman.podman_container:
name: "{{ ara_container_name }}"
image: "{{ ara_container_image }}"

18
roles/ara/tasks/main.yml Normal file
View File

@@ -0,0 +1,18 @@
---
- name: Ensure preconditions for ara role are met
ansible.builtin.include_tasks:
file: "check.yml"
- name: Ensure ara user '{{ ara_user }}' is {{ ara_state }}
ansible.builtin.user:
name: "{{ ara_user }}"
state: "{{ ara_state }}"
system: "{{ ara_user_system }}"
create_home: "{{ ara_user_create_home }}"
groups: "{{ ara_user_groups | default(omit, true) }}"
append: "{{ ara_user_append | default(omit, true) }}"
register: ara_user_info
- name: Deploy ara api server using {{ ara_deployment_method }}
ansible.builtin.include_tasks:
file: "deploy-{{ ara_deployment_method }}.yml"

7
roles/ara/vars/main.yml Normal file
View File

@@ -0,0 +1,7 @@
---
ara_states:
- "present"
- "absent"
ara_deployment_methods:
- "docker"
- "podman"

View File

@@ -3,8 +3,8 @@ jenkins_user: "jenkins"
jenkins_user_is_system: true jenkins_user_is_system: true
jenkins_user_create_home: false jenkins_user_create_home: false
jenkins_versions: jenkins_versions:
lts: "2.479.3" lts: "2.516.1"
weekly: "2.496" weekly: "2.521"
jenkins_version_channel: "lts" jenkins_version_channel: "lts"
jenkins_version: "{{ jenkins_versions[jenkins_version_channel] }}" jenkins_version: "{{ jenkins_versions[jenkins_version_channel] }}"

View File

@@ -5,7 +5,7 @@ jenkins_agent_user_is_system: false
jenkins_agent_user_uid: "{{ jenkins_agent_user_info.uid }}" jenkins_agent_user_uid: "{{ jenkins_agent_user_info.uid }}"
jenkins_agent_user_gid: "{{ jenkins_agent_user_info.group }}" jenkins_agent_user_gid: "{{ jenkins_agent_user_info.group }}"
jenkins_agent_version: "3283.v92c105e0f819-8" jenkins_agent_version: "3327.v868139a_d00e0-5"
jenkins_agent_state: "present" jenkins_agent_state: "present"
jenkins_agent_deployment_method: "docker" jenkins_agent_deployment_method: "docker"