Basic package deployment
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.5 KiB

---
- name: sw-basic | 1. Install basic packages
ansible.builtin.apt:
name:
- screen
- htop
- openssh-server
- rsync
- unzip
- mc
- sudo
- curl
- nano
state: present
update_cache: yes
- name: sw-basic | 2. Install additional packages if defined
ansible.builtin.apt:
name: "{{ item }}"
state: present
update_cache: yes
with_items: "{{ additional_pkgs }}"
when: additional_pkgs is defined
- name: sw-basic | 3. Install additional services if defined
ansible.builtin.apt:
name: "{{ item }}"
state: present
update_cache: yes
with_items: "{{ additional_services }}"
when: additional_services is defined
- name: sw-basic | 4. Add ssh public key file
ansible.posix.authorized_key:
user: "{{ sshd_username }}"
state: present
key: "{{ item }}"
with_file: "{{ sshd_key_file_name }}"
- name: sw-basic | 5. Copy the sshd_config template file and restart openssh-server when changed.
ansible.builtin.template:
src: sshd_config.j2
dest: "{{ sshd_config_location }}"
notify:
- restart sshd
- name: sw-basic | 6. Start and enable openssh-server service
ansible.builtin.service:
name: sshd
state: "{{ sshd_service_state }}"
enabled: "{{ sshd_service_enabled }}"
- name: sw-basic | 7. Start and enable additional services
ansible.builtin.service:
name: "{{ item }}"
state: "{{ additional_services_state }}"
enabled: "{{ additional_services_enabled }}"
with_items: "{{ additional_services }}"