Skip to content

Latest commit

 

History

History
48 lines (28 loc) · 3.1 KB

Task5.md

File metadata and controls

48 lines (28 loc) · 3.1 KB

Task.

By the link https://github.com/yurnov/IaC_Ansible_basecamp/blob/9ed49abab70f135495bf9738b2657c12076ab39a/08-homework.md

Solution

  1. Create 4 linux machines in AWS

  1. Create a inventory file with four groups, each provisioning VM should be in separate group and group named iaas what should include childrens from two first groups.

Is available by the link (in INI format): https://github.com/AndrukhivAndriy/DevOps-BaseCamp/blob/18a64d678d1a19f233e223ea34098f2055197f0b/ansible/hosts.ini

  1. Create Role: creating a empty file /etc/iaac with rigths 0500

Is available by the link: https://github.com/AndrukhivAndriy/DevOps-BaseCamp/tree/main/ansible/roles/create_empty_file

  1. Create Role: fetch a linux distro name/version.

In this case we will print all data on web page via using Jinja Template. So, the resoults are shown on next pictures.

The Role is available by the link: https://github.com/AndrukhivAndriy/DevOps-BaseCamp/tree/main/ansible/roles/fetch_distro_name

To run scripts - go to the folder Ansible in shell and run ansible-playbook main.yml

Optional: use ansible_user and ansible_password for ssh connection and store passwords via Vault

Encrypt user password. The password is in file ./pass. We will use Ad-Hoc:

ansible-vault encrypt_string --vault-password-file pass --name ansible_password

The Playbook wich realise taks is available by the link: https://github.com/AndrukhivAndriy/DevOps-BaseCamp/blob/18a64d678d1a19f233e223ea34098f2055197f0b/ansible/playbook3.yml

The password is "hello" and file with password is available by the link: https://github.com/AndrukhivAndriy/DevOps-BaseCamp/blob/18a64d678d1a19f233e223ea34098f2055197f0b/ansible/pass

To run Playbook use : ansible-playbook playbook3.yml --vault-password-file ./pass

P.S.

THE HOLE SCRIPTS ARE - https://github.com/AndrukhivAndriy/DevOps-BaseCamp/tree/main/ansible