====== Ansible Cookbook ====== ===== Create User and Group, install updates and packages ===== Create a sysadmin user and install Exim and Dovecot, run system updates first. This would probably be best split up into several files, each dealing with a particular function, eg. Updates, User and Group creation and package installation. --- - name: "Ansible on localhost" hosts: localhost connection: local tasks: - name: Add sysadmin group group: name: sysadmin gid: 1001 - name: Add sysadmin user user: name: sysadmin comment: Sysadmin user uid: 1001 shell: /bin/bash group: sysadmin groups: adm,sudo,dip,plugdev,lxd append: yes generate_ssh_key: yes ssh_key_bits: 2048 ssh_key_file: .ssh/sysadmin_id_rsa - name: Update repo become: true apt: update_cache: yes upgrade: true cache_valid_time: 86400 #One day - name: Install utilities apt: state: latest pkg: - tree - letsencrypt - name: Install Exim4 and associated packages apt: name: exim4 state: latest - name: Install Dovecot and associated packages apt: state: latest pkg: - dovecot-core - dovecot-imapd - dovecot-managesieved - dovecot-sieve