5 thoughts on “Ansible: Up and Running

  1. Hi Lorin,

    I would like to say congrats for bringing this book to life. I appreciate your effort and enthusiasm. I am completely new to Ansible so I grabbed a copy of book preview. As I followed through the tutorial but with different kind of setup by using a cloud AWS EC2 with AMI Linux as a test server instead of Vagrant box. When I reached into the topic on running Playbook, I encountered the following error:

    Ansible 1.7.2

    mcbkpro13:playbook kismet$ ls
    ansible.cfg files inventory web-nossl.yml
    mcbkpro13:playbook kismet$ ansible-playbook web-nossl.yml

    PLAY [Configure webserver with nginx] *****************************************

    GATHERING FACTS ***************************************************************
    ok: [testserver]

    TASK: [install nginx] *********************************************************
    ok: [testserver]

    TASK: [copy nginx config file] ************************************************
    failed: [testserver] => {“failed”: true, “md5sum”: “d05c44d809625b56dc4d034258a702f8″}
    msg: Destination directory /etc/nginx/sites-available does not exist

    FATAL: all hosts have already failed — aborting

    PLAY RECAP ********************************************************************
    to retry, use: –limit @/Users/kismet/web-nossl.retry

    testserver : ok=2 changed=0 unreachable=0 failed=1

    mcbkpro13:playbook kismet$

    Below is the AMI Linux version on AWS:

    NAME=”Amazon Linux AMI”
    VERSION=”2014.09″
    ID=”amzn”
    ID_LIKE=”rhel fedora”
    VERSION_ID=”2014.09″
    PRETTY_NAME=”Amazon Linux AMI 2014.09″
    ANSI_COLOR=”0;33″
    CPE_NAME=”cpe:/o:amazon:linux:2014.09:ga”
    HOME_URL=”http://aws.amazon.com/amazon-linux-ami/”
    Amazon Linux AMI release 2014.09

    I figured out the issue was due to a directory /etc/nginx/sites-available not created beforehand. I was thinking that Ansible would automatically create this directory if it doesn’t exist. I have yet to test this thru Vagrant but would like to hear your feedback on this as you are definitely the best person to shed light on the issue 🙂

    Again I commend you for writing the book.

    Looking to forward to hearing from you.

    Regards,

    Eduardo B.

    1. Hi Eduardo:

      Thanks for the kind words. I haven’t looked too closely at this, but my guess is that Nginx packaged for AMI Linux uses a different directory structure than Nginx packaged for Ubuntu. It wouldn’t be enough to ensure that directory is created. You would need to identify what directory Nginx uses on AMI Linux for its configuration files, and then modify the playbook to use that directory instead.

  2. Hi Lorin,

    With the recent purchase of Ansible by RHEL, I was concern about the future of the project and recently I saw that you stepped down as maintainer too. What is your opinion about the future of the project ?

    Thanks in advance

    1. I stepped down as maintainer because I didn’t have the spare time to do proper reviews, and because I no longer work with Ansible as part of my day job, so I’m not really able to keep up with the project anymore (I started working at Netflix a few months ago). It’s just a coincidence that Ansible, Inc. was acquired by RHEL shortly before I stepped down.

      (Note that I originally responded to this on twitter).

  3. Hi Lorin,

    Ansible up and running

    ch08

    i did following before

    1. ssh-add /home/shamim/.vagrant.d/insecure_private_key

    2. eval $(ssh-agent)

    3 . cp secrets.yml.example secrets.yml

    4. cd playbooks

    5. vagrant up

    [shamim@oc4683017473 playbooks]$ vagrant ssh-config
    Host db
    HostName 127.0.0.1
    User vagrant
    Port 2222
    UserKnownHostsFile /dev/null
    StrictHostKeyChecking no
    PasswordAuthentication no
    IdentityFile /home/shamim/.ssh/id_rsa
    IdentityFile /home/shamim/.vagrant.d/insecure_private_key
    IdentitiesOnly yes
    LogLevel FATAL
    ForwardAgent yes

    Host web
    HostName 127.0.0.1
    User vagrant
    Port 2200
    UserKnownHostsFile /dev/null
    StrictHostKeyChecking no
    PasswordAuthentication no
    IdentityFile /home/shamim/.ssh/id_rsa
    IdentityFile /home/shamim/.vagrant.d/insecure_private_key
    IdentitiesOnly yes
    LogLevel FATAL
    ForwardAgent yes

    [shamim@oc4683017473 playbooks]$ ls -lrth

    TASK: [mezzanine | check out the repository on the host] **********************
    failed: [web] => {“cmd”: “/usr/bin/git ls-remote ” -h refs/heads/HEAD”, “failed”: true, “rc”: 128}
    stderr: Warning: Permanently added the RSA host key for IP address ‘192.30.252.128’ to the list of known hosts.
    Permission denied (publickey).
    fatal: Could not read from remote repository.

    Please make sure you have the correct access rights
    and the repository exists.

    msg: Warning: Permanently added the RSA host key for IP address ‘192.30.252.128’ to the list of known hosts.
    Permission denied (publickey).
    fatal: Could not read from remote repository.

    Please make sure you have the correct access rights
    and the repository exists.

    FATAL: all hosts have already failed — aborting

    PLAY RECAP ********************************************************************
    to retry, use: –limit @/home/shamim/mezzanine-across-hosts.retry

    db : ok=7 changed=6 unreachable=0 failed=0
    web : ok=2 changed=1 unreachable=0 failed=1

    Ansible failed to complete successfully. Any error output should be
    visible above. Please fix these errors and try again.

    Please tell me where i am doing mistake. i am new to github and ansible.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s