Compare commits

..

42 Commits

Author SHA1 Message Date
Mike Holloway
16d5fe607d CI-CD debugging part I, see comment in diff 2025-01-06 19:57:29 -05:00
Mike Holloway
193c5485fe setup-opentofu action testing, part I 2025-01-06 19:49:35 -05:00
Mike Holloway
5bcc48a2b6 tofu instance import debug, vpc_subnet data parsing part II, (part I fb97fd0adf)
All checks were successful
Gitea Actions - molecule test work / Explore-terraform-molecule-Gitea-Action (push) Successful in 58s
2025-01-06 19:21:19 -05:00
Mike Holloway
fb97fd0adf tofu instance import debug, tofu state ls to investigate instance data parsing
All checks were successful
Gitea Actions - molecule test work / Explore-terraform-molecule-Gitea-Action (push) Successful in 56s
2025-01-06 19:02:50 -05:00
Mike Holloway
cb3017206b tofu instance import debug, tofu state show
All checks were successful
Gitea Actions - molecule test work / Explore-terraform-molecule-Gitea-Action (push) Successful in 57s
2025-01-06 18:48:42 -05:00
Mike Holloway
f8c1e31062 tofu instance data debug, tofu refresh, tofu show with chdir
All checks were successful
Gitea Actions - molecule test work / Explore-terraform-molecule-Gitea-Action (push) Successful in 59s
2025-01-06 18:44:12 -05:00
Mike Holloway
af9073354f tofu instance data debug, tofu refresh, tofu show
All checks were successful
Gitea Actions - molecule test work / Explore-terraform-molecule-Gitea-Action (push) Successful in 57s
2025-01-06 18:33:51 -05:00
Mike Holloway
604bbceaeb tofu instance data debug, tofu show, post-tofu state pull
All checks were successful
Gitea Actions - molecule test work / Explore-terraform-molecule-Gitea-Action (push) Successful in 55s
2025-01-06 18:31:51 -05:00
Mike Holloway
2a28432984 tofu instance data debug, correction - tofu state pull
All checks were successful
Gitea Actions - molecule test work / Explore-terraform-molecule-Gitea-Action (push) Successful in 57s
2025-01-06 18:28:05 -05:00
Mike Holloway
9c91ccca44 tofu instance data debug, tofu pull
Some checks failed
Gitea Actions - molecule test work / Explore-terraform-molecule-Gitea-Action (push) Failing after 54s
2025-01-06 18:26:10 -05:00
Mike Holloway
5f70f076cc tofu instance data debug, part II
All checks were successful
Gitea Actions - molecule test work / Explore-terraform-molecule-Gitea-Action (push) Successful in 54s
2025-01-06 18:23:57 -05:00
Mike Holloway
88f848cb20 tofu instance data debug, yaml format fix
All checks were successful
Gitea Actions - molecule test work / Explore-terraform-molecule-Gitea-Action (push) Successful in 55s
2025-01-06 18:21:06 -05:00
Mike Holloway
05751e3dbf tofu instance data debug
Some checks failed
Gitea Actions - molecule test work / Explore-terraform-molecule-Gitea-Action (push) Failing after 47s
2025-01-06 18:19:38 -05:00
Mike Holloway
f3306efb0f tofu import task cleanup
All checks were successful
Gitea Actions - molecule test work / Explore-terraform-molecule-Gitea-Action (push) Successful in 56s
2025-01-06 18:15:55 -05:00
Mike Holloway
f073fbd981 tofu import debug, quote enclusure for value pair expected by tofu import
Some checks failed
Gitea Actions - molecule test work / Explore-terraform-molecule-Gitea-Action (push) Failing after 52s
2025-01-06 18:12:18 -05:00
Mike Holloway
943553d4a6 tofu import debug
Some checks failed
Gitea Actions - molecule test work / Explore-terraform-molecule-Gitea-Action (push) Failing after 51s
2025-01-06 18:07:13 -05:00
Mike Holloway
188bf20236 gitea actions env: debug part V
All checks were successful
Gitea Actions - molecule test work / Explore-terraform-molecule-Gitea-Action (push) Successful in 55s
2025-01-06 17:59:26 -05:00
Mike Holloway
857fb87791 gitea actions env: debug part IV
Some checks failed
Gitea Actions - molecule test work / Explore-terraform-molecule-Gitea-Action (push) Failing after 49s
2025-01-06 17:57:50 -05:00
Mike Holloway
f019cf8c04 gitea actions env: debug part III
Some checks failed
Gitea Actions - molecule test work / Explore-terraform-molecule-Gitea-Action (push) Failing after 49s
2025-01-06 17:54:48 -05:00
Mike Holloway
eeea2d4485 gitea actions env: debug part II
Some checks failed
Gitea Actions - molecule test work / Explore-terraform-molecule-Gitea-Action (push) Failing after 50s
2025-01-06 17:52:11 -05:00
Mike Holloway
0c1d2a0de3 gitea actions env: debug
Some checks failed
Gitea Actions - molecule test work / Explore-terraform-molecule-Gitea-Action (push) Failing after 49s
2025-01-06 17:45:47 -05:00
Mike Holloway
ae0eb538e4 tofu project dir debug, TF_VAR testing
Some checks failed
Gitea Actions - molecule test work / Explore-terraform-molecule-Gitea-Action (push) Failing after 52s
2025-01-06 17:41:18 -05:00
Mike Holloway
d753983fb5 tofu project dir debug, tofu import
Some checks failed
Gitea Actions - molecule test work / Explore-terraform-molecule-Gitea-Action (push) Failing after 52s
2025-01-06 16:56:49 -05:00
Mike Holloway
17e4c288b8 tofu project dir debug, tofu init
All checks were successful
Gitea Actions - molecule test work / Explore-terraform-molecule-Gitea-Action (push) Successful in 53s
2025-01-06 16:38:50 -05:00
Mike Holloway
b1a396a3ba tofu project dir debug, $PWD, debug part VIII
Some checks failed
Gitea Actions - molecule test work / Explore-terraform-molecule-Gitea-Action (push) Failing after 49s
2025-01-06 16:04:41 -05:00
Mike Holloway
4e3f239259 tofu project dir debug, $PWD, debug part VII
All checks were successful
Gitea Actions - molecule test work / Explore-terraform-molecule-Gitea-Action (push) Successful in 51s
2025-01-06 16:02:32 -05:00
Mike Holloway
f5cd8f6491 tofu project dir debug, $PWD, debug part VI
All checks were successful
Gitea Actions - molecule test work / Explore-terraform-molecule-Gitea-Action (push) Successful in 50s
2025-01-06 15:59:50 -05:00
Mike Holloway
3dacc06c64 tofu project dir debug, $PWD, debug part V
Some checks failed
Gitea Actions - molecule test work / Explore-terraform-molecule-Gitea-Action (push) Failing after 47s
2025-01-06 15:57:21 -05:00
Mike Holloway
2572c7cb1a tofu project dir debug, $PWD, debug part IV
Some checks failed
Gitea Actions - molecule test work / Explore-terraform-molecule-Gitea-Action (push) Failing after 48s
2025-01-06 15:55:38 -05:00
Mike Holloway
6cbf0889d7 tofu project dir debug, $PWD, debug part III
Some checks failed
Gitea Actions - molecule test work / Explore-terraform-molecule-Gitea-Action (push) Failing after 50s
2025-01-06 07:17:33 -05:00
Mike Holloway
c29ad94601 tofu project dir debug, $PWD, debug part II
All checks were successful
Gitea Actions - molecule test work / Explore-terraform-molecule-Gitea-Action (push) Successful in 48s
2025-01-06 07:11:57 -05:00
Mike Holloway
756158ccdb tofu project dir debug, $PWD, debug
All checks were successful
Gitea Actions - molecule test work / Explore-terraform-molecule-Gitea-Action (push) Successful in 1m0s
2025-01-06 07:09:53 -05:00
Mike Holloway
248a5291b7 tofu project dir debug, $PWD
All checks were successful
Gitea Actions - molecule test work / Explore-terraform-molecule-Gitea-Action (push) Successful in 48s
2025-01-06 07:01:49 -05:00
Mike Holloway
01f16a40c4 tofu project dir debug, pwd
All checks were successful
Gitea Actions - molecule test work / Explore-terraform-molecule-Gitea-Action (push) Successful in 49s
2025-01-06 06:58:13 -05:00
Mike Holloway
e8d36340de tofu project dir debug
Some checks failed
Gitea Actions - molecule test work / Explore-terraform-molecule-Gitea-Action (push) Failing after 47s
2025-01-06 06:55:26 -05:00
Mike Holloway
f8696ae0c9 tofu import env vars part II
Some checks failed
Gitea Actions - molecule test work / Explore-terraform-molecule-Gitea-Action (push) Failing after 46s
2025-01-06 06:51:40 -05:00
Mike Holloway
9543799cc6 tofu import env vars
Some checks failed
Gitea Actions - molecule test work / Explore-terraform-molecule-Gitea-Action (push) Failing after 46s
2025-01-06 06:49:52 -05:00
Mike Holloway
003c6646d1 molecule test scenario flag
Some checks failed
Gitea Actions - molecule test work / Explore-terraform-molecule-Gitea-Action (push) Failing after 49s
2025-01-06 06:40:46 -05:00
Mike Holloway
ab623685fe ref correction
Some checks failed
Gitea Actions - molecule test work / Explore-terraform-molecule-Gitea-Action (push) Failing after 56s
2025-01-06 06:35:23 -05:00
Mike Holloway
1cdd3d4a9b Add .ssh/config mgmt step
Some checks failed
Gitea Actions - molecule test work / Explore-terraform-molecule-Gitea-Action (push) Failing after 1m6s
2025-01-06 06:31:30 -05:00
Mike Holloway
3bbfad68bd Update action conditions for demo.yml molecule scenario
Some checks failed
Gitea Actions - molecule test work / Explore-terraform-molecule-Gitea-Action (push) Failing after 1m0s
2025-01-06 06:25:01 -05:00
Mike Holloway
c8329a242b linode action yml test 2025-01-06 06:20:48 -05:00
10 changed files with 117 additions and 201 deletions

View File

@ -1,28 +0,0 @@
terraform {
required_providers {
linode = {
source = "linode/linode"
# version = "..."
}
}
}
# Configure the Linode Provider
provider "linode" {
token = var.token
}
resource "linode_instance" "eqit_test_instance" {
image = "linode/almalinux9"
label = "act_worker"
region = "us-ord"
type = "g6-nanode-1"
authorized_keys = ["ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCeRI1w3uNny7KjK2UdlAnyoGdGgtOx4isSD52u5dr4QkkdLRMj42dLjgT0MK+QehlgaH2XzFPMDz+hZQ+66YeBSm+F4km/8F9XVyUzGl0scUA1p0pqeL3FiyM3Art4Bo71zuE3PvMjyI3pGMKQ3VDWVA0XdAjjSw4G+czJTxZLLBPGvzDT07WuWM4Evl6H21Gn7PB6CKNV0vuUZwGiCsjRbghml1L2kDtTXV1B6wQsniuhQigIVo6YXhMgge/2UCcmiyeEizdfaSstrQHEyxFMvlPUJyw4a3plAuPORDyZdAFF6OA7/wP5fVWoCu/CkbMIDjPifXGQOuhQU1qUVy7r m00t@miserver.lan","ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINi1TmECeYdnrw8OCiBVB+rm8SwBWcz98Se/q+3l3iM/ act_runner@miserver.lan"]
root_pass = "supersecrettestpassword"
}
variable "token" {}
output "act_worker_ip_address" {
value = linode_instance.eqit_test_instance.ip_address
}

View File

@ -2,8 +2,8 @@ name: Gitea Actions - molecule test work
run-name: ${{ gitea.actor }} is running molecule test work
on:
push:
tags:
- 'molecule-test'
branches:
- molecule-test
jobs:
Explore-molecule-Gitea-Action:

View File

@ -9,28 +9,48 @@ jobs:
Explore-terraform-molecule-Gitea-Action:
env:
ANSIBLE_ROLES_PATH: '/workspace/seasharp/ansible-role_podman-host'
TF_VAR_token: "${{ secrets.LINODE_API_TOKEN }}"
TF_VAR_token: '3cc179bda24ac499f6d7ffbaa48d4a1def3f048483861d09d6cd9346e87e2b36'
TF_VAR_root_pass: 'supersecretpassword'
# ANSIBLE_REMOTE_TMP: '/root/.ansible/tmp/'
# Add comment for CI debug
EQIT_VPC: '136994'
EQIT_VPC_SUBNET: '131754'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
path: 'podman-host'
- uses: opentofu/setup-opentofu@v1
- name: tofu apply
run: "tofu init && tofu apply -auto-approve"
working-directory: "${{ gitea.workspace }}/podman-host/.gitea/tofu"
- name: Set up Python
uses: actions/setup-python@v2
- name: molecule test
continue-on-error: true
run: |
export TARGET_IP_ADDRESS=$(tofu output -raw act_worker_ip_address)
export ACT_RUNNER_DEPLOY_KEY="${{ secrets.ACT_RUNNER_DEPLOY_KEY }}"
cd ${{ gitea.workspace}}/podman-host/extensions
molecule test -s linode
working-directory: "${{ gitea.workspace }}/podman-host/.gitea/tofu"
- name: tofu destroy
run: "sleep 180 && tofu destroy -auto-approve"
working-directory: "${{ gitea.workspace }}/podman-host/.gitea/tofu"
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

@ -91,9 +91,9 @@
gather_facts: false
tasks:
- name: Package procps-ng
- name: Packages openssh-server, python3-policycoreutils
ansible.builtin.dnf:
name: procps-ng
name: ['openssh-server', 'python3-policycoreutils']
state: present
- name: systemd PID

View File

@ -9,7 +9,7 @@ driver:
ansible_connection: docker
platforms:
- name: instance
image: geerlingguy/docker-${MOLECULE_DISTRO:-rockylinux9}-ansible:latest
image: geerlingguy/docker-rockylinux9-ansible:latest
command: "/sbin/init"
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro

View File

@ -1,26 +1,8 @@
---
- name: Fail if linode group is missing
hosts: localhost
tasks:
- name: Print some info
ansible.builtin.debug:
msg: "{{ groups }}"
- name: Assert group existence
ansible.builtin.assert:
that: "'linode' in groups"
fail_msg: |
linode group was not found inside inventory groups: {{ groups }}
- name: Converge
hosts: linode
# We disable gather facts because it would fail due to our container not
# having python installed. This will not prevent use from running 'raw'
# commands. Most molecule users are expected to use containers that already
# have python installed in order to avoid notable delays installing it.
hosts: all
gather_facts: false
tasks:
- name: Apply podman-host Role
include_role:
name: podman-host
# ansible.builtin.assert:
# that: result.stdout | regex_search("^Linux")
- name: Replace this task with one that validates your content
ansible.builtin.debug:
msg: "This is the effective test"

View File

@ -4,110 +4,53 @@
connection: local
gather_facts: false
# no_log: "{{ molecule_no_log }}"
vars:
molecule_inventory:
all:
hosts: {}
linode: {}
tasks:
- name: ssh key setup
copy:
content: |
{{ lookup('env', 'ACT_RUNNER_DEPLOY_KEY') }}
dest: "~/.ssh/id_ed25519"
- name: ssh config setup
copy:
content: |
Host act_worker
Hostname {{ lookup('env', 'TARGET_IP_ADDRESS') }}
StrictHostKeyChecking accept-new
User root
IdentityFile ~/.ssh/id_ed25519
dest: "~/.ssh/config"
- name: Confirm we can reach
# TODO: Developer must implement and populate 'server' variable
- name: Import state into tofu
command:
cmd: |
ssh -vv -T act_worker
retries: 12
delay: 10
register: isping
until: isping.rc == 0
{{ 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: |
{{ isping }}
- name: Fail if instance is not running
when: isping.failed
fail:
- name: Add linode to molecule_inventory
vars:
inventory_partial_yaml: |
all:
children:
linode:
hosts:
act_worker:
ansible_connection: ssh
service_users:
- name: serviceuser1
services:
- service1
- service2
ansible.builtin.set_fact:
molecule_inventory: >
{{ molecule_inventory | combine(inventory_partial_yaml | from_yaml, recursive=true) }}
- name: Dump molecule_inventory
ansible.builtin.copy:
content: |
{{ molecule_inventory | to_yaml }}
dest: "{{ molecule_ephemeral_directory }}/inventory/molecule_inventory.yml"
mode: "0600"
- name: Force inventory refresh
ansible.builtin.meta: refresh_inventory
- name: Fail if linode group is missing
ansible.builtin.assert:
that: "'linode' in groups"
fail_msg: |
linode group was not found inside inventory groups: {{ groups }}
run_once: true # noqa: run-once[task]
# we want to avoid errors like "Failed to create temporary directory"
- name: Validate that inventory was refreshed
hosts: linode
gather_facts: false
tasks:
- name: Check uname
ansible.builtin.raw: uname -a
register: result
changed_when: false
- name: Display uname info
ansible.builtin.debug:
msg: "{{ result.stdout }}"
- name: Verify linode properties
hosts: linode
gather_facts: false
tasks:
- name: Package procps-ng
ansible.builtin.dnf:
name: procps-ng
state: present
- name: systemd PID
command: ps -q 1
register: ps_result
changed_when: false
- name: Display PID 1 info
ansible.builtin.debug:
msg: "{{ ps_result.stdout }}"
{{ 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

@ -5,11 +5,20 @@
gather_facts: false
# no_log: "{{ molecule_no_log }}"
tasks:
- name: Remove dynamic molecule inventory
hosts: localhost
gather_facts: false
tasks:
- name: Remove dynamic inventory file
ansible.builtin.file:
path: "{{ molecule_ephemeral_directory }}/inventory/molecule_inventory.yml"
state: absent # Developer must implement.
# 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

@ -1,2 +0,0 @@
collections:
- community.general

View File

@ -1,17 +1,8 @@
- import_tasks: include-vars.yml
- name: Install podman, podman networking plugins, and python support packages
vars:
dnf_packages:
- 'openssh-server'
- 'podman'
- 'podman-plugins'
- 'systemd-container'
- 'containernetworking-plugins'
- 'python3-pip'
- 'python3-policycoreutils'
dnf:
name: "{{ dnf_packages }}"
name: ['podman', 'containernetworking-plugins', 'podman-plugins', 'python3-pip', 'systemd-container']
state: present
- name: Install podman-compose pip Package
@ -30,7 +21,6 @@
- "{{ service_users }}"
- name: Create service folders
become: yes
become_user: "{{ item.0.name }}"
file:
path: "/home/{{ item.0.name }}/{{ item.1 }}"
@ -111,7 +101,8 @@
owner: root
group: root
mode: 0644
when: '"molecule" not in group_names'
tags:
- 'molecule-notest'
- lineinfile:
path: /etc/hosts
@ -120,7 +111,8 @@
owner: root
group: root
mode: 0644
when: '"molecule" not in group_names'
tags:
- 'molecule-notest'
# - name: Copy cni networking driver config into place
# blockinfile:
# name: "/etc/cni/net.d/podman.conflist"