diff --git a/project/main.yml b/project/main.yml index 5d24fd2..fa1afe3 100644 --- a/project/main.yml +++ b/project/main.yml @@ -4,6 +4,10 @@ - name: Ping hosts ansible.builtin.ping: +- hosts: all + roles: + - common + - hosts: docker2.t-juice.club roles: - vault diff --git a/project/roles/common/tasks/main.yml b/project/roles/common/tasks/main.yml new file mode 100644 index 0000000..68e68e7 --- /dev/null +++ b/project/roles/common/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Ensure packages are installed + import_tasks: packages.yml diff --git a/project/roles/common/tasks/packages.yml b/project/roles/common/tasks/packages.yml new file mode 100644 index 0000000..bde8318 --- /dev/null +++ b/project/roles/common/tasks/packages.yml @@ -0,0 +1,16 @@ +--- +- name: Ensure common packages are installed + ansible.builtin.package: + name: + - zsh + - htop + - xfsprogs + - iotop + +- name: Ensure debian-specific packages are installed + import_tasks: packages_debian.yml + when: ansible_facts['os-family']|lower == 'debian' + +- name: Ensure rhel-specific packages are installed + import_tasks: packages_redhat.yml + when: ansible_facts['os-family']|lower == 'redhat' diff --git a/project/roles/common/tasks/packages_debian.yml b/project/roles/common/tasks/packages_debian.yml new file mode 100644 index 0000000..ccb3c81 --- /dev/null +++ b/project/roles/common/tasks/packages_debian.yml @@ -0,0 +1,6 @@ +--- +- name: Ensure packages are installed + ansible.builtin.package: + name: + - vim + - xfsprogs \ No newline at end of file diff --git a/project/roles/common/tasks/packages_redhat.yml b/project/roles/common/tasks/packages_redhat.yml new file mode 100644 index 0000000..40b40cc --- /dev/null +++ b/project/roles/common/tasks/packages_redhat.yml @@ -0,0 +1,6 @@ +--- +- name: Ensure packages are installed + ansible.builtin.package: + name: + - vim-enhanced + - yum-cron