diff --git a/defaults/main.yml b/defaults/main.yml index 861dc85..57588de 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,5 +1,3 @@ --- # defaults file for import_vault_root_ca -import_vault_root_ca_certificate_list: - - url: "https://openstack01.ednz.fr:8200/v1/ednz-root-ca/ca" - cert_name: "ednz_ca" +import_vault_root_ca_certificate_list: {} diff --git a/molecule/with_custom_ca/converge.yml b/molecule/with_custom_ca/converge.yml new file mode 100644 index 0000000..a49f5c4 --- /dev/null +++ b/molecule/with_custom_ca/converge.yml @@ -0,0 +1,7 @@ +--- +- name: Converge + hosts: all + tasks: + - name: "Include ednxzu.import_vault_root_ca" + ansible.builtin.include_role: + name: "ednxzu.import_vault_root_ca" diff --git a/molecule/with_custom_ca/group_vars/all.yml b/molecule/with_custom_ca/group_vars/all.yml new file mode 100644 index 0000000..6ff14db --- /dev/null +++ b/molecule/with_custom_ca/group_vars/all.yml @@ -0,0 +1,4 @@ +--- +import_vault_root_ca_certificate_list: + - url: "https://openstack01.ednz.fr:8200/v1/ednz-root-ca/ca" + cert_name: "ednz_ca" \ No newline at end of file diff --git a/molecule/with_custom_ca/molecule.yml b/molecule/with_custom_ca/molecule.yml new file mode 100644 index 0000000..7150297 --- /dev/null +++ b/molecule/with_custom_ca/molecule.yml @@ -0,0 +1,37 @@ +--- +dependency: + name: galaxy + options: + requirements-file: ./requirements.yml +driver: + name: docker +platforms: + - name: instance + image: geerlingguy/docker-${MOLECULE_TEST_OS}-ansible + command: "" + volumes: + - /sys/fs/cgroup:/sys/fs/cgroup + cgroupns_mode: host + privileged: true + pre_build_image: true +provisioner: + name: ansible + config_options: + defaults: + remote_tmp: /tmp/.ansible +verifier: + name: ansible +scenario: + name: with_custom_ca + test_sequence: + - dependency + - cleanup + - destroy + - syntax + - create + - prepare + - converge + - idempotence + - verify + - cleanup + - destroy diff --git a/molecule/with_custom_ca/requirements.yml b/molecule/with_custom_ca/requirements.yml new file mode 100644 index 0000000..e9320f9 --- /dev/null +++ b/molecule/with_custom_ca/requirements.yml @@ -0,0 +1,3 @@ +--- +# requirements file for molecule +roles: [] diff --git a/molecule/with_custom_ca/verify.yml b/molecule/with_custom_ca/verify.yml new file mode 100644 index 0000000..ee4599b --- /dev/null +++ b/molecule/with_custom_ca/verify.yml @@ -0,0 +1,24 @@ +--- +# This is an example playbook to execute Ansible tests. + +- name: Verify + hosts: all + gather_facts: false + tasks: + - name: "Test: directory /usr/local/share/ca-certificates" + block: + - name: "Stat directory /usr/local/share/ca-certificates" + ansible.builtin.stat: + path: "/usr/local/share/ca-certificates" + register: usr_local_share_ca_certificates + + - name: "Verify directory {{ import_vault_root_ca_cert_dir }}" + ansible.builtin.assert: + that: + - usr_local_share_ca_certificates.stat.exists + - usr_local_share_ca_certificates.stat.isdir + - usr_local_share_ca_certificates.stat.pw_name == 'root' + - usr_local_share_ca_certificates.stat.gr_name == 'root' + - usr_local_share_ca_certificates.stat.mode == '0755' + + - name: "Get certificate information"