Simple single-target tofu build is the goal
All checks were successful
Gitea Actions - molecule test work / Explore-molecule-Gitea-Action (push) Successful in 2m56s

This commit is contained in:
Mike Holloway 2025-01-07 02:34:38 -05:00
parent f51c228573
commit b2b2c319bb
5 changed files with 146 additions and 0 deletions

View File

@ -0,0 +1,50 @@
name: Gitea Actions - molecule test work
run-name: ${{ gitea.actor }} is running molecule test work
on:
push:
tags:
- 'linode-test'
jobs:
Explore-terraform-molecule-Gitea-Action:
# env:
# ANSIBLE_ROLES_PATH: '/workspace/seasharp/ansible-role_podman-host'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: opentofu/setup-opentofu@v1
run:
working-directory: '${{ env.tf_actions_working_dir }}'
# - name: Update ssh config
# run: |
# umask 077
# mkdir .ssh
# echo -e "Host git.libre.audio\n Port 2222" >> ~/.ssh/config
# - name: tofu Checkout
# uses: actions/checkout@v4
# with:
# repository: 'seasharp/eqit_tofu-plan'
# ref: 'refs/heads/main'
# path: 'tofu'
# ssh-key: |-
# -----BEGIN OPENSSH PRIVATE KEY-----
# b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
# QyNTUxOQAAACCrwBEqzNuM0VFHpy9bBprXebPnu6oZFBfucpT1k3Bv8gAAAJh9CogdfQqI
# HQAAAAtzc2gtZWQyNTUxOQAAACCrwBEqzNuM0VFHpy9bBprXebPnu6oZFBfucpT1k3Bv8g
# AAAECnSrigm9ALsWTb6RnDhDFV/nViuPK1jzoE+FAmrwYfdavAESrM24zRUUenL1sGmtd5
# s+e7qhkUF+5ylPWTcG/yAAAAEW0wMHRAbWlzZXJ2ZXIubGFuAQIDBA==
# -----END OPENSSH PRIVATE KEY-----
# ssh-known-hosts: |
# git.libre.audio ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFLiDhNN7aPdGUt8gvvAftF5Oo3xwsy/JcT9gcX00BDW
# [git.libre.audio]:2222 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFLiDhNN7aPdGUt8gvvAftF5Oo3xwsy/JcT9gcX00BDW
#
# - name: Project Checkout
# uses: actions/checkout@v4
# with:
# path: 'podman-host'
# - name: Set up Python
# uses: actions/setup-python@v2
# - name: Molecule test
# run: |
# cd podman-host/extensions
# molecule test -s linode

View File

@ -0,0 +1,8 @@
---
- name: Converge
hosts: all
gather_facts: false
tasks:
- name: Replace this task with one that validates your content
ansible.builtin.debug:
msg: "This is the effective test"

View File

@ -0,0 +1,56 @@
---
- name: Create
hosts: localhost
connection: local
gather_facts: false
# no_log: "{{ molecule_no_log }}"
tasks:
# TODO: Developer must implement and populate 'server' variable
- name: Import state into tofu
command:
cmd: |
{{ item }}
chdir: "/workspace/seasharp/ansible-role_podman-host/tofu"
loop:
- tofu init
- tofu import module.main_vpc_subnet.linode_vpc.eqit_vpc {{ lookup('env', 'EQIT_VPC') }}
- tofu import module.main_vpc_subnet.linode_vpc_subnet.eqit_vpc_subnet "{{ lookup('env', 'EQIT_VPC') }}, {{ lookup('env', 'EQIT_VPC_SUBNET') }}"
- tofu refresh
- name: Tofu show
command:
cmd: |
tofu state ls
chdir: "/workspace/seasharp/ansible-role_podman-host/tofu"
register: mycmd
## grep names from subnet data
## tofu import module.instance
- debug:
msg: |
{{ mycmd.stdout_lines }}
# - name: Create instance config
# when: server.changed | default(false) | bool # noqa no-handler
# block:
# - name: Populate instance config dict # noqa jinja
# ansible.builtin.set_fact:
# instance_conf_dict: {}
# # instance': "{{ }}",
# # address': "{{ }}",
# # user': "{{ }}",
# # port': "{{ }}",
# # 'identity_file': "{{ }}", }
# with_items: "{{ server.results }}"
# register: instance_config_dict
#
# - name: Convert instance config dict to a list
# ansible.builtin.set_fact:
# instance_conf: "{{ instance_config_dict.results | map(attribute='ansible_facts.instance_conf_dict') | list }}"
#
# - name: Dump instance config
# ansible.builtin.copy:
# content: |
# # Molecule managed
#
# {{ instance_conf | to_json | from_json | to_yaml }}
# dest: "{{ molecule_instance_config }}"
# mode: "0600"

View File

@ -0,0 +1,24 @@
---
- name: Destroy
hosts: localhost
connection: local
gather_facts: false
# no_log: "{{ molecule_no_log }}"
tasks:
# Developer must implement.
# Mandatory configuration for Molecule to function.
- name: Populate instance config
ansible.builtin.set_fact:
instance_conf: {}
- name: Dump instance config
ansible.builtin.copy:
content: |
# Molecule managed
{{ instance_conf | to_json | from_json | to_yaml }}
dest: "{{ molecule_instance_config }}"
mode: "0600"
when: server.changed | default(false) | bool # noqa no-handler

View File

@ -0,0 +1,8 @@
---
driver:
name: default
platforms:
- name: instance
# you might want to add your own variables here based on what provisioning
# you are doing like:
# image: quay.io/centos/centos:stream8