Compare commits

..

3 Commits

10 changed files with 73 additions and 87 deletions

View File

@ -2,15 +2,8 @@
## 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,7 +12,4 @@ 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

View File

View File

@ -1,65 +0,0 @@
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

@ -9,20 +9,81 @@ 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(
name=dict(type="str", required=True, aliases=["node", "node_name"]), name=dict(type="str", required=True, aliases=["node"]),
server=dict(type="str", required=True, aliases=["server_url", "url"]), server=dict(type="str", required=True, aliases=["server_url"]),
username=dict(type="str", required=True, aliases=["user"]), username=dict(type="str", required=True, aliases=["user"]),
api_token=dict(type="str", required=True, aliases=["password", "pass"]), api_token=dict(type="str", required=True, aliases=["password", "pass"]),
) )

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.492.3" lts: "2.479.3"
weekly: "2.504" weekly: "2.496"
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: "3309.v27b_9314fd1a_4-4" jenkins_agent_version: "3283.v92c105e0f819-8"
jenkins_agent_state: "present" jenkins_agent_state: "present"
jenkins_agent_deployment_method: "docker" jenkins_agent_deployment_method: "docker"