linode action yml test

This commit is contained in:
Mike Holloway 2025-01-06 06:20:48 -05:00
parent f51c228573
commit c8329a242b
5 changed files with 133 additions and 0 deletions

View File

@ -0,0 +1,53 @@
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'
# ANSIBLE_REMOTE_TMP: '/root/.ansible/tmp/'
runs-on: ubuntu-latest
steps:
- name: tofu install
run: |
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://get.opentofu.org/opentofu.gpg | sudo tee /etc/apt/keyrings/opentofu.gpg >/dev/null
curl -fsSL https://packages.opentofu.org/opentofu/tofu/gpgkey | sudo gpg --no-tty --batch --dearmor -o /etc/apt/keyrings/opentofu-repo.gpg >/dev/null
chmod a+r /etc/apt/keyrings/opentofu.gpg /etc/apt/keyrings/opentofu-repo.gpg
echo "deb [signed-by=/etc/apt/keyrings/opentofu.gpg,/etc/apt/keyrings/opentofu-repo.gpg] https://packages.opentofu.org/opentofu/tofu/any/ any main
deb-src [signed-by=/etc/apt/keyrings/opentofu.gpg,/etc/apt/keyrings/opentofu-repo.gpg] https://packages.opentofu.org/opentofu/tofu/any/ any main" | tee /etc/apt/sources.list.d/opentofu.list > /dev/null
chmod a+r /etc/apt/sources.list.d/opentofu.list
apt-get update
apt-get install -y tofu
- name: tofu Checkout
uses: actions/checkout@v4
with:
repository: 'seasharp/eqit_tofu-plan'
ref: 'refs/heads/master'
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 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,40 @@
---
- 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: |
cd ../../../../tofu
tofu import module.main_vpc_subnet.linode_vpc.eqit_vpc {{ eqit_vpc }}
tofu import module.main_vpc_subnet.linode_vpc_subnet.eqit_vpc_subnet {{ eqit_vpc }}, {{ eqit_vpc_subnet }}
# - 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