- Create ansible playbook
- Create
configuration
role inroles
folder directory that will be use to configure apache2 webserver - Create
deployment
role inroles
folder directory that will be use to deploy our website to apache2 webserver - Create an inventory of the servers to configure
The ansible playbook will contain only one play
wich execute the role deployment
in that play you will ensure that all the tasks below will be executed
The configuration role will help us to install and configure apache2 web-server where we can :
- change the
port
of apache web server by setting upapache_port
variable - change the
root-directory
of apache2 by setting upapache_dir
variable
├── defaults
│ └── main.yml # all default variables
├── files
│ └── 000-default.conf
├── handlers
│ └── main.yml
├── README.md
├── tasks
│ └── main.yml
├── templates
│ ├── 000-default.conf.j2
│ └── ports.conf.j2
└── vars
└── main.yml \
The Deployment role will help us to Only deploy our site to the Webserver using the website jinja2 template :
the index.html
could provide informations such as the hostname
, home-directory
, sshuser and server IP
by exploiting ansible-facts
├── defaults
│ └── main.yml\
├── handlers\
│ └── main.yml\
├── meta\
│ └── main.yml
├── README.md\
├── tasks\
│ └── main.yml
├── templates\
│ ├── index.html.j2
│ └── styles.css.j2
├── tests
│ ├── inventory
│ └── test.yml\
└── vars
└── main.yml
The Dockerfile simplify provisionning of ssh-server
by using docker containers
and it uses the marwaney/ssh-server
image
suite de l'exercice :
- suite sur le templating avec les
boucles for
- templating avec des condition
if else
- adding ip-utils
iputils-ping
to deps - creating
/etc/hosts
file wich will contain the dns record of all servers by usingfor loop