GithubHelp home page GithubHelp logo

redhatnordicssa / ansible-roadshow Goto Github PK

View Code? Open in Web Editor NEW
87.0 14.0 101.0 72.84 MB

One day hands on lab with Ansible and Ansible Tower

License: GNU General Public License v3.0

Shell 26.73% Python 72.65% Jinja 0.62%

ansible-roadshow's Introduction

ansible-roadshow

Hello and welcome. This is a hands on lab with Ansible and Ansible Tower.

What is this?

This is a lab which provides an introduction to Ansible, Ansible Tower, how to write Ansible content and how to work with Ansible at scale. At the end of the day, you will know enough to go out in the real world and do real useful stuff.

Estimated time to complete this lab is 4-6 hours, depending on previous experience.

For an overview of the lab, go to: Lab overview

What is this NOT?

A complete walkthrough of all Ansible features and best practices. If you think something important is missing: contribute. For more information about contributing, see: Contributing.

You may also want to have a look at https://github.com/ansible/lightbulb which is a more complete walkthrough of all things Ansible.

❗ Some basic advise; This lab is not about doing it as fast as possible. It's about learning. Take your time to read the labs properly.

Maintainers

This lab is maintained by members of Red Hat's Nordic Solution Architect team.

Contributing

This lab is an open source (GPL 3.0) project, so if you find any problems with it, feel free to open up an issue or send a pull request. For more information about contributing to this project, please see:

For information about installing this lab, go to the bottom of this page.

Lab overview

The lab includes information about:

  • Ansible basics (clientless nature, inventory, ansible-playbook basic commands)
  • Git workflows for working with Ansible (GitHub workflow)
  • How to create playbooks (basic playbooks, work with inventories and groups, encrypted vaults)
  • How to work with roles (transform a playbook to a role)
  • Ansible Tower (projects, inventories, job templates, credentials)
  • An introduction to Ansible Galaxy
  • How to create your own Ansible module
  • How to work with Ansible code
  • Ansible Tower basics
  • How to test your Ansible playbooks and roles

BELOW is an overview of the labs. This is for the students in the lab.
❗ Start at 0 and go forward to 10. The labs depends on each other, so don't skip stuff.

  1. Getting started

  2. Ansible basics

  3. Writing Your First Playbook

  4. Writing the Wildfly Playbook

  5. Writing the Load Balancer Playbook

  6. Handling Secrets with Ansible Vault

  7. Working with Ansible as code

  8. Introducing Ansible Tower

  9. Installing wildfly and nginx from Tower

  10. Testing Ansible playbooks

  11. Developing Ansible Modules

Lab prerequisites

  • Internet access
  • A web browser
  • A SSH client installed on your laptop/workstation
  • Ability to SSH to thing on the internet (port: 22/tcp)

Setting up the lab on AWS

This is for operators of the lab. Go to below page for information about setting up this lab on Amazon: Setting up the Ansible lab on AWS

ansible-roadshow's People

Contributors

0xs avatar appyoo avatar charn avatar cybette avatar didr avatar drug5 avatar fsoderblom avatar gudvardur avatar idarlund avatar ikke-t avatar jacobborella avatar jannepik avatar juppe avatar mattikbk avatar mglantz avatar mrmeee avatar namob avatar numas avatar pasmon avatar pgustafs avatar rurikon avatar sigurdurdahl avatar tctovsli avatar teemu-u avatar terop avatar tfriman avatar thmarth avatar tobiasbp avatar tobiasehlert avatar tomuxi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ansible-roadshow's Issues

Lab 6: very unclear instructions for GitHub

You are almost required to know git in order to complete this lab.

I suggest that a disclaimer in the top reads "you can skip this lab if you know git".

Then make the instructions more clear on how to use git with step by step instructions.

lab-09: needs more handson

Lab doesn't really contain any work..

Some playbooks with faults (wrong indentation, typos, others) should be created...

Lab1, tower server can't reach managed nodes over ssh

$ ansible -i hosts all -m ping
wildfly2 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: ssh: connect to host 34.240.6.124 port 22: Connection timed out\r\n",
"unreachable": true
}
wildfly1 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: ssh: connect to host 52.210.56.118 port 22: Connection timed out\r\n",
"unreachable": true
}
loadbalancer1 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: ssh: connect to host 34.241.117.172 port 22: Connection timed out\r\n",
"unreachable": true
}

Lab 1 : Ansible version

The versions are not aligned.

In instructions :

$ansible --version
ansible 2.4.2.0
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /bin/ansible
python version = 2.7.5 (default, May 3 2017, 07:55:04) [GCC 4.8.5 20150623 (Red Hat 4.8.5-14)]

Command line gives the following :

$ansible --version
ansible 2.6.3
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/home/student/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.5 (default, May 31 2018, 09:41:32) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]

Lab 1 :

Please specify that the user should ssh with user : student.

"Ensure that you are logged in to your Ansible control server."

Lab3

"Finally you need to apply the newly created role to your wildflyservers group. In dir $WORK_DIR create a file named site.yml. Put the following content into the file:"

Please introduce the concept of "role".

gitlab server provisioning fails

PLAY [setup stuff in Gitlab VMs] ***************************************************************************************

TASK [Gathering Facts]
This is before I setup the gitlab key. Is it expected for the playbook to fail then?
@teemu-u @pgustafs


The authenticity of host '18.196.100.102 (18.196.100.102)' can't be established.
ECDSA key fingerprint is SHA256:eFbgxanqdTzH8pOsO1PJk4nmRPmmjinrZkwaNowkA8k.
Are you sure you want to continue connecting (yes/no)? yes
fatal: [18.196.100.102]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: Warning: Permanently added '18.196.100.102' (ECDSA) to the list of known hosts.\r\[email protected]: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).\r\n", "unreachable": true}
to retry, use: --limit @/Users/mglantz/code/github/ansible-roadshow/content/provision-all.retry

Naming - Control server

In the labs we are referring to control server. In the machine info about the labs containing IP and username we say Ansible Tower (not control server). Maybe we should change the description in the labs calling it ansible tower instead.

ssh-key should be generated on fly, not to use public one

This is "looks bad security habbit" -kinda issue, but it hurts me see we share private ssh key in github. We should generate the key for the first user, and keep inserting the key everywhere by ansible.

E.g: Run ssh-keygen on the tower machine, register and print it to local file. Then push it to all the machines for student users.

add all playbooks needed into provision-all.yml

There is the provision-all playbook that should do it all in one playbook run. I added instance creation and gitlab install while I tried gitlab part. Make sure all parts are included. Still missing at least:

  1. tower install
  2. lab machines configs
  3. gitlab add users and import project.

When lab 8 is done, lab 7 will not work

This is because lab 8 introduces roles, which has secrets in the inventory. Either we should create new inventory for lab 8, or add secret to the ping template. Discuss which is preferred. We need a compromise to keep description short.

Shouldn't use root user

LAB1:
ansible -i hosts -u root all -m ping

Should be changed to:

ansible -i hosts -u student all -m ping

Lab1 :

where X,Y,Z are replaced by the numbers for servers assigned to you.

should be

client_system_X,client_system_Y,client_system_Z are replaced by the IPs for servers assigned to you.

client systems unreachable, permission denied

[root@ip-172-31-29-42 work]# ansible -i hosts -u root all -m ping
52.213.129.63 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).\r\n",
"unreachable": true
}
34.253.133.33 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).\r\n",
"unreachable": true
}
34.245.231.98 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).\r\n",
"unreachable": true
}

Lab3, student user not allowed to do sudo on managed nodes

$ ansible-playbook -i hosts site.yml

PLAY [wildflyservers] *************************************************************************************************************************************************************

TASK [Gathering Facts] ************************************************************************************************************************************************************
fatal: [client_system_3]: FAILED! => {"changed": false, "module_stderr": "Shared connection to 34.242.233.117 closed.\r\n", "module_stdout": "sudo: a password is required\r\n", "msg": "MODULE FAILURE", "rc": 1}
fatal: [client_system_2]: FAILED! => {"changed": false, "module_stderr": "Shared connection to 34.246.180.58 closed.\r\n", "module_stdout": "sudo: a password is required\r\n", "msg": "MODULE FAILURE", "rc": 1}
to retry, use: --limit @/home/student/work/site.retry

PLAY RECAP ************************************************************************************************************************************************************************
client_system_2 : ok=0 changed=0 unreachable=0 failed=1
client_system_3 : ok=0 changed=0 unreachable=0 failed=1

Lab1, ansible -i hosts all -m ping

[student@ip-172-31-29-72 work]$ ansible -i hosts all -m ping
client_system_3 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).\r\n",
"unreachable": true
}
client_system_1 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).\r\n",
"unreachable": true
}
client_system_2 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).\r\n",
"unreachable": true
}

Lab 0: inconsistency in naming

Lab 0 refer to control server, but this isn't refered to in the diagram. Furthermore control server is not a term in Asnible. Use Tower server instead.

lab3, play recap does not display IP as stated in the labs

PLAY RECAP ************************************************************************************************************************************************************************
client_system_2 : ok=8 changed=5 unreachable=0 failed=0
client_system_3 : ok=8 changed=0 unreachable=0 failed=0

Inconsistency in naming.

Lab 1
Instruction in lab 1 refer to ‘you got three servers assigned to you’. The email you receive when joining says refer to 'Client Systems'. Make sure those two things are aligned.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.