Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ansible-harness

Up and Running Harness Delegate via Ansible in less than a Minute🚀

This repository contains Ansible playbooks that'll create Delegate Token and download the Delegate K8S Manifest file by making API calls to Harness NG REST API. You can also use the existing Delegate Token to download the manifest file.

Requirements

  • ansible-core >= 2.12.0
  • kubernetes >= 12.0.0
  • jsonpatch
pip3 install --user ansible-core kubernetes jsonpatch
  • kubernetes.core Collection
ansible-galaxy collection install kubernetes.core
  • Create Harness API Key and PAT (Click here for details)

Dependencies

  • Python 3.9.0 or higher
  • Git

Repo Structure

  • tasks/
    • create_delegate_token.yml - Creates Delegate Token
    • download_delegate_k8s.yml - Downloads Delegate K8S Manifest file
    • deploy_delegate_on_k8s.yml - Deploys Delegate to K8S infra
  • vars/
    • config.yml - Required variables to authenticate and interact with the Harness NG API endpoint

Usage

  1. Clone this repo:
git clone https://github.com/Ompragash/deploy-delegate-via-ansible.git
cd deploy-delegate-via-ansible
  1. Use your favorite editor to open vars/config.yml and add Harness API PAT, Account Id, Org ID, Project ID, Delegate Token Name & Delegate Name values to respective variables.

  2. Time for AUTOMATION!!⚡️. Just run the below command:

ansible-playbook main.yml

The output of successful playbook run:

PLAY RECAP **************************************************************************
localhost                  : ok=7    changed=2    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
  1. Yayy! Harness Delegate K8S Manifest file is downloaded and available in manifests/harness-delegate.yml.

Additional Details

The playbooks in this repo are designed dynamically so if you don't want to create a new Delegate Token and use the existing one, then all you need is to get the delegate token id from Harness NG UI, add it to token_name: variable in vars/config.yml and run the below command:

ansible-playbook main.yml --skip-tags delegate_token

License

MIT License. See COPYING for more details.

Author Information

This playbook was created in 2022 by Ompragash.

About

Up and Running Harness Delegate via Ansible in less than a minute🚀

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages