More content and playbooks
* more readme.md content * imported basic roles * commented said basic roles * trimmed down playbooks to be understandable * update requirements.txt deps
This commit is contained in:
parent
23b521f4fb
commit
2a067a2fe4
22 changed files with 491 additions and 0 deletions
121
roles/base/tasks/main.yml
Normal file
121
roles/base/tasks/main.yml
Normal file
|
@ -0,0 +1,121 @@
|
|||
---
|
||||
# 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"
|
||||
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
|
||||
- netcat
|
||||
- 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: latest
|
||||
# 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"
|
||||
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"
|
||||
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"
|
||||
template:
|
||||
src: motd.j2
|
||||
dest: /etc/motd
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
- name: "Setup hosts"
|
||||
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
|
1
roles/base/templates/hostname.j2
Normal file
1
roles/base/templates/hostname.j2
Normal file
|
@ -0,0 +1 @@
|
|||
{{ inventory_hostname }}
|
3
roles/base/templates/hosts.j2
Normal file
3
roles/base/templates/hosts.j2
Normal file
|
@ -0,0 +1,3 @@
|
|||
127.0.0.1 localhost
|
||||
{{ ansible_default_ipv4["address"] }} {{ inventory_hostname }}
|
||||
|
9
roles/base/templates/motd.j2
Normal file
9
roles/base/templates/motd.j2
Normal file
|
@ -0,0 +1,9 @@
|
|||
This is {{ ansible_fqdn }}
|
||||
|
||||
System : {{ ansible_distribution }} {{ ansible_distribution_version }} ({{ ansible_distribution_release }})
|
||||
|
||||
Kernel : {{ ansible_kernel }} {{ ansible_kernel_version }}
|
||||
CPU(s) : {{ ansible_processor_cores }}
|
||||
RAM : {{ ansible_memory_mb.real.total }}Mb
|
||||
Architecture : {{ ansible_architecture }}
|
||||
Address : {{ ansible_default_ipv4.interface }} - {{ ansible_default_ipv4.address }}
|
Loading…
Add table
Add a link
Reference in a new issue