Provision basic Fedora server
Fedora bare-minimal server, packages installed afterwards. Goal is to create auto-installation scripts and maintain with Ansible.
The playbook (fedora-server-setup.yaml
) is a collection of tasks that confgiures a minimal Fedora server. The playbook reads the different variable - such as packages to install, and services to enable - from fedora-server-vars.yaml
. Adding additional packages or services is as simple as adding a new line to the appropriate list in fedora-server-vars.yaml
.
Always install from pip:
pip install ansible
The playbook requires community.general
and ansible.posix
collections. Install them with:
ansible-galaxy collection install -r requirements.yml --upgrade
The following variables are defined in fedora-server-vars.yaml
:
dnf_packages
: list of packages to install withdnf
dnf_groups
: list of groups to install withdnf
(could be added underdnf_packages
as well, but cleaner to separate packages and groups)sys_services
: list of services to enable and start withsystemd
Additionally the following variables are prompted for during the playbook execution:
target_host
: the host to configure with ansible. Hostname as defined in the inventory.target_hostname
: the hostname to set on the target host.
Make sure that an inventory file is prepared either in an ini
or a yaml
format.
ansible-playbook -i inventory.ini fedora-server-setup.yaml
The play will read variables from fedora-server-vars.yaml
. To overwrite a variable, use the -e
flag on the cli (hierarchically cli passed variables will overwrite the ones defined in the file):
ansible-playbook -i inventory.ini fedora-server-setup.yaml -e "dnf_packages=[\"package1\", \"package2\"]"
- Turn the playbook into a role
- Github Actions
- for checking yaml syntax (yamllint)
- for testing the playbook against a Fedora VM