setup_ubuntu
Setup Ubuntu
Quicly setup an ubuntu xenial or focal server. This includes:
- User creation
- SSH configuration
- Packages installation using
apt-get
- Python packages installation using
pip
- Firewall configuration using
ufw
Requirements
You only need to have an SSH access to the remote host in order to play this role.
Role Variables
Variable | Default | Description |
---|---|---|
upgrade_dist |
true |
If true, all packages will be updated. |
dpkg_options |
"force-confold,force-confdef" |
Options to pass to dpkg. |
remove_packages |
[] |
A list of packages to remove. |
install_packages |
["vim", "dos2unix", "git", "curl", "wget", "telnet", "iputils-ping", "ufw", "sudo", "software-properties-common", "ntp", "python3", "python3-pip"] |
A list of packages to install. |
user_groups |
[{ name: "docker", gid: 12345 }] |
A list of user_groups dictionaries. |
users |
See file defaults/main/users.yml |
Users to create. |
enable_ufw |
true |
Enable ufw firewall |
firewall_rules |
See file defaults/main/firewall.yml |
Firewall rules (ufw). |
firewall_policies |
See file defaults/main/policies.yml |
Firewall rules (ufw). |
Example Playbook
Most of the time, you only need to configure users:
- hosts: localhost
vars:
user_groups:
- name: napo
users:
- name: napo
# Optional, omited by default
gecos: Napoleon Bunnypart
# Optional, automatically generated by default
uid: 1234
# Optional, default to True
create_home: true
# Optional, /bin/bash by default
shell: /bin/bash
# Optional, /home/<username> by default
home: /home/napo
# By the default the user will be present
state: present
# By default no password is given
password: toto
# By default password is not locked
password_lock: false
# Optionally set the user's primary group (takes a group name). By default it is set to user name.
group: napo
# Groups to add the user to
groups:
- developers
# By default the user is not sudo user
sudo_user: true
# By default sudo user do not have passwordless sudo enabled
passwordless_sudo: true
# Add SSH authorized keys
ssh_authorized_keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQClJomroX67L4EnZqeU9LGzNOcFGO2KJ1fsWugYsWJsxFpW/rb3t00brI4k37vw0I85owhyerlOFHT5vd+vFzIsovA8l7Bsgm/E4uLIEwHiJ3svDFcfrLosynrA3r2XQY9C7Zar/d+l1FrykanD9lAcFeMqnoMi8xLg3OWk3y75w0VQ86jruGaHnq7eqvL/7wXeW09Lut1jgYqPaVNLG6EJ+gHlq8FLUVm2/5NzRxHIrvh+03xExbRzacDdCol25Gglxm+1fljluDfIqvPM359J1o7PMJc0v5dgercM4YBFY0yAPIth6TVGDugMlTfpvbtKAGJdl/skugCZfx1U9reR napo@napoleon-XPS13
roles:
- setup_ubuntu
License
MIT
Install
ansible-galaxy install gucharbon/setup_ubuntu
License
Unknown
Downloads
61
Owner