Coder Social home page Coder Social logo

ansible-tuto's Introduction

Ansible tutorial

This tutorial presents Ansible step-by-step. You'll need to have a (virtual or physical) machine to act as an Ansible node. A Vagrant environment is provided for going through this tutorial.

Ansible is a configuration management software that lets you control and configure nodes from another machine. What makes it different from other management software is that Ansible uses (potentially existing) SSH infrastructure, while others (Chef, Puppet, ...) need a specific PKI infrastructure to be set up.

Ansible also emphasizes push mode, where configuration is pushed from a master machine (a master machine is only a machine where you can SSH to nodes from) to nodes, while most other CM typically do it the other way around (nodes pull their config at times from a master machine).

This mode is really interesting since you do not need to have a 'publicly' accessible 'master' to be able to configure remote nodes: it's the nodes that need to be accessible (we'll see later that 'hidden' nodes can pull their configuration too!), and most of the time they are.

This tutorial has been tested with Ansible 2.9.

We're also assuming you have a keypair in your ~/.ssh directory.

Quick start

  • install Vagrant if you don't have it
  • install ansible (preferably 2.10.5+ and using pip+virtualenv)
  • vagrant up
  • goto step-00

Complete explanations

Installing Ansible

The reference is the installation guide, but I strongly recommend the Using pip & virtualenv (higly recommended !) method.

Using pip & virtualenv (higly recommended !)

The best way to install Ansible (by far) is to use pip and virtual environments.

Using virtualenv will let you have multiple Ansible versions installed side by side, and test upgrades or use different versions in different projects. Also, by using a virtualenv, you won't pollute your system's python installation.

Check virtualenvwrapper for this. It makes managing virtualenvs very easy.

Under Ubuntu, installing virtualenv & virtualenvwrapper can be done like so:

sudo apt install python3-virtualenv virtualenvwrapper python3-pip
exec $SHELL

You can then create a virtualenv:

mkvirtualenv ansible-tuto
workon ansible-tuto

(mkvirtualenv usually switches you automatically to your newly created virtualenv, so here workon ansible-tuto is not strictly necessary, but lets be safe).

Then, install ansible via pip:

pip install ansible==2.7.1

(or use whatever version you want).

When you're done, you can deactivate your virtualenv to return to your system's python settings & modules:

deactivate

If you later want to return to your virtualenv:

workon ansible-tuto

Use lsvirtualenv to list all your virtual environments.

From source (if you want to hack on ansible source code)

Ansible devel branch is always usable, so we'll run straight from a git checkout. You might need to install git for this (sudo apt-get install git on Debian/Ubuntu).

git clone git://github.com/ansible/ansible.git
cd ./ansible

At this point, we can load the Ansible environment:

source ./hacking/env-setup

From a distribution package (discouraged)

sudo apt-get install ansible

From a built deb package (discouraged)

When running from an distribution package, this is absolutely not necessary. If you prefer running from an up to date Debian package, Ansible provides a make target to build it. You need a few packages to build the deb and few dependencies:

sudo apt-get install make fakeroot cdbs python-support python-yaml python-jinja2 python-paramiko python-crypto python-pip
git clone git://github.com/ansible/ansible.git
cd ./ansible
make deb
sudo dpkg -i ../ansible_x.y_all.deb (version may vary)

Cloning the tutorial

git clone https://github.com/leucos/ansible-tuto.git
cd ansible-tuto

Running the tutorials interactively with Docker

You can run the tutorials here interactively including a very simple setup with docker.

Check this repository for details.

Using Vagrant with the tutorial

It's highly recommended to use Vagrant to follow this tutorial. If you don't have it already, setting up should be quite easy and is described in step-00/README.md.

If you wish to proceed without Vagrant (not recommended!), go straight to step-01/README.md.

Contents

Terminology:

  • command or action: ansible module executed in stand-alone mode. Intro in step-02.
  • task: combines an action (a module and its arguments) with a name and optionally some other keywords (like looping directives).
  • play: a yaml structure executing a list of roles or tasks over a list of hosts
  • playbook: yaml file containing multiple plays. Intro in step-04.
  • role: an organisational unit grouping tasks together in order to achieve something (install a piece of software for instance). Intro in step-12.

Just in case you want to skip to a specific step, here is a topic table of contents.

Contributing

Thanks to all people who have contributed to this tutorial:

(and sorry if I forgot anyone)

I've been using Ansible almost since its birth, but I learned a lot in the process of writing it. If you want to jump in, it's a great way to learn, feel free to add your contributions.

The chapters being written live in the writing branch.

If you have ideas on topics that would require a chapter, please open a PR.

I'm also open on pairing for writing chapters. Drop me a note if you're interested.

If you make changes or add chapters, please fill the test/expectations file and run the tests (test/run.sh). See the test/run.sh file for (a bit) more information.

When adding a new chapter (e.g. step-NN), please issue:

cd step-99
ln -sf ../step-NN/{hosts,roles,site.yml,group_vars,host_vars} .

For typos, grammar, etc... please send a PR for the master branch directly.

Thank you!

ansible-tuto's People

Contributors

7aitsev avatar algal avatar amitit avatar barbosm avatar bernardovale avatar boivie avatar ccschmitz avatar dalton avatar extremelylongusername avatar friz-zy avatar frodopwns avatar htgoebel avatar jellyjellyrobot avatar leucos avatar ludovic-gasc avatar mac2000 avatar mariuszmichalowski avatar matebitte avatar msumulong avatar mxxcon avatar nejern avatar rothgar avatar ruudk avatar skinp avatar terroirman avatar tkermode avatar torenware avatar tumregels avatar turkenh avatar ydakuka 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  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  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

ansible-tuto's Issues

Step-00 not working

When I run vagrant up I get the following error on 64-bit Ubuntu 13.04:

~/projects/workspace/ansible-tuto$ vagrant up
Bringing machine 'host0' up with 'virtualbox' provider...
Bringing machine 'host1' up with 'virtualbox' provider...
Bringing machine 'host2' up with 'virtualbox' provider...
[host0] Importing base box 'precise32'...
Progress: 90%/opt/vagrant/embedded/gems/gems/vagrant-1.3.0/lib/vagrant/machine.rb:204:in `initialize': No such file or directory - /home/shantanukumar/projects/workspace/ansible-tuto/.vagrant/machines/host0/virtualbox/id (Errno::ENOENT)
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.0/lib/vagrant/machine.rb:204:in `open'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.0/lib/vagrant/machine.rb:204:in `open'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.0/lib/vagrant/machine.rb:204:in `id='
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.0/plugins/providers/virtualbox/action/import.rb:15:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.0/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.0/plugins/providers/virtualbox/action/customize.rb:38:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.0/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.0/plugins/providers/virtualbox/action/check_accessible.rb:18:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.0/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.0/lib/vagrant/action/runner.rb:61:in `block in run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.0/lib/vagrant/util/busy.rb:19:in `busy'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.0/lib/vagrant/action/runner.rb:61:in `run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.0/lib/vagrant/action/builtin/call.rb:51:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.0/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.0/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.0/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.0/lib/vagrant/action/builtin/call.rb:57:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.0/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.0/plugins/providers/virtualbox/action/check_virtualbox.rb:17:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.0/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.0/lib/vagrant/action/builder.rb:116:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.0/lib/vagrant/action/runner.rb:61:in `block in run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.0/lib/vagrant/util/busy.rb:19:in `busy'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.0/lib/vagrant/action/runner.rb:61:in `run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.0/lib/vagrant/machine.rb:147:in `action'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.0/lib/vagrant/batch_action.rb:63:in `block (2 levels) in run'

(The precise32 box works fine when I do a standalone vagrant init precise32 followed by vagrant up in a different directory.) What am i doing wrong here?

"sshpass" program needed for step 1

with ansible 1.3 ( just installed from pip) vagrant 1.2.7, ona Debian 7 host calling the command

ansible-playbook -i step-00/hosts step-00/setup.yml --ask-pass --sudo

results in the following ansible errors while gathering facts:

fatal: [192.168.33.11] => to use the 'ssh' connection type with passwords, you must install the sshpass program
fatal: [192.168.33.10] => to use the 'ssh' connection type with passwords, you must install the sshpass program
fatal: [192.168.33.12] => to use the 'ssh' connection type with passwords, you must install the sshpass program

after installing the sshpass program, everything work as expected. Maybe this should be added as a requirement ?

vagrant up fails on setting hostname

==> host0: Setting hostname...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

hostnamectl set-hostname 'host0'

Stdout from the command:



Stderr from the command:

stdin: is not a tty
bash: line 2: hostnamectl: command not found

Write chapter about custom plugins

As suggested in #58, write a chapter about custom plugins.
For instance, write a custom plugin to take a node in and out from haproxy.
This would also demonstrate delegation.

Step_04 show case for idempotency is broken

With step-04/apache.yml

When I perform second try to

$ ansible-playbook -i step-04/hosts -l host1.example.org step-04/apache.yml

I always got

PLAY RECAP *********************************************************************
host1.example.org          : ok=2    changed=1    unreachable=0    failed=0   

May be set update_cache to true in apt task

In this case I got

```PLAY RECAP *********************************************************************
host1.example.org          : ok=2    changed=0    unreachable=0    failed=0 


markdown formatting nitpicks

If you do fenced code blocks instead of indenting github will highlight the yaml - as is the included files are readable in the editor but the README on the browser isn't very attractive. Compare the following:

- hosts: web
  tasks:
    - name: Installs apache web server
      apt: pkg=apache2 state=installed update_cache=true
- hosts: web
  tasks:
    - name: Installs apache web server
      apt: pkg=apache2 state=installed update_cache=true

I think the fenced code blocks greatly enhance readability - I'm reading the tutorial README's on github while following along in the terminal.

I'm willing to submit a PR which makes this change!

Thanks for writing a great tutorial!

Error in step-00, in the task "Checks if resolver is working properly with new nameserver"

Hi,

I am seeing the following error when running the following command in step-00 :

ansible-playbook -c paramiko -i step-00/hosts step-00/setup.yml --ask-pass --sudo

TASK: [Checks if resolver is working properly with new nameserver] ************ 
failed: [192.168.33.12] => {"cmd": ["host", "-t", "A", "ansible.cc"], "failed": true, "rc": 2}
msg: [Errno 2] No such file or directory
failed: [192.168.33.10] => {"cmd": ["host", "-t", "A", "ansible.cc"], "failed": true, "rc": 2}
msg: [Errno 2] No such file or directory
failed: [192.168.33.11] => {"cmd": ["host", "-t", "A", "ansible.cc"], "failed": true, "rc": 2}
msg: [Errno 2] No such file or directory

FATAL: all hosts have already failed -- aborting

I am using centos 6 boxes instead of the precise 32 boxes defined in the Vagrantfile.

Could that be the reason for this error?

I am able to run the command host -t A ansible.cc in the command prompt without errors.

What could be the problem?

Thanks!
Sundar

Step-11: Readme does not match template.

The template as show in the readme contains "{% if haproxy_stats_socket %}" twice, while the actual file does contain it only once. Which is the intended one?

sshpass on AWS Centos

I just followed the documentation (http://docs.ansible.com/ansible/intro_installation.html) and I'm getting this error:

error: Failed dependencies:
sshpass is needed by ansible-2.2.0-0.git201605061649.fca5ba1.devel.amzn1.noarch

when running
sudo rpm -Uvh ./rpm-build/ansible-*.noarch.rpm

I found another thread with this issue which is closed so I am not sure if I am experiencing this because something is misconfigured or I really need to install sshpass.

step 06 (and probably other steps) are mis-formatted

...
- name: Deactivates the default ssl virtualhost
command: a2dissite default-ssl

notify:
    - restart apache

...

should be:

- name: Deactivates the default ssl virtualhost
  command: a2dissite default-ssl
  notify:
    - restart apache

Connections issues - step00

Hi

I am unable to connect to vagrant using ansible-playbook -c paramiko -i step-00/hosts step-00/setup.yml --ask-pass --become

I am having an error - fatal: [host0.example.org]: UNREACHABLE! => {"changed": false, "msg": "Authentication failed.", "unreachable": true}

I can connect to it via ssh directly (vagrant ssh host0 or ssh -p 2222 vagrant@localhost)

I dont have any keys stored in the VM or my machine, as the tutorial says it is not needed (While this is not absolutely necessary (Ansible can use sudo, password authentication, etc...), it will make things way easier.)

Could this be the problem?

Thanks

Can I translate your work into Chinese?

Hi, I think your tutor is very useful for new ansible users, and I want to translate your work into Chinese so more people can read it easily.

Is that ok to do this? And if you approve this, I may start from parts that you have finished. (Once you have a new chapter ready, I will translate it.) Any suggestions?

Step-10 README.md - no %if block

In Step-10 README.md, paragraph starting from line 44 talks about {% if ... block, but haproxy.cfg.j2 template doesn't have anything like that.

Error with TASK: [Updates apt cache]

I process all the files as you mentioned (your vagrantfile with the 3 virtual machines).
But when I proceed ansible-playbook -i step-09/hosts step-09/apache.yml,
I have these error :
failed: [host2.example.org] => {"failed": true} msg: Failed to lock apt for exclusive operation
I tried ansible -i step-02/hosts -m shell -a 'apt-get update' host2.example.org, it runs well... I've searched some similar issues in github ansible, but there's no clear answer about these problem. I'm using vagrant 1.7.2 & ansible 1.8.1 on OS X 10.10. Any idea ?

[update] when i do :
ansible-playbook -i step-09/hosts step-09/apache.yml -l host1.example.org it works
and
ansible-playbook -i step-09/hosts step-09/apache.yml -l host2.example.org it also works
but
ansible-playbook -i step-09/hosts step-09/apache.yml failed on one host with error mentioned above

Write chapter 14 (roles)

Explore role dependencies as suggested in #58.
Replace apache with nginx+php5-fpm as an example, where php5-fpm will install nginx as a dependency.

Solution: No need to run both playbooks in step-10

In step-10/README.md you write: "Well, to tell the truth, we must run both of them at the same time, since the haproxy playbook requres facts from the two webservers. TODO: This is annoying. Find a way."

While I'm a newbie to ansible, I found this working for me: Just add the line

- hosts: web

to the top of step-10/haproxy.yml. This makes ansible gathering the facts for the webserver and the playbook runs.

step-07 not working with ansible 1.3 dev

The when_failed keyword does not seem to be testing the success of the result of action: command a2ensite awesome-app as intended.

Instead of seeing:

TASK: [Check that our config is valid] ********************* 
failed: [host1.example.org] => {"changed": true, "cmd": ["apache2ctl", "configtest"], "delta": "0:00:00.051874", "end": "2013-03-10 10:50:17.714105", "rc": 1, "start": "2013-03-10 10:50:17.662231"}
stderr: Syntax error on line 2 of /etc/apache2/sites-enabled/awesome-app:
Invalid command 'RocumentDoot', perhaps misspelled or defined by a module not included in the server configuration
stdout: Action 'configtest' failed.
The Apache error log may have more information.
...ignoring

TASK: [Rolling back - Restoring old default virtualhost] ********************* 
changed: [host1.example.org]

I see:

TASK: [Check that our config is valid] ****************************************
failed: [host1.example.org] => {"changed": true, "cmd": ["apache2ctl", "configtest"], "delta": "0:00:00.017965", "end": "2013-08-17 10:00:56.187983", "rc": 1, "start": "2013-08-17 10:00:56.170018"}
stderr: Syntax error on line 2 of /etc/apache2/sites-enabled/awesome-app:
Invalid command 'RocumentDoot', perhaps misspelled or defined by a module not included in the server configuration
stdout: Action 'configtest' failed.
The Apache error log may have more information.
...ignoring

TASK: [Rolling back - Restoring old default virtualhost] **********************
fatal: [host1.example.org] => Conditional expression must evaluate to True or False: is_failed($result)

This is on Python 2.7.2, with ansible 1.3 (devel 5847720746).

I'm running ansible from the dev branch because I could not get step-00 to run successfully on the latest release build of ansible (v 1.2.2), so I assumed one needed at least ansible 1.3 for the tutorial to work.

Step 00 - Fails if public key doesn't exists

When you create a new Vagrant file, the public key for root it's inexistent.

TASK: [Pushes user's rsa key to root's vagrant box (it's ok if this TASK fails)] ***
failed: [192.168.33.10] => {"failed": true}
msg: could not find src=/root/.ssh/id_rsa.pub
...ignoring
failed: [192.168.33.11] => {"failed": true}
msg: could not find src=/root/.ssh/id_rsa.pub
...ignoring
failed: [192.168.33.12] => {"failed": true}
msg: could not find src=/root/.ssh/id_rsa.pub
...ignoring

TASK: [Pushes user's dsa key to root's vagrant box (it's NOT ok if both TASKs fail)] ***
failed: [192.168.33.10] => {"failed": true}
msg: could not find src=/root/.ssh/id_dsa.pub
failed: [192.168.33.12] => {"failed": true}
msg: could not find src=/root/.ssh/id_dsa.pub
failed: [192.168.33.11] => {"failed": true}
msg: could not find src=/root/.ssh/id_dsa.pub

The creation of this file it's quite simple but maybe isn't for newcomers and since this is a tutorial for first steps with Ansible maybe it's a good idea to also automate this first task.

ansible.cfg

Hello.
i can not locate ansible.cfg

[DEPRECATION WARNING]: State 'installed' is deprecated. Using state 'present' instead.. This feature will be removed in version 2.9. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.

step-04 no ansible_ssh_user=root ?

Hi,

I am only at the first steps and I was wondering whether it is normal that on step-04, you did not write "ansible_ssh_user=root" for the host:

[web]
host1.example.org

I had to add "ansible_ssh_user=root" in my host file otherwise there is an error that SSH cannot establish the connection.
I guess it is a matter of user (because it tries to connect as vagrant) but I was wondering if in your case it was really working without it or if you just forgot it on the tuto?
I am using Vagrant.

Well, I am a bit confused about what user to use. What do you recommend? Is it good using root?

Anyway, great tuto ;) Thanks!

Step00 Connection Issues

When I bring up the VMs and then attempt to run your command in Step00 which would add my keys to the environment, I get the following:

Minisaurus:ansible-tuto ksilanskas$ ansible-playbook -c paramiko -i step-00/hosts step-00/setup.yml --    ask-pass --sudo
SSH password:

PLAY [all] ********************************************************************

GATHERING FACTS ***************************************************************
fatal: [192.168.33.11] => {'msg': 'FAILED: Authentication failed.', 'failed': True}
fatal: [192.168.33.12] => {'msg': 'FAILED: Authentication failed.', 'failed': True}
fatal: [192.168.33.10] => {'msg': 'FAILED: Authentication failed.', 'failed': True}

TASK: [Creates destination directory] *****************************************
FATAL: no hosts matched or all hosts have already failed -- aborting


PLAY RECAP ********************************************************************
           to retry, use: --limit @/Users/ksilanskas/setup.retry

192.168.33.10              : ok=0    changed=0    unreachable=1    failed=0
192.168.33.11              : ok=0    changed=0    unreachable=1    failed=0
192.168.33.12              : ok=0    changed=0    unreachable=1    failed=0

When the VMs come up they don't seem to have these addresses. Instead they broadcast a localhost address (127.0.0.1) with a port if that helps at all.

Versions

  • Vagrant - 1.5.4
  • Ansible - 1.7.1

Additional Steps Taken

  • Created a key pair (default) id_rsa and set permissions to 700.
  • Ran ssh-add ~/.ssh/id_rsa

Finish tutorial!

Hey there. I really enjoyed this tutorial - great work! A pity that it stops when it becomes really interesting! Could you continue writing it, please? :)

Role skeleton

Hi Michel,

thanks so much for the nice tutorial. I found it very useful. Since, as far as I can see you're very open to let other people helping you in improving it I would like to suggest a change in chapter 12. Instead of creating the role skeleton via

mkdir -p step-12/roles/haproxy/{tasks,handlers,templates}
cp step-11/templates/haproxy.cfg.j2 step-12/roles/haproxy/templates/

It's better to do it using ansible-galaxy:

$ ansible-galaxy --offline init simple-role
- simple-role was created successfully
$ ls
simple-role
$ ls -alR simple-role/
total 16
drwxr-xr-x 12 gutter staff 408 Nov 8 10:16 .
drwxr-xr-x 3 gutter staff 102 Nov 8 10:16 ..
-rw-r--r-- 1 gutter staff 539 Nov 8 10:16 .travis.yml
-rw-r--r-- 1 gutter staff 1328 Nov 8 10:16 README.md
drwxr-xr-x 3 gutter staff 102 Nov 8 10:16 defaults
drwxr-xr-x 2 gutter staff 68 Nov 8 10:16 files
drwxr-xr-x 3 gutter staff 102 Nov 8 10:16 handlers
drwxr-xr-x 3 gutter staff 102 Nov 8 10:16 meta
drwxr-xr-x 3 gutter staff 102 Nov 8 10:16 tasks
drwxr-xr-x 2 gutter staff 68 Nov 8 10:16 templates
drwxr-xr-x 4 gutter staff 136 Nov 8 10:16 tests
drwxr-xr-x 3 gutter staff 102 Nov 8 10:16 vars

simple-role//defaults:
total 8
drwxr-xr-x 3 gutter staff 102 Nov 8 10:16 .
drwxr-xr-x 12 gutter staff 408 Nov 8 10:16 ..
-rw-r--r-- 1 gutter staff 36 Nov 8 10:16 main.yml

simple-role//files:
total 0
drwxr-xr-x 2 gutter staff 68 Nov 8 10:16 .
drwxr-xr-x 12 gutter staff 408 Nov 8 10:16 ..

simple-role//handlers:
total 8
drwxr-xr-x 3 gutter staff 102 Nov 8 10:16 .
drwxr-xr-x 12 gutter staff 408 Nov 8 10:16 ..
-rw-r--r-- 1 gutter staff 36 Nov 8 10:16 main.yml

simple-role//meta:
total 8
drwxr-xr-x 3 gutter staff 102 Nov 8 10:16 .
drwxr-xr-x 12 gutter staff 408 Nov 8 10:16 ..
-rw-r--r-- 1 gutter staff 1604 Nov 8 10:16 main.yml

simple-role//tasks:
total 8
drwxr-xr-x 3 gutter staff 102 Nov 8 10:16 .
drwxr-xr-x 12 gutter staff 408 Nov 8 10:16 ..
-rw-r--r-- 1 gutter staff 33 Nov 8 10:16 main.yml

simple-role//templates:
total 0
drwxr-xr-x 2 gutter staff 68 Nov 8 10:16 .
drwxr-xr-x 12 gutter staff 408 Nov 8 10:16 ..

simple-role//tests:
total 16
drwxr-xr-x 4 gutter staff 136 Nov 8 10:16 .
drwxr-xr-x 12 gutter staff 408 Nov 8 10:16 ..
-rw-r--r-- 1 gutter staff 9 Nov 8 10:16 inventory
-rw-r--r-- 1 gutter staff 69 Nov 8 10:16 test.yml

simple-role//vars:
total 8
drwxr-xr-x 3 gutter staff 102 Nov 8 10:16 .
drwxr-xr-x 12 gutter staff 408 Nov 8 10:16 ..
-rw-r--r-- 1 gutter staff 32 Nov 8 10:16 main.yml

Regards,
Davide

Step-10 haproxy playbook error.

I'm getting this error

NOTIFIED: [restart haproxy] *********************
failed: [172.30.113.88] => {"failed": true}
msg: [WARNING] 077/182648 (2411) : config : missing timeouts for proxy 'cluster'.
   | While not properly invalid, you will certainly encounter various problems
   | with such a configuration. To fix this, please ensure that all following
   | timeouts are set to a non-zero value: 'client', 'connect', 'server'.
[ALERT] 077/182648 (2411) : Starting proxy cluster: cannot bind socket

PLAY RECAP *********************
172.30.113.88                  : ok=4    changed=3    unreachable=0    failed=1

Seems like that template is incomplete..
Ubuntu 12.04.2 LTS, haproxy 1.4.18-0ubuntu1

Use Ansible 2.x syntax everywhere

Hello @leucos. I was wondering if we can go ahead and assume that new users would be using Ansible 2. If so, we should modify some files to use Ansible new variables such as become, become_user, ansible_user, ansible_port and much more, what do you think about this?

Add guidance on setting up Vagrant IP-addresses

https://github.com/leucos/ansible-tuto/blob/master/step-00/README.md

After putting:

ansible-playbook -c paramiko -i step-00/hosts step-00/setup.yml --ask-pass --sudo

I get:

PLAY [all] ******************************************************************** 

GATHERING FACTS *************************************************************** 
fatal: [192.168.33.12] => {'msg': 'FAILED: timed out', 'failed': True}
fatal: [192.168.33.11] => {'msg': 'FAILED: timed out', 'failed': True}
fatal: [192.168.33.10] => {'msg': 'FAILED: timed out', 'failed': True}

TASK: [Creates destination directory] ***************************************** 
FATAL: no hosts matched or all hosts have already failed -- aborting


PLAY RECAP ******************************************************************** 
           to retry, use: --limit @/Users/apoikola/setup.retry

192.168.33.10              : ok=0    changed=0    unreachable=1    failed=0   
192.168.33.11              : ok=0    changed=0    unreachable=1    failed=0   
192.168.33.12              : ok=0    changed=0    unreachable=1    failed=0 

Question: Overview on starting the tutorial

Stupid noob question, sorry.

Do I install ansible in another linux host, say it's called - David?

Then the tutorial will operate against the three hosts in the vagrant file host0 host1 host2?

Note:
Windows...
I think want to use a vagrant ubuntu machine for ansible called David running on Windows, and run the three vagrant hosts from step-00 for the tutorial to operate on.

Mistype?

apt-get install python-yaml python-jinja2 python-paramiko python-crypt
=> python-crypto

Failed ping with ansible

Hello, I just started to learn ansible (self-learning) following this tutorial, but I met problem at the first step:

yifang@HPC:~/study/ansible-tuto$ ansible -m ping all -i step-01/hosts
host0.example.org | FAILED! => {
    "failed": true, 
    "msg": "The module ping was not found in configured module paths. Additionally, core modules are missing. If this is a checkout, run 'git submodule update --init --recursive' to correct this problem."
}
host1.example.org | FAILED! => {
    "failed": true, 
    "msg": "The module ping was not found in configured module paths. Additionally, core modules are missing. If this is a checkout, run 'git submodule update --init --recursive' to correct this problem."
}
host2.example.org | FAILED! => {
    "failed": true, 
    "msg": "The module ping was not found in configured module paths. Additionally, core modules are missing. If this is a checkout, run 'git submodule update --init --recursive' to correct this problem."
}

And my ansible and vagrant are updated versions.

$ ansible --version
ansible 2.2.0 (devel 0a0b44baeb) last updated 2016/06/15 16:04:18 (GMT -600)
  lib/ansible/modules/core:  not found - use git submodule update --init lib/ansible/modules/core
  lib/ansible/modules/extras:  not found - use git submodule update --init lib/ansible/modules/extras
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides
$ vagrant --version
Vagrant 1.8.4

Could you please give me some advice to debug?
Thank you!
Yifang

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.