Ansible Key Points
Ansible Key Points
This repository will have all our ansible learnings and our CM of the Project.
What is a play ?
What is a task ?
ex: Installing a package, checking the uptime of the machine , creating a user account . .
..
A Fact is nothing but a property of the target node. Before you run any playbook, ansible
collects all the facts and keep it ready.
Note: Above command will show you the list of all the FACTS that your ansible is
covering.
5) Changes of intended actions like deletion / uptating /creation will have greater
control
Ref: https://docs.ansible.com/ansible/latest/user_guide/playbooks_reuse_roles.html
ROLES Strcutre
roles/
common/ # this hierarchy represents a "role"
tasks/ #
handlers/ #
files/ #
foo.sh # <-- script files for use with the script resource
vars/ #
defaults/ #
meta/ #
webtier/ # same kind of structure as "common" was above, done for the
webtier role
monitoring/ # ""
fooapp/ # ""
Role dependencies let you automatically pull in other roles when using a role.
Role dependencies are prerequisites, not true dependencies. The roles do not have a
parent/child relationship. Ansible loads all listed roles, runs the roles listed under
dependencies first, then runs the role that lists them. The play object is the parent of all
roles, including roles called by a dependencies list.
Role dependencies are stored in the meta/main.yml file within the role directory. This
file should contain a list of roles and parameters to insert before the specified role. For
example:
roles/myapp/meta/main.yml
---
dependencies:
- role: common
vars:
some_parameter: 3
- role: apache
vars:
apache_port: 80
- role: postgres
vars:
dbname: blarg
other_parameter: 12
Ansible always executes roles listed in dependencies before the role that lists them.
Ansible executes this pattern recursively when you use the roles keyword. For example,
if you list role foo under roles:, role foo lists role bar under dependencies in its
meta/main.yml file, and role bar lists role baz under dependencies in its meta/main.yml,
Ansible executes baz, then bar, then foo
This is just a teset message added to send the changes from feature to main
branch
1. I want to take the changes of PROD Branch and merge then to master branch
What is a conflict ? --> If the same file is edited by two people in the checkout and if the
file is merfed and the person 2 will see a confict stating that this file is modisied since
your last checkout!!! Then you need to resolve the conflict, but merging the person1
changes to your repo or accept the changes.
ansible-pull -U https://github.com/b49-clouddevops/ansible.git -e
COMPONENT=frontend -e ENV=dev -e TAG_NAME=0.0.2 roboshop.yml
Blockers: