diff --git a/.gitignore b/.gitignore index 79bb3c6..729c720 100644 --- a/.gitignore +++ b/.gitignore @@ -69,18 +69,34 @@ htmlcov/ .coverage *.cover +# ============================================================================= +# Python +# ============================================================================= +__pycache__/ +*.py[cod] +.venv/ +venv/ +.pytest_cache/ + +# ============================================================================= +# OpenTofu / Terraform +# ============================================================================= +.tofu/ +.tofu.lock +.terraform/ +.terraform.lock.hcl +*.tfstate +*.tfstate.backup +*.tfvars +*.tfvars.json +*.tfplan +*.tf.json + # ============================================================================= # MAINTAINER: Add language-specific patterns below # ============================================================================= # Examples: # -# Python: -# __pycache__/ -# *.py[cod] -# .venv/ -# venv/ -# .pytest_cache/ -# # Node.js: # node_modules/ # npm-debug.log diff --git a/hello-ansible/hello-ansible.yml b/hello-ansible/hello-ansible.yml new file mode 100644 index 0000000..842b492 --- /dev/null +++ b/hello-ansible/hello-ansible.yml @@ -0,0 +1,17 @@ +--- +- name: Hello World + hosts: localhost + connection: local + gather_facts: no + vars: + first_string: "Hello" + second_string: "World" + tasks: + - name: Print first string + ansible.builtin.debug: + msg: "{{ first_string }}" + + - name: Print second string + ansible.builtin.debug: + msg: "{{ second_string }}" +... diff --git a/hello-opentofu/hello-opentofu.tf b/hello-opentofu/hello-opentofu.tf new file mode 100644 index 0000000..a7f959d --- /dev/null +++ b/hello-opentofu/hello-opentofu.tf @@ -0,0 +1,33 @@ +variable "first_string" { + description = "The first string to display" + type = string + default = "Hello" +} + +variable "second_string" { + description = "The second string to display" + type = string + default = "World" +} + +resource "null_resource" "hello" { + provisioner "local-exec" { + command = "echo '${var.first_string}'" + } +} + +resource "null_resource" "world" { + provisioner "local-exec" { + command = "echo '${var.second_string}'" + } +} + +output "first_output" { + description = "The first string that was displayed" + value = var.first_string +} + +output "second_output" { + description = "The second string that was displayed" + value = var.second_string +} diff --git a/hello-python/hello-python.py b/hello-python/hello-python.py new file mode 100644 index 0000000..a9fd095 --- /dev/null +++ b/hello-python/hello-python.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python3 +import argparse + +def main(): + # Create argument parser to receive command-line arguments from iagctl + parser = argparse.ArgumentParser(description='Python hello world with two string variables') + parser.add_argument('--first_string', type=str, default='Hello', + help='First string to print') + parser.add_argument('--second_string', type=str, default='World', + help='Second string to print') + + # Parse the arguments + args = parser.parse_args() + + # Print the two strings + print(args.first_string) + print(args.second_string) + +if __name__ == "__main__": + main() diff --git a/import.yml b/import.yml new file mode 100644 index 0000000..47c62d2 --- /dev/null +++ b/import.yml @@ -0,0 +1,113 @@ +--- +repositories: + - name: hello-iagctl + description: Get started with iagctl + url: https://github.com/itential/hello-itential.git + reference: main + tags: + - demo + - iagctl + +services: + - name: hello-ansible + type: ansible-playbook + description: Ansible hello world with two string variables + # decorator: hello-ansible-decorator + working-directory: hello-ansible + playbooks: + - hello-ansible.yml + repository: hello-iagctl + tags: + - demo + - ansible + # Optional extra-vars for testing: + # first_string: First string to print (default: "Hello") + # second_string: Second string to print (default: "World") + # target_host: Target host (default: "127.0.0.1") + + - name: hello-python + type: python-script + description: Python hello world with two string variables + # decorator: hello-python-decorator + filename: hello-python.py + working-directory: hello-python + repository: hello-iagctl + tags: + - demo + - python + # Optional environment variables for testing: + # first_string: First string to print (default: "Hello") + # second_string: Second string to print (default: "World") + + - name: hello-opentofu + type: opentofu-plan + description: OpenTOFU hello world with two string variables + # decorator: hello-opentofu-decorator + working-directory: hello-opentofu + repository: hello-iagctl + tags: + - demo + - opentofu + # Optional variables for testing: + # first_string: First string to print (default: "Hello") + # second_string: Second string to print (default: "World") + +# decorators: +# - name: hello-ansible-decorator +# description: "Decorator for hello-ansible playbook with two string variables" +# schema: +# $id: "hello-ansible" +# $schema: "https://json-schema.org/draft/2020-12/schema" +# type: object +# properties: +# target_host: +# type: string +# description: "Target host for Ansible to connect to" +# default: "127.0.0.1" +# first_string: +# type: string +# description: "First string to print" +# default: "Hello" +# second_string: +# type: string +# description: "Second string to print" +# default: "World" +# required: [] +# additionalProperties: false + +# - name: hello-opentofu-decorator +# description: "Decorator for hello-opentofu with two string variables" +# schema: +# $id: "hello-opentofu" +# $schema: "https://json-schema.org/draft/2020-12/schema" +# type: object +# properties: +# first_string: +# type: string +# description: "First string to print" +# default: "Hello" +# second_string: +# type: string +# description: "Second string to print" +# default: "World" +# required: [] +# additionalProperties: false + +# - name: hello-python-decorator +# description: "Decorator for hello-python script with two string variables" +# schema: +# $id: "hello-python" +# $schema: "https://json-schema.org/draft/2020-12/schema" +# type: object +# properties: +# first_string: +# type: string +# description: "First string to print" +# default: "Hello" +# second_string: +# type: string +# description: "Second string to print" +# default: "World" +# required: [] +# additionalProperties: false +...