Initial commit
Signed-off-by: Julien Riou <julien@riou.xyz>
This commit is contained in:
commit
0a0341e6f9
92 changed files with 3529 additions and 0 deletions
7
roles/golang/molecule/default/converge.yml
Normal file
7
roles/golang/molecule/default/converge.yml
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
- name: Converge
|
||||
hosts: molecule
|
||||
roles:
|
||||
- golang
|
||||
vars:
|
||||
golang_version: 1.25.4
|
||||
18
roles/golang/molecule/default/create.yml
Normal file
18
roles/golang/molecule/default/create.yml
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
---
|
||||
- name: Create containers
|
||||
hosts: localhost
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: Create containers
|
||||
containers.podman.podman_container:
|
||||
hostname: "{{ item }}"
|
||||
name: "{{ item }}"
|
||||
image: "{{ hostvars[item]['container_image'] }}"
|
||||
state: started
|
||||
loop: "{{ groups['molecule'] }}"
|
||||
|
||||
- name: Wait for containers to be ready
|
||||
ansible.builtin.wait_for_connection:
|
||||
timeout: 300
|
||||
delegate_to: "{{ item }}"
|
||||
loop: "{{ groups['molecule'] }}"
|
||||
11
roles/golang/molecule/default/destroy.yml
Normal file
11
roles/golang/molecule/default/destroy.yml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
---
|
||||
- name: Destroy container instances
|
||||
hosts: localhost
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: Remove containers
|
||||
containers.podman.podman_container:
|
||||
name: "{{ item }}"
|
||||
state: absent
|
||||
loop: "{{ groups['molecule'] }}"
|
||||
failed_when: false
|
||||
12
roles/golang/molecule/default/inventory/hosts.yml
Normal file
12
roles/golang/molecule/default/inventory/hosts.yml
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
---
|
||||
molecule:
|
||||
hosts:
|
||||
debian11:
|
||||
ansible_connection: containers.podman.podman
|
||||
container_image: docker.io/geerlingguy/docker-debian11-ansible:latest
|
||||
debian12:
|
||||
ansible_connection: containers.podman.podman
|
||||
container_image: docker.io/geerlingguy/docker-debian12-ansible:latest
|
||||
debian13:
|
||||
ansible_connection: containers.podman.podman
|
||||
container_image: docker.io/geerlingguy/docker-debian13-ansible:latest
|
||||
26
roles/golang/molecule/default/molecule.yml
Normal file
26
roles/golang/molecule/default/molecule.yml
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
---
|
||||
ansible:
|
||||
executor:
|
||||
args:
|
||||
ansible_playbook:
|
||||
- --inventory=inventory/
|
||||
env:
|
||||
ANSIBLE_ROLES_PATH: ../../../../roles
|
||||
playbooks:
|
||||
create: create.yml
|
||||
converge: converge.yml
|
||||
verify: verify.yml
|
||||
destroy: destroy.yml
|
||||
|
||||
dependency:
|
||||
name: galaxy
|
||||
options:
|
||||
requirements-file: ${MOLECULE_SCENARIO_DIRECTORY}/requirements.yml
|
||||
|
||||
scenario:
|
||||
test_sequence:
|
||||
- create
|
||||
- converge
|
||||
- idempotence
|
||||
- verify
|
||||
- destroy
|
||||
3
roles/golang/molecule/default/requirements.yml
Normal file
3
roles/golang/molecule/default/requirements.yml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
collections:
|
||||
- name: containers.podman
|
||||
15
roles/golang/molecule/default/verify.yml
Normal file
15
roles/golang/molecule/default/verify.yml
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
- name: Verify
|
||||
hosts: molecule
|
||||
vars:
|
||||
golang_version: 1.25.4
|
||||
tasks:
|
||||
- name: Get version
|
||||
ansible.builtin.command:
|
||||
cmd: /usr/local/go/bin/go version
|
||||
register: golang_version_cmd
|
||||
|
||||
- name: Compare versions
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- golang_version_cmd.stdout | regex_search('^go version go' + golang_version + ' linux/amd64') != ""
|
||||
Loading…
Add table
Add a link
Reference in a new issue