ansible tests work now

This commit is contained in:
Bertrand Lanson 2023-05-25 09:30:55 +02:00
parent 67565b0e49
commit dd0936df28
2 changed files with 77 additions and 77 deletions

View File

@ -1,29 +1,29 @@
--- ---
# This is an example playbook to execute Ansible tests. # This is an example playbook to execute Ansible tests.
# - name: Verify - name: Verify
# hosts: all hosts: all
# gather_facts: false gather_facts: false
# tasks: tasks:
# - name: "Test: directory /usr/local/share/ca-certificates" - name: "Test: directory /usr/local/share/ca-certificates"
# block: block:
# - name: "Stat directory /usr/local/share/ca-certificates" - name: "Stat directory /usr/local/share/ca-certificates"
# ansible.builtin.stat: ansible.builtin.stat:
# path: "/usr/local/share/ca-certificates" path: "/usr/local/share/ca-certificates"
# register: usr_local_share_ca_certificates register: usr_local_share_ca_certificates
#
# - name: "Find files in directory /usr/local/share/ca-certificates" - name: "Find files in directory /usr/local/share/ca-certificates"
# ansible.builtin.find: ansible.builtin.find:
# paths: "/usr/local/share/ca-certificates" paths: "/usr/local/share/ca-certificates"
# file_type: file file_type: file
# register: usr_local_share_ca_certificates_ls register: usr_local_share_ca_certificates_ls
#
# - name: "Verify directory /usr/local/share/ca-certificates" - name: "Verify directory /usr/local/share/ca-certificates"
# ansible.builtin.assert: ansible.builtin.assert:
# that: that:
# - usr_local_share_ca_certificates.stat.exists - usr_local_share_ca_certificates.stat.exists
# - usr_local_share_ca_certificates.stat.isdir - usr_local_share_ca_certificates.stat.isdir
# - usr_local_share_ca_certificates.stat.pw_name == 'root' - usr_local_share_ca_certificates.stat.pw_name == 'root'
# - usr_local_share_ca_certificates.stat.gr_name == 'root' - usr_local_share_ca_certificates.stat.gr_name == 'root'
# - usr_local_share_ca_certificates.stat.mode == '0755' - usr_local_share_ca_certificates.stat.mode == '0755'
# - (usr_local_share_ca_certificates_ls.files|length) == 0 - (usr_local_share_ca_certificates_ls.files|length) == 0

View File

@ -1,54 +1,54 @@
--- ---
# This is an example playbook to execute Ansible tests. # This is an example playbook to execute Ansible tests.
# - name: Verify - name: Verify
# hosts: all hosts: all
# gather_facts: false gather_facts: false
# tasks: tasks:
# - name: "Test: directory /usr/local/share/ca-certificates" - name: "Test: directory /usr/local/share/ca-certificates"
# block: block:
# - name: "Stat directory /usr/local/share/ca-certificates" - name: "Stat directory /usr/local/share/ca-certificates"
# ansible.builtin.stat: ansible.builtin.stat:
# path: "/usr/local/share/ca-certificates" path: "/usr/local/share/ca-certificates"
# register: usr_local_share_ca_certificates register: usr_local_share_ca_certificates
#
# - name: "Find files in directory /usr/local/share/ca-certificates" - name: "Find files in directory /usr/local/share/ca-certificates"
# ansible.builtin.find: ansible.builtin.find:
# paths: "/usr/local/share/ca-certificates" paths: "/usr/local/share/ca-certificates"
# file_type: file file_type: file
# register: usr_local_share_ca_certificates_ls register: usr_local_share_ca_certificates_ls
#
# - name: "Verify directory /usr/local/share/ca-certificates" - name: "Verify directory /usr/local/share/ca-certificates"
# ansible.builtin.assert: ansible.builtin.assert:
# that: that:
# - usr_local_share_ca_certificates.stat.exists - usr_local_share_ca_certificates.stat.exists
# - usr_local_share_ca_certificates.stat.isdir - usr_local_share_ca_certificates.stat.isdir
# - usr_local_share_ca_certificates.stat.pw_name == 'root' - usr_local_share_ca_certificates.stat.pw_name == 'root'
# - usr_local_share_ca_certificates.stat.gr_name == 'root' - usr_local_share_ca_certificates.stat.gr_name == 'root'
# - usr_local_share_ca_certificates.stat.mode == '0755' - usr_local_share_ca_certificates.stat.mode == '0755'
# - (usr_local_share_ca_certificates_ls.files|length) == 1 - (usr_local_share_ca_certificates_ls.files|length) == 1
# - (usr_local_share_ca_certificates_ls.files[0].path|basename) == 'isrg_root.crt' - (usr_local_share_ca_certificates_ls.files[0].path|basename) == 'isrg_root.crt'
#
# - name: "Test: certificate isrg_root.crt" - name: "Test: certificate isrg_root.crt"
# block: block:
# - name: "Stat file /usr/local/share/ca-certificates/isrg_root.crt" - name: "Stat file /usr/local/share/ca-certificates/isrg_root.crt"
# ansible.builtin.stat: ansible.builtin.stat:
# path: "/usr/local/share/ca-certificates/isrg_root.crt" path: "/usr/local/share/ca-certificates/isrg_root.crt"
# register: isrg_root_file register: isrg_root_file
#
# - name: "Get certificate info" - name: "Get certificate info"
# community.crypto.x509_certificate_info: community.crypto.x509_certificate_info:
# path: "/usr/local/share/ca-certificates/isrg_root.crt" path: "/usr/local/share/ca-certificates/isrg_root.crt"
# register: isrg_root_pem register: isrg_root_pem
#
# - name: "Verify certificate is readable" - name: "Verify certificate is readable"
# ansible.builtin.assert: ansible.builtin.assert:
# that: that:
# - isrg_root_file.stat.exists - isrg_root_file.stat.exists
# - isrg_root_file.stat.isreg - isrg_root_file.stat.isreg
# - isrg_root_file.stat.pw_name == 'root' - isrg_root_file.stat.pw_name == 'root'
# - isrg_root_file.stat.gr_name == 'root' - isrg_root_file.stat.gr_name == 'root'
# - isrg_root_file.stat.mode == '0644' - isrg_root_file.stat.mode == '0644'
# - not isrg_root_pem.failed - not isrg_root_pem.failed
# - not isrg_root_pem.expired - not isrg_root_pem.expired
# - isrg_root_pem.issuer == isrg_root_pem.subject - isrg_root_pem.issuer == isrg_root_pem.subject