diff --git a/ansible/makefile b/ansible/makefile index 776f1cf..8dc780c 100644 --- a/ansible/makefile +++ b/ansible/makefile @@ -10,3 +10,10 @@ deploy_staging: generate-token: @echo export VAULT_TOKEN=`vault token create -policy=ansible -field="token" -period 6h` + + +create-dev: + molecule converge + +destroy-dev: + molecule destroy diff --git a/ansible/molecule/default/INSTALL.rst b/ansible/molecule/default/INSTALL.rst new file mode 100644 index 0000000..1b38d09 --- /dev/null +++ b/ansible/molecule/default/INSTALL.rst @@ -0,0 +1,15 @@ +*********************************** +Delegated driver installation guide +*********************************** + +Requirements +============ + +This driver is delegated to the developer. Up to the developer to implement +requirements. + +Install +======= + +This driver is delegated to the developer. Up to the developer to implement +requirements. diff --git a/ansible/molecule/default/converge.yml b/ansible/molecule/default/converge.yml new file mode 100644 index 0000000..de2790c --- /dev/null +++ b/ansible/molecule/default/converge.yml @@ -0,0 +1,2 @@ +--- +- import_playbook: ../../site.yml diff --git a/ansible/molecule/default/molecule.yml b/ansible/molecule/default/molecule.yml new file mode 100644 index 0000000..e20dbdd --- /dev/null +++ b/ansible/molecule/default/molecule.yml @@ -0,0 +1,45 @@ +--- +dependency: + name: galaxy +driver: + name: lxd +platforms: + - name: oscar-dev + image: images:archlinux + source: + type: image + mode: pull + alias: archlinux + - name: merlin-dev + source: + type: image + mode: pull + alias: rockylinux/9 + - name: gerard-dev + source: + type: image + mode: pull + alias: debian/11 +provisioner: + name: ansible + connection_options: + ansible_ssh_user: user + ansible_become: true + log: true + lint: + name: ansible-lint + inventory: + host_vars: + oscar-dev: + user: + name: user + merlin-dev: + user: + name: user + gerard-dev: + user: + name: user + links: + hosts: ../../staging +verifier: + name: ansible diff --git a/ansible/molecule/default/prepare.yml b/ansible/molecule/default/prepare.yml new file mode 100644 index 0000000..91f81f6 --- /dev/null +++ b/ansible/molecule/default/prepare.yml @@ -0,0 +1,9 @@ +- hosts: all + remote_user: root + become: true + gather_facts: false + tasks: + - name: Init pacman + ansible.builtin.include_role: + name: ansible_bootstrap + diff --git a/ansible/molecule/default/verify.yml b/ansible/molecule/default/verify.yml new file mode 100644 index 0000000..e707420 --- /dev/null +++ b/ansible/molecule/default/verify.yml @@ -0,0 +1,10 @@ +--- +# This is an example playbook to execute Ansible tests. + +- name: Verify + hosts: all + gather_facts: false + tasks: + - name: Example assertion + ansible.builtin.assert: + that: true diff --git a/ansible/staging b/ansible/staging index 60fe04b..93f7e79 100644 --- a/ansible/staging +++ b/ansible/staging @@ -1,13 +1,15 @@ +[homelab] +oscar-dev +gerard-dev + [VPS] -VMDR - -[dhcp] -VMAS-BUILD - -[VMServer] -VMAS-HML - +merlin-dev [wireguard] -VMDR +oscar-dev +gerard-dev + +[database] +oscar-dev + diff --git a/makefile b/makefile index c5b8d96..36c5f8e 100644 --- a/makefile +++ b/makefile @@ -9,3 +9,11 @@ vault-dev: else \ ./vault/standalone_vault.sh $(FILE);\ fi + + +create-dev: + make -C ansible create-dev + +destroy-dev: + make -C ansible destroy-dev +