diff --git a/meta/main.yml b/meta/main.yml new file mode 100644 index 0000000..07b8da4 --- /dev/null +++ b/meta/main.yml @@ -0,0 +1,49 @@ +--- +galaxy_info: + author: N07070 + description: Installs and configures the Scaphandre energy consumption mesurement exporter. + role_name: scaphandre # if absent directory name hosting role is used instead + namespace: hubblo # if absent, author is used instead + + # If the issue tracker for your role is not on github, uncomment the + # next line and provide a value + # issue_tracker_url: http://example.com/issue/tracker + + # Choose a valid license ID from https://spdx.org - some suggested licenses: + # - BSD-3-Clause (default) + # - MIT + # - GPL-2.0-or-later + # - GPL-3.0-only + # - Apache-2.0 + # - CC-BY-4.0 + license: GPL-3.0-only + + min_ansible_version: "2.1" + + # If this a Container Enabled role, provide the minimum Ansible Container version. + # min_ansible_container_version: + + # + # Provide a list of supported platforms, and for each platform a list of versions. + # If you don't wish to enumerate all versions for a particular platform, use 'all'. + # To view available platforms and versions (or releases), visit: + # https://galaxy.ansible.com/api/v1/platforms/ + # + platforms: + - name: Debian + versions: + - bookworm + - name: Rocky + versions: + - all + + galaxy_tags: + - scaphandre + - energy + - prometheus + - exporter + - fr + +dependencies: [] + # List your role dependencies here, one per line. Be sure to remove the '[]' above, + # if you add dependencies to this list. diff --git a/meta/scaphandre.svg b/meta/scaphandre.svg new file mode 100644 index 0000000..79c71e0 --- /dev/null +++ b/meta/scaphandre.svg @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml new file mode 100644 index 0000000..cccf9e5 --- /dev/null +++ b/molecule/default/converge.yml @@ -0,0 +1,8 @@ +--- +- name: Converge + hosts: all + gather_facts: false + tasks: + - name: Include hubblo.scaphandre + ansible.builtin.include_role: + name: "hubblo.scaphandre" diff --git a/molecule/default/create.yml b/molecule/default/create.yml new file mode 100644 index 0000000..9a3ed18 --- /dev/null +++ b/molecule/default/create.yml @@ -0,0 +1,35 @@ +--- +- name: Create + hosts: localhost + connection: local + gather_facts: false + # no_log: "{{ molecule_no_log }}" + tasks: + # TODO: Developer must implement and populate 'server' variable + + - 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" diff --git a/molecule/default/destroy.yml b/molecule/default/destroy.yml new file mode 100644 index 0000000..7f98427 --- /dev/null +++ b/molecule/default/destroy.yml @@ -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 diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml new file mode 100644 index 0000000..b209d7e --- /dev/null +++ b/molecule/default/molecule.yml @@ -0,0 +1,16 @@ +--- +dependency: + name: galaxy +driver: + name: vagrant + provider: + name: virtualbox +platforms: + - name: instance + box: debian/bookworm64 + memory: 512 + cpus: 1 +provisioner: + name: ansible +verifier: + name: ansible