diff --git a/local.yml b/local.yml index d76f51c..c6e3a4a 100644 --- a/local.yml +++ b/local.yml @@ -1,6 +1,8 @@ +--- - hosts: localhost vars_files: - vars/vault.yml + - vars/main.yml connection: local become: yes @@ -11,6 +13,8 @@ changed_when: False tasks: + - include_tasks: tasks/collections.yml + - include_tasks: tasks/timezone.yml - include_tasks: tasks/users.yml - include_tasks: tasks/cron.yml - include_tasks: tasks/packages.yml diff --git a/tasks/collections.yml b/tasks/collections.yml new file mode 100644 index 0000000..4f12cda --- /dev/null +++ b/tasks/collections.yml @@ -0,0 +1,13 @@ +--- +- name: Check whether community.general is installed + ansible.builtin.command: + cmd: ansible-galaxy collection list community.general + register: collection_list + changed_when: false + failed_when: false + +- name: Install community.general collection + ansible.builtin.command: + cmd: ansible-galaxy collection install community.general + when: collection_list.rc != 0 or + 'community.general' not in collection_list.stdout diff --git a/tasks/command-picker.yml b/tasks/command-picker.yml index 0d9795c..408c859 100644 --- a/tasks/command-picker.yml +++ b/tasks/command-picker.yml @@ -1,3 +1,4 @@ +--- - name: Create .bashrc.d directory file: path: /home/robert/.bashrc.d diff --git a/tasks/cron.yml b/tasks/cron.yml index 90b2627..1aa0cb7 100644 --- a/tasks/cron.yml +++ b/tasks/cron.yml @@ -1,3 +1,4 @@ +--- - name: install cron job (ansible-pull) cron: user: root diff --git a/tasks/packages.yml b/tasks/packages.yml index 6878abc..386abff 100644 --- a/tasks/packages.yml +++ b/tasks/packages.yml @@ -1,3 +1,4 @@ +--- - name: Install packages apt: name: @@ -8,4 +9,4 @@ - fzf - tree - duf - - sudo \ No newline at end of file + - sudo diff --git a/tasks/timezone.yml b/tasks/timezone.yml new file mode 100644 index 0000000..8889ede --- /dev/null +++ b/tasks/timezone.yml @@ -0,0 +1,4 @@ +--- +- name: Set system time zone + community.general.timezone: + name: "{{ system_timezone }}" diff --git a/tasks/users.yml b/tasks/users.yml index 9cf2de4..df4e8f4 100644 --- a/tasks/users.yml +++ b/tasks/users.yml @@ -1,3 +1,4 @@ +--- - name: Check if robert user exists getent: database: passwd diff --git a/vars/main.yml b/vars/main.yml new file mode 100644 index 0000000..9e04605 --- /dev/null +++ b/vars/main.yml @@ -0,0 +1,2 @@ +--- +system_timezone: America/Denver