120 lines
3.3 KiB
YAML
120 lines
3.3 KiB
YAML
---
|
|
# welcome to tbe base.yml role. As you can see, this is a collection of
|
|
# tasks, which in turn is basically a structure like this one
|
|
# name: "user friendly name of your task"
|
|
# a_module_name:
|
|
# a_module_parameter: value
|
|
# another_module_parameter: value2
|
|
|
|
# this installs packages, here we use the `apt` module
|
|
# because we are on a debian-based distribution. If we were
|
|
# using something like Fedora for instance, we would have used
|
|
# the `dnf` module. Then just pass as arguments the names of
|
|
# the packages you want to install just as you would pass them
|
|
# to `apt install`.
|
|
- name: "Install wanted packages"
|
|
ansible.builtin.apt:
|
|
name:
|
|
- apt-transport-https
|
|
- arptables
|
|
- bash-completion
|
|
- bridge-utils
|
|
- ca-certificates
|
|
- cmake
|
|
- coreutils
|
|
- curl
|
|
- dnsutils
|
|
- ebtables
|
|
- file
|
|
- gawk
|
|
- git
|
|
- glusterfs-client
|
|
- glusterfs-server
|
|
- gnupg
|
|
- htop
|
|
- iftop
|
|
- ifstat
|
|
- iputils-ping
|
|
- iptables
|
|
- iproute2
|
|
- jq
|
|
- libsqlite3-dev
|
|
- libffi-dev
|
|
- libpython3-dev
|
|
- libssl-dev
|
|
- locales-all
|
|
- lsb-release
|
|
- lsof
|
|
- lvm2
|
|
- mdadm
|
|
- minicom
|
|
- mtr-tiny
|
|
- net-tools
|
|
- ntp
|
|
- open-iscsi
|
|
- openssl
|
|
- p7zip-full
|
|
- pwgen
|
|
- sqlite3
|
|
- strace
|
|
- sudo
|
|
- sysstat
|
|
- telnet
|
|
- tcpdump
|
|
- tmux
|
|
- uuid-runtime
|
|
- unzip
|
|
- vim-nox
|
|
- wget
|
|
- wipe
|
|
- zip
|
|
# state: latest will update the package everytime the
|
|
# role is ran against a host
|
|
state: present
|
|
# Update the cache before trying to update ?
|
|
# You generally want this because it's not updating itself
|
|
update_cache: true
|
|
# force update it if it's been updated for longer than an hour
|
|
cache_valid_time: 3600
|
|
register: apt_res
|
|
# if running apt fails, retry to do it up to 5 times then give up and cry in the corner
|
|
retries: 5
|
|
until: apt_res is success
|
|
# Same as above, except you *remove* packages instead of installing them
|
|
- name: "Remove unanted packages"
|
|
ansible.builtin.apt:
|
|
name:
|
|
- ntpdate
|
|
# note the value of `state` here
|
|
state: absent
|
|
# This renders a template, the `inventory_hostname` is a variable
|
|
# that is golbally available. It will map to the hostname you
|
|
# assigned your host in the `inventory` file
|
|
- name: "Hard set hostname"
|
|
ansible.builtin.template:
|
|
src: hostname.j2
|
|
dest: /etc/hostname
|
|
owner: root
|
|
group: root
|
|
# you need to put it in string mode, and you need to
|
|
# have a leading `0`, otherwise ansible is going to interpret it weird
|
|
# more info https://docs.ansible.com/ansible/latest/collections/ansible/builtin/file_module.html#parameter-mode
|
|
mode: "0644"
|
|
- name: "Setup motd"
|
|
ansible.builtin.template:
|
|
src: motd.j2
|
|
dest: /etc/motd
|
|
owner: root
|
|
group: root
|
|
mode: "0644"
|
|
- name: "Setup hosts"
|
|
ansible.builtin.template:
|
|
src: hosts.j2
|
|
dest: /etc/hosts
|
|
owner: root
|
|
group: root
|
|
mode: "0644"
|
|
# Note that you can also just `copy` files using the copy module:
|
|
# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/copy_module.html#examples
|
|
# And finally you can create files and directories with the `file` module
|
|
# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/file_module.html#examples
|