diff --git a/.ansible-lint b/.ansible-lint new file mode 100644 index 0000000..7ff036b --- /dev/null +++ b/.ansible-lint @@ -0,0 +1,2 @@ +skip_list: + - 'fcqn-builtins' diff --git a/defaults/main.yml b/defaults/main.yml index 031e0f2..2418b80 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -39,7 +39,7 @@ hosts_file_snippets: [] system_ipV6_disable: true -system_ssh_custom_host: +system_ssh_custom_host: [] # - host: # user: # keyfile: diff --git a/meta/main.yml b/meta/main.yml index 42dda87..0db9eaf 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -1,6 +1,7 @@ --- galaxy_info: author: VincentDcmps + namespace: vincentdcmps description: company: diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml new file mode 100644 index 0000000..c85b462 --- /dev/null +++ b/molecule/default/converge.yml @@ -0,0 +1,8 @@ +--- +- name: Converge + remote_user: vagrant + hosts: all + tasks: + - name: "Include vincentdcmps.test" + include_role: + name: "vincentdcmps.system" diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml new file mode 100644 index 0000000..0b85455 --- /dev/null +++ b/molecule/default/molecule.yml @@ -0,0 +1,36 @@ +--- +dependency: + name: galaxy +driver: + name: vagrant + provider: + name: libvirt + options: + memory: 512 + cpus: 2 +platforms: + - name: archlinux + box: archlinux/archlinux + # - name: rocky8 + #box: generic/rocky8 + - name: rocky9 + box: generic/rocky9 + +provisioner: + name: ansible + connection_options: + ansible_ssh_user: vagrant + ansible_become: true + log: true + lint: + name: ansible-lint + inventory: + host_vars: + archlinux: + user: + name: vagrant + rocky9: + user: + name: vagrant +verifier: + name: ansible diff --git a/molecule/default/prepare.yml b/molecule/default/prepare.yml new file mode 100644 index 0000000..27c9aae --- /dev/null +++ b/molecule/default/prepare.yml @@ -0,0 +1,12 @@ +- hosts: archlinux + remote_user: vagrant + become: true + gather_facts: true + tasks: + - name: Init pacman + ansible.builtin.raw: | + pacman-key --init + pacman-key --populate archlinux + changed_when: false + failed_when: false + diff --git a/molecule/default/verify.yml b/molecule/default/verify.yml new file mode 100644 index 0000000..e707420 --- /dev/null +++ b/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/tasks/firewalld.yml b/tasks/firewalld.yml index 157981a..c4d7c95 100644 --- a/tasks/firewalld.yml +++ b/tasks/firewalld.yml @@ -7,5 +7,5 @@ become: true register: service_stop failed_when: - - '"Could not find the requested service" not in service_stop.msg' - - service_stop.rc != 0 + # - '"Could not find the requested service" not in service_stop.msg' + - service_stop.rc is defined and service_stop.rc != 0 diff --git a/tasks/pacman.yml b/tasks/pacman.yml index b44042c..a83587c 100644 --- a/tasks/pacman.yml +++ b/tasks/pacman.yml @@ -20,7 +20,7 @@ line: "Server= {{ system_arch_local_mirror }}/repo/archlinux_$arch/$repo/os/$arch" state: present insertbefore: BOF - when: system_arch_local_mirror is defined + when: system_arch_local_mirror - name: stat ca-certificates stat: diff --git a/tasks/time.yml b/tasks/time.yml index 5f6d30b..3c4c108 100644 --- a/tasks/time.yml +++ b/tasks/time.yml @@ -1,9 +1,11 @@ --- - name: Enable timesync - command: timedatectl set-ntp true + service: + name: systemd-timesyncd.service + enabled: true + state: started become: true - args: - creates: /etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service + when: ansible_facts['os_family'] == 'Archlinux' - name: Set timezone and hardware clock timezone: