Compare commits
42
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
16d5fe607d | ||
|
|
193c5485fe | ||
|
|
5bcc48a2b6 | ||
|
|
fb97fd0adf | ||
|
|
cb3017206b | ||
|
|
f8c1e31062 | ||
|
|
af9073354f | ||
|
|
604bbceaeb | ||
|
|
2a28432984 | ||
|
|
9c91ccca44 | ||
|
|
5f70f076cc | ||
|
|
88f848cb20 | ||
|
|
05751e3dbf | ||
|
|
f3306efb0f | ||
|
|
f073fbd981 | ||
|
|
943553d4a6 | ||
|
|
188bf20236 | ||
|
|
857fb87791 | ||
|
|
f019cf8c04 | ||
|
|
eeea2d4485 | ||
|
|
0c1d2a0de3 | ||
|
|
ae0eb538e4 | ||
|
|
d753983fb5 | ||
|
|
17e4c288b8 | ||
|
|
b1a396a3ba | ||
|
|
4e3f239259 | ||
|
|
f5cd8f6491 | ||
|
|
3dacc06c64 | ||
|
|
2572c7cb1a | ||
|
|
6cbf0889d7 | ||
|
|
c29ad94601 | ||
|
|
756158ccdb | ||
|
|
248a5291b7 | ||
|
|
01f16a40c4 | ||
|
|
e8d36340de | ||
|
|
f8696ae0c9 | ||
|
|
9543799cc6 | ||
|
|
003c6646d1 | ||
|
|
ab623685fe | ||
|
|
1cdd3d4a9b | ||
|
|
3bbfad68bd | ||
|
|
c8329a242b |
No files matched your search
@@ -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
|
|
||||||
}
|
|
||||||
@@ -2,8 +2,8 @@ name: Gitea Actions - molecule test work
|
|||||||
run-name: ${{ gitea.actor }} is running molecule test work
|
run-name: ${{ gitea.actor }} is running molecule test work
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
branches:
|
||||||
- 'molecule-test'
|
- molecule-test
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Explore-molecule-Gitea-Action:
|
Explore-molecule-Gitea-Action:
|
||||||
|
|||||||
+41
-21
@@ -9,28 +9,48 @@ jobs:
|
|||||||
Explore-terraform-molecule-Gitea-Action:
|
Explore-terraform-molecule-Gitea-Action:
|
||||||
env:
|
env:
|
||||||
ANSIBLE_ROLES_PATH: '/workspace/seasharp/ansible-role_podman-host'
|
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
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
|
||||||
path: 'podman-host'
|
|
||||||
- uses: opentofu/setup-opentofu@v1
|
- uses: opentofu/setup-opentofu@v1
|
||||||
- name: tofu apply
|
run:
|
||||||
run: "tofu init && tofu apply -auto-approve"
|
working-directory: '${{ env.tf_actions_working_dir }}'
|
||||||
working-directory: "${{ gitea.workspace }}/podman-host/.gitea/tofu"
|
# - name: Update ssh config
|
||||||
- name: Set up Python
|
# run: |
|
||||||
uses: actions/setup-python@v2
|
# umask 077
|
||||||
- name: molecule test
|
# mkdir .ssh
|
||||||
continue-on-error: true
|
# echo -e "Host git.libre.audio\n Port 2222" >> ~/.ssh/config
|
||||||
run: |
|
# - name: tofu Checkout
|
||||||
export TARGET_IP_ADDRESS=$(tofu output -raw act_worker_ip_address)
|
# uses: actions/checkout@v4
|
||||||
export ACT_RUNNER_DEPLOY_KEY="${{ secrets.ACT_RUNNER_DEPLOY_KEY }}"
|
# with:
|
||||||
cd ${{ gitea.workspace}}/podman-host/extensions
|
# repository: 'seasharp/eqit_tofu-plan'
|
||||||
molecule test -s linode
|
# ref: 'refs/heads/main'
|
||||||
working-directory: "${{ gitea.workspace }}/podman-host/.gitea/tofu"
|
# path: 'tofu'
|
||||||
- name: tofu destroy
|
# ssh-key: |-
|
||||||
run: "sleep 180 && tofu destroy -auto-approve"
|
# -----BEGIN OPENSSH PRIVATE KEY-----
|
||||||
working-directory: "${{ gitea.workspace }}/podman-host/.gitea/tofu"
|
# 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
|
||||||
@@ -91,9 +91,9 @@
|
|||||||
gather_facts: false
|
gather_facts: false
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Package procps-ng
|
- name: Packages openssh-server, python3-policycoreutils
|
||||||
ansible.builtin.dnf:
|
ansible.builtin.dnf:
|
||||||
name: procps-ng
|
name: ['openssh-server', 'python3-policycoreutils']
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: systemd PID
|
- name: systemd PID
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ driver:
|
|||||||
ansible_connection: docker
|
ansible_connection: docker
|
||||||
platforms:
|
platforms:
|
||||||
- name: instance
|
- name: instance
|
||||||
image: geerlingguy/docker-${MOLECULE_DISTRO:-rockylinux9}-ansible:latest
|
image: geerlingguy/docker-rockylinux9-ansible:latest
|
||||||
command: "/sbin/init"
|
command: "/sbin/init"
|
||||||
volumes:
|
volumes:
|
||||||
- /sys/fs/cgroup:/sys/fs/cgroup:ro
|
- /sys/fs/cgroup:/sys/fs/cgroup:ro
|
||||||
|
|||||||
@@ -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
|
- name: Converge
|
||||||
hosts: linode
|
hosts: all
|
||||||
# We disable gather facts because it would fail due to our container not
|
gather_facts: false
|
||||||
# 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.
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Apply podman-host Role
|
- name: Replace this task with one that validates your content
|
||||||
include_role:
|
ansible.builtin.debug:
|
||||||
name: podman-host
|
msg: "This is the effective test"
|
||||||
# ansible.builtin.assert:
|
|
||||||
# that: result.stdout | regex_search("^Linux")
|
|
||||||
@@ -4,110 +4,53 @@
|
|||||||
connection: local
|
connection: local
|
||||||
gather_facts: false
|
gather_facts: false
|
||||||
# no_log: "{{ molecule_no_log }}"
|
# no_log: "{{ molecule_no_log }}"
|
||||||
vars:
|
|
||||||
molecule_inventory:
|
|
||||||
all:
|
|
||||||
hosts: {}
|
|
||||||
linode: {}
|
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: ssh key setup
|
# TODO: Developer must implement and populate 'server' variable
|
||||||
copy:
|
- name: Import state into tofu
|
||||||
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
|
|
||||||
command:
|
command:
|
||||||
cmd: |
|
cmd: |
|
||||||
ssh -vv -T act_worker
|
{{ item }}
|
||||||
retries: 12
|
chdir: "/workspace/seasharp/ansible-role_podman-host/tofu"
|
||||||
delay: 10
|
loop:
|
||||||
register: isping
|
- tofu init
|
||||||
until: isping.rc == 0
|
- 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:
|
- debug:
|
||||||
msg: |
|
msg: |
|
||||||
{{ isping }}
|
{{ mycmd.stdout_lines }}
|
||||||
|
# - name: Create instance config
|
||||||
- name: Fail if instance is not running
|
# when: server.changed | default(false) | bool # noqa no-handler
|
||||||
when: isping.failed
|
# block:
|
||||||
fail:
|
# - name: Populate instance config dict # noqa jinja
|
||||||
|
# ansible.builtin.set_fact:
|
||||||
- name: Add linode to molecule_inventory
|
# instance_conf_dict: {}
|
||||||
vars:
|
# # instance': "{{ }}",
|
||||||
inventory_partial_yaml: |
|
# # address': "{{ }}",
|
||||||
all:
|
# # user': "{{ }}",
|
||||||
children:
|
# # port': "{{ }}",
|
||||||
linode:
|
# # 'identity_file': "{{ }}", }
|
||||||
hosts:
|
# with_items: "{{ server.results }}"
|
||||||
act_worker:
|
# register: instance_config_dict
|
||||||
ansible_connection: ssh
|
#
|
||||||
service_users:
|
# - name: Convert instance config dict to a list
|
||||||
- name: serviceuser1
|
# ansible.builtin.set_fact:
|
||||||
services:
|
# instance_conf: "{{ instance_config_dict.results | map(attribute='ansible_facts.instance_conf_dict') | list }}"
|
||||||
- service1
|
#
|
||||||
- service2
|
# - name: Dump instance config
|
||||||
ansible.builtin.set_fact:
|
# ansible.builtin.copy:
|
||||||
molecule_inventory: >
|
# content: |
|
||||||
{{ molecule_inventory | combine(inventory_partial_yaml | from_yaml, recursive=true) }}
|
# # Molecule managed
|
||||||
|
#
|
||||||
- name: Dump molecule_inventory
|
# {{ instance_conf | to_json | from_json | to_yaml }}
|
||||||
ansible.builtin.copy:
|
# dest: "{{ molecule_instance_config }}"
|
||||||
content: |
|
# mode: "0600"
|
||||||
{{ 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 }}"
|
|
||||||
@@ -5,11 +5,20 @@
|
|||||||
gather_facts: false
|
gather_facts: false
|
||||||
# no_log: "{{ molecule_no_log }}"
|
# no_log: "{{ molecule_no_log }}"
|
||||||
tasks:
|
tasks:
|
||||||
- name: Remove dynamic molecule inventory
|
# Developer must implement.
|
||||||
hosts: localhost
|
|
||||||
gather_facts: false
|
# Mandatory configuration for Molecule to function.
|
||||||
tasks:
|
|
||||||
- name: Remove dynamic inventory file
|
- name: Populate instance config
|
||||||
ansible.builtin.file:
|
ansible.builtin.set_fact:
|
||||||
path: "{{ molecule_ephemeral_directory }}/inventory/molecule_inventory.yml"
|
instance_conf: {}
|
||||||
state: absent # Developer must implement.
|
|
||||||
|
- 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
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
collections:
|
|
||||||
- community.general
|
|
||||||
+5
-13
@@ -1,17 +1,8 @@
|
|||||||
- import_tasks: include-vars.yml
|
- import_tasks: include-vars.yml
|
||||||
|
|
||||||
- name: Install podman, podman networking plugins, and python support packages
|
- 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:
|
dnf:
|
||||||
name: "{{ dnf_packages }}"
|
name: ['podman', 'containernetworking-plugins', 'podman-plugins', 'python3-pip', 'systemd-container']
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Install podman-compose pip Package
|
- name: Install podman-compose pip Package
|
||||||
@@ -30,7 +21,6 @@
|
|||||||
- "{{ service_users }}"
|
- "{{ service_users }}"
|
||||||
|
|
||||||
- name: Create service folders
|
- name: Create service folders
|
||||||
become: yes
|
|
||||||
become_user: "{{ item.0.name }}"
|
become_user: "{{ item.0.name }}"
|
||||||
file:
|
file:
|
||||||
path: "/home/{{ item.0.name }}/{{ item.1 }}"
|
path: "/home/{{ item.0.name }}/{{ item.1 }}"
|
||||||
@@ -111,7 +101,8 @@
|
|||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
when: '"molecule" not in group_names'
|
tags:
|
||||||
|
- 'molecule-notest'
|
||||||
|
|
||||||
- lineinfile:
|
- lineinfile:
|
||||||
path: /etc/hosts
|
path: /etc/hosts
|
||||||
@@ -120,7 +111,8 @@
|
|||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
when: '"molecule" not in group_names'
|
tags:
|
||||||
|
- 'molecule-notest'
|
||||||
# - name: Copy cni networking driver config into place
|
# - name: Copy cni networking driver config into place
|
||||||
# blockinfile:
|
# blockinfile:
|
||||||
# name: "/etc/cni/net.d/podman.conflist"
|
# name: "/etc/cni/net.d/podman.conflist"
|
||||||
|
|||||||
Reference in new issue
Block a user