Configure Linux: acpi, aliases, apparmor, authorized keys, autofs, automatic upgrades, bluetooth, cron, debsums, fstab, gpsd, grub, hostname, hosts, iptables, kvm, latex, libvirt, lid, logrotate, modem manager, modules, netplan, nfsd, packages, pm-utils, postfix, repos, service, smart, speech-dispatcher, ssh, sshd, sudoers, swap, sysctl, timesyncd, timezone, tlp, udev, ufw, users, virtualbox, wpa_gui, wpa_supplicant, xen, xorg.conf.d, zfs, (wip ...)
Tested systems:
- Ubuntu 18.04
- Ubuntu 19.04
- CentOS 7
- Armbian 5.90
Please feel free to share your feedback and report issues.
None.
Read the defaults and examples in vars.
- Install the role.
# ansible-galaxy install vbotka.linux_postinstall
- Change variables.
# editor vbotka.linux_postinstall/vars/main.yml
- Review OS specific variables in vars/defaults.
- Review, customize and/or add Flavor specific variables in vars/flavors.
- Optionally disable lp_flavors_enable: false. This will speedup the playbook.
- Optionally put customized OS specific variables into the vars directory.
- See tasks/vars.yml for the naming conventions and precedence.
- Os specific variables will overwrite variables in var/main.yml.
- Create the inventory.
# cat hosts
[host1]
host1.example.com
[host1:vars]
ansible_user: admin
ansible_connection=ssh
ansible_python_interpreter=/usr/bin/python3.6
ansible_perl_interpreter=/usr/bin/perl
- Create the playbook.
# cat linux-postinstall.yml
- hosts: host1
become: yes
become_user: root
become_method: sudo
roles:
- vbotka.linux_postinstall
- Run the playbook.
# ansible-playbook linux-postinstall.yml
Perform syntax check of the playbook
# ansible-playbook linux-postinstall.yml --syntax-check
Run the playbook in in check mode first
# ansible-playbook linux-postinstall.yml --check
If all is right run the playbook twice. In second run all tasks shall be OK and 0 changed, unreachable and failed.
# ansible-playbook linux-postinstall.yml
Packages listed in the variables lp_*_packages
will be automatically
installed by the tasks/packages.yml if enabled by variable lp_*
. For
example
lp_libvirt: true
lp_libvirt_packages:
- libvirt0
- libvirt-bin
- libvirt-daemon
- libvirt-daemon-driver-storage-rbd
- libvirt-daemon-system
- virtinst
the lp_libvirt_packages will be included in the packages installed by
# ansible-playbook linux-postinstall.yml -t lp_packages
Variable lp_service_enable
contains a list of services automatically managed by the task service.yml. A service will be manged by the task service.yml if lp_<service>: true
. Setting lp_<service>: false
will disable management of the service by the task service.yml. Variable lp_<service>_enable
controls the status of the service. For example service udev will be enabled, because it is listed among lp_service_enable
and by default
lp_udev: true
lp_udev_enable: true
Run the following command to see what services will be managed.
# ansible-playbook linux-postinstall.yml -e lp_service_debug=true -t lp_service_debug
See service.yml for details.
- Configure users, sudoers and persistent network interfaces
ansible-playbook linux-postinstall.yml -t lp_hostname
ansible-playbook linux-postinstall.yml -t lp_users
ansible-playbook linux-postinstall.yml -t lp_sudoers
ansible-playbook linux-postinstall.yml -t lp_udev
ansible-playbook linux-postinstall.yml -t lp_netplan
ansible-playbook linux-postinstall.yml -t lp_wpasupplicant
ansible-playbook linux-postinstall.yml -t lp_reboot -e 'lp_reboot=true lp_reboot_force=true'
- Configure the firewall. For example iptables
# ansible-playbook linux-postinstall.yml -t lp_iptables
- Test installation of the packages
ansible-playbook -t lp_packages -e 'lp_package_install_dryrun=true' linux-postinstall.yml
- Install packages
ansible-playbook -t lp_packages linux-postinstall.yml
- Check, install and configure other tasks
ansible-playbook linux-postinstall.yml --check
ansible-playbook linux-postinstall.yml