46 lines
2.0 KiB
YAML
46 lines
2.0 KiB
YAML
- name: Initialize VPS
|
|
hosts: "{{ chosen_host | default('sukaato') }}"
|
|
remote_user: "{{ chosen_user | default('senpai') }}"
|
|
vars_files:
|
|
- vars/git_aliases.yml # REQUIRED
|
|
- vars/vim_settings.yml # REQUIRED
|
|
- vars/config@{{ inventory_hostname | default('vps') }}.yml
|
|
tasks:
|
|
- name: Installing requisite packages
|
|
ansible.builtin.include_role:
|
|
name: init-server
|
|
tasks_from: userspace@install-pkgs
|
|
handlers_from: userspace
|
|
- name: Disabling root user shell login
|
|
become: true
|
|
ansible.builtin.user:
|
|
name: root
|
|
shell: /sbin/nologin
|
|
tags:
|
|
- disable_root_shell
|
|
- name: Disable login for root user altogether
|
|
become: true
|
|
ansible.builtin.user:
|
|
name: root
|
|
password: "'*'"
|
|
tags:
|
|
- disable_root_login
|
|
# - name: Debugging
|
|
# ansible.builtin.debug:
|
|
# msg: "{{ pkgs | dict2items(key_name='pkg_group', value_name='pkgs') | map(attribute='pkgs') | list | map(attribute='userspace', default='no_userspace') | list | flatten | reject('search', 'no_userspace') | list }}"
|
|
# - name: Prematurely ending play
|
|
# ansible.builtin.meta: end_play
|
|
- name: Reorganizing userspace package groups into single list
|
|
ansible.builtin.set_fact:
|
|
all_userspace_pkgs: "{{ pkgs | dict2items(key_name='pkg_group', value_name='pkgs') | map(attribute='pkgs') | list | map(attribute='userspace', default='no_userspace') | list | flatten | reject('search', 'no_userspace') | list }}"
|
|
- name: Reorganizing core package groups into single list
|
|
ansible.builtin.set_fact:
|
|
all_core_pkgs: "{{ pkgs | dict2items(key_name='pkg_group', value_name='pkgs') | map(attribute='pkgs') | list | map(attribute='core', default='no_core') | list | flatten | reject('search', 'no_core') | list }}"
|
|
- name: Configuring aliases for using git
|
|
when: "'git' in all_core_pkgs"
|
|
community.general.git_config:
|
|
name: "alias.{{ item[0] }}"
|
|
scope: global
|
|
value: "{{ item[1] }}"
|
|
loop: "{{ git_aliases }}"
|