This is a collection of Ansible playbooks that can be used to automate the System Administration course practicals.
This repository is created for myself and students who wants to learn
Ansible
. I assumes no responsibility for any damage, any error, as well as students who has used this repository for the exam.
To run the playbook, run the following command:
ansible-playbook site.yml -i inventory/hosts --ask-vault-pass
You can add -v
to see the output of the playbook. -i
is the inventory file and --ask-vault-pass
is to ask for the vault password.
You can use ansible-vault
to create vault.yml
file, so you can store sensitive data in it.
- user
- file
- template
- uri
- lineinfile
- dnf
- firewalld
- systemd
- copy
- sysctl
- yum
- blockinfile
- set_fact
- service
- reboot
- pip
- seboolean
- mysql_user
- mysql_db
- get_url
- unarchive
- shell
- sefcontext
- meta
- pear
- docker_image
- docker_container
- docker_network
- k8s
- waldur_marketplace_os_instance
- waldur_marketplace_os_get_instance
You might need to run
ansible-galaxy collection install ansible.posix
to install the module inposix
.You might need to run
ansible-galaxy collection install community.mysql
to install the module inmysql
.You might need to run
ansible-galaxy collection install community.general
to install the module ingeneral
.You might need to run
ansible-galaxy collection install community.docker
to install the module indocker
.You might need to run following command to install the module in
kubernetes
:ansible-galaxy collection install community.kubernetes ansible-galaxy collection install cloud.common ansible-galaxy collection install kubernetes.coreFor ansible-waldur-module please refer to the ansible-waldur-module repository.
It might be helpful for you to install ansible-waldur-module into user modules.
You might need to change
/.local/lib/python3.8/site-packages/
to yourpython-packages
directory.pip install ansible-waldur-module mkdir -p /home/$USER/.ansible/plugins/modules cp -r /home/$USER/.local/lib/python3.8/site-packages/waldur* /home/$USER/.ansible/plugins/modulesDeep note: I'm not that much good at
python-packages
so the commands above might not work for you.
sys-admin-ansible
├── README.md
├── inventory
│ └── hosts
├── roles
│ ├── apache
│ │ ├── files
│ │ │ ├── modsecurity_localrules.conf
│ │ │ ├── php-fpm.conf
│ │ │ ├── proxy.service
│ │ │ ├── website.py
│ │ │ └── www.conf
│ │ ├── handlers
│ │ │ └── main.yml
│ │ ├── tasks
│ │ │ └── main.yml
│ │ └── templates
│ │ ├── forensic.j2
│ │ ├── index.j2
│ │ ├── virtualhosthttp.j2
│ │ ├── virtualhostproxy.j2
│ │ └── virtualhostword.j2
│ ├── container
│ │ ├── files
│ │ │ ├── Dockerfile
│ │ │ └── server.py
│ │ ├── handlers
│ │ │ └── main.yml
│ │ ├── tasks
│ │ │ └── main.yml
│ │ └── templates
│ │ └── virtualhostproxy.j2
│ ├── devops
│ │ ├── files
│ │ │ └── traefik.toml
│ │ ├── handlers
│ │ │ └── main.yml
│ │ └── tasks
│ │ └── main.yml
│ ├── dns
│ │ ├── files
│ │ │ ├── 70-ipv6.conf
│ │ │ └── named.conf
│ │ ├── handlers
│ │ │ └── main.yml
│ │ ├── tasks
│ │ │ └── main.yml
│ │ └── templates
│ │ ├── hostname.j2
│ │ ├── hosts.j2
│ │ ├── resolv.j2
│ │ ├── reverse.j2
│ │ └── zonefile.j2
│ ├── docker
│ │ ├── files
│ │ │ └── daemon.json
│ │ └── tasks
│ │ └── main.yml
│ ├── email
│ │ ├── files
│ │ │ ├── 10-auth.conf
│ │ │ ├── 10-logging.conf
│ │ │ ├── 10-mail.conf
│ │ │ ├── 10-master.conf
│ │ │ ├── 10-ssl.conf
│ │ │ ├── 15-mailboxes.conf
│ │ │ ├── dovecot.conf
│ │ │ └── master.cf
│ │ ├── handlers
│ │ │ └── main.yml
│ │ ├── tasks
│ │ │ └── main.yml
│ │ └── templates
│ │ ├── config.inc.php.j2
│ │ ├── main.cf.j2
│ │ └── virtualhostmail.j2
│ ├── etais
│ │ ├── tasks
│ │ │ └── main.yml
│ │ └── templates
│ │ └── resolv.j2
│ ├── fs
│ │ ├── files
│ │ │ └── smb.conf
│ │ ├── handlers
│ │ │ └── main.yml
│ │ └── tasks
│ │ └── main.yml
│ ├── k8s
│ │ └── tasks
│ │ └── main.yml
│ ├── kubernetes
│ │ ├── files
│ │ │ ├── kubernetes.repo
│ │ │ └── traefik-config.yaml
│ │ ├── handlers
│ │ │ └── main.yml
│ │ └── tasks
│ │ └── main.yml
│ └── tls
│ ├── files
│ │ ├── 10-ssl.conf
│ │ ├── ca.crt
│ │ ├── cert.crt
│ │ ├── key.key
│ │ └── master.cf
│ ├── handlers
│ │ └── main.yml
│ ├── tasks
│ │ └── main.yml
│ └── templates
│ ├── main.cf.j2
│ ├── virtualhosthttp.j2
│ ├── virtualhostproxy.j2
│ └── virtualhostword.j2
├── site.yml
├── sys-admin-ansible.iml
├── sys-admin-labs.yml
├── templates
│ └── hosts.j2
├── vars.yml
├── vault.yml
├── waldur-create-vm.yml
└── waldur-delete-vm.yml
48 directories, 75 files