gucharbon.setup_ubuntu
Setup Ubuntu
Quickly set up an Ubuntu Xenial or Focal server. This includes:
- Creating users
- Configuring SSH
- Installing packages using
apt-get
- Installing Python packages using
pip
- Configuring the firewall using
ufw
Requirements
You only need SSH access to the remote host to use this role.
Role Variables
Variable | Default | Description |
---|---|---|
upgrade_dist |
true |
If true, all packages will be updated. |
dpkg_options |
"force-confold,force-confdef" |
Options for dpkg. |
remove_packages |
[] |
List of packages to remove. |
install_packages |
["vim", "dos2unix", "git", "curl", "wget", "telnet", "iputils-ping", "ufw", "sudo", "software-properties-common", "ntp", "python3", "python3-pip"] |
List of packages to install. |
user_groups |
[{ name: "docker", gid: 12345 }] |
List of user groups. |
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 policies (UFW). |
Example Playbook
Most of the time, you just need to configure users:
- hosts: localhost
vars:
user_groups:
- name: napo
users:
- name: napo
# Optional, omitted 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 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 a sudo user
sudo_user: true
# By default sudo users 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
Installa
ansible-galaxy install gucharbon.setup_ubuntu
Licenza
Unknown
Download
72
Proprietario