# newbie - first playbook

**URL:** <https://forum.ansible.com/t/newbie-first-playbook/17479>\
**Category:** Ansible Project\
**Created:** [February 9, 2015, 8:53pm UTC](https://forum.ansible.com/t/newbie-first-playbook/17479 "2015-02-09T20:53:45Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Craig\_White](https://avatars.discourse-cdn.com/v4/letter/c/85e7bf/32.png) [@Craig\_White](https://forum.ansible.com/u/Craig_White)\
**Post date:** [February 9, 2015, 8:53pm UTC](https://forum.ansible.com/t/newbie-first-playbook/17479/1 "2015-02-09T20:53:45Z")

</div>

been able to do simple ad-hoc commands but now trying to run a relatively simple playbook

# ansible-playbook -C /etc/ansible/playbooks/apache/site.yml

[WARNING]: The version of gmp you have installed has a known issue regarding  
timing vulnerabilities when used with pycrypto. If possible, you should update  
it (i.e. yum update gmp).

PLAY [apply common configuration to all nodes] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

GATHERING FACTS \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [dbb001.stt.local]

PLAY [configure and deploy the webservers and application code] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

GATHERING FACTS \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [dbb001.stt.local]

TASK: [web | Install http and php etc] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
failed: [dbb001.stt.local] =\> (item=httpd,php55u,git) =\> {“changed”: false, “failed”: true, “item”: “httpd,php55u,git”, “rc”: 0, “results”: }  
msg: No Package matching ‘httpd’ found available, installed or updated

FATAL: all hosts have already failed – aborting

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
to retry, use: --limit @/root/site.retry

dbb001.stt.local : ok=2 changed=0 unreachable=0 failed=1

# ansible --version

[WARNING]: The version of gmp you have installed has a known issue regarding  
timing vulnerabilities when used with pycrypto. If possible, you should update  
it (i.e. yum update gmp).

ansible 1.8.2  
configured module search path = None

# cat playbooks/apache/site.yml

---

<div class="post-metadata">

**Author:** ![James\_Cammarata](https://avatars.discourse-cdn.com/v4/letter/j/7c8e57/32.png) [@James\_Cammarata](https://forum.ansible.com/u/James_Cammarata)\
**Post date:** [February 10, 2015, 6:25am UTC](https://forum.ansible.com/t/newbie-first-playbook/17479/2 "2015-02-10T06:25:34Z")

</div>

Hi Craig, not quite sure here but it might be that your remote repos are not setup correctly on that system?

---

<div class="post-metadata">

**Author:** ![Craig\_White](https://avatars.discourse-cdn.com/v4/letter/c/85e7bf/32.png) [@Craig\_White](https://forum.ansible.com/u/Craig_White)\
**Post date:** [February 10, 2015, 4:23pm UTC](https://forum.ansible.com/t/newbie-first-playbook/17479/3 "2015-02-10T16:23:07Z")

</div>

I wish it were the case that repos were the problem. On the subject system…

[root@dbb001 ~]# yum search httpd  
Loaded plugins: product-id, rhnplugin, security, subscription-manager  
This system is receiving updates from RHN Classic or RHN Satellite.  
============================== N/S Matched: httpd ==============================  
httpd24u-debuginfo.x86\_64 : Debug information for package httpd24u  
libmicrohttpd-devel.i686 : Development files for libmicrohttpd  
libmicrohttpd-devel.x86\_64 : Development files for libmicrohttpd  
libmicrohttpd-doc.noarch : Documentation for libmicrohttpd  
httpd.x86\_64 : Apache HTTP Server  
httpd-devel.i686 : Development interfaces for the Apache HTTP server  
httpd-devel.x86\_64 : Development interfaces for the Apache HTTP server  
httpd-manual.noarch : Documentation for the Apache HTTP server  
httpd-tools.x86\_64 : Tools for use with the Apache HTTP Server  
httpd24u.x86\_64 : Apache HTTP Server  
httpd24u-devel.x86\_64 : Development interfaces for the Apache HTTP server  
httpd24u-filesystem.noarch : The basic directory layout for the Apache HTTP  
: server  
httpd24u-manual.noarch : Documentation for the Apache HTTP server  
httpd24u-tools.x86\_64 : Tools for use with the Apache HTTP Server  
libmicrohttpd.i686 : Lightweight library for embedding a webserver in  
: applications  
libmicrohttpd.x86\_64 : Lightweight library for embedding a webserver in  
: applications  
mod\_auth\_mellon.x86\_64 : A SAML 2.0 authentication module for the Apache Httpd  
: Server  
mod\_dav\_svn.x86\_64 : Apache httpd module for Subversion server  
mod\_dnssd.x86\_64 : An Apache HTTPD module which adds Zeroconf support

Name and summary matches only, use “search all” for everything.

yum search doesn’t seem to have a problem finding packages that match ‘httpd’. Playbook does though

---

<div class="post-metadata">

**Author:** ![Mark\_McCoy](https://avatars.discourse-cdn.com/v4/letter/m/ebca7d/32.png) [@Mark\_McCoy](https://forum.ansible.com/u/Mark_McCoy)\
**Post date:** [February 10, 2015, 4:36pm UTC](https://forum.ansible.com/t/newbie-first-playbook/17479/4 "2015-02-10T16:36:25Z")

</div>

Can you post the contents of the tasks from the web role?

---

<div class="post-metadata">

**Author:** ![Craig\_White](https://avatars.discourse-cdn.com/v4/letter/c/85e7bf/32.png) [@Craig\_White](https://forum.ansible.com/u/Craig_White)\
**Post date:** [February 10, 2015, 5:24pm UTC](https://forum.ansible.com/t/newbie-first-playbook/17479/5 "2015-02-10T17:24:02Z")

</div>

sure

# cat roles/web/tasks/copy\_code.yml

---

<div class="post-metadata">

**Author:** ![James\_Cammarata](https://avatars.discourse-cdn.com/v4/letter/j/7c8e57/32.png) [@James\_Cammarata](https://forum.ansible.com/u/James_Cammarata)\
**Post date:** [February 10, 2015, 7:05pm UTC](https://forum.ansible.com/t/newbie-first-playbook/17479/6 "2015-02-10T19:05:27Z")

</div>

But this works if you use the ad-hoc command with the yum module to install httpd? Ie. ‘ansible -m yum -a “name=httpd state=present” ’?

---

<div class="post-metadata">

**Author:** ![Craig\_White](https://avatars.discourse-cdn.com/v4/letter/c/85e7bf/32.png) [@Craig\_White](https://forum.ansible.com/u/Craig_White)\
**Post date:** [February 10, 2015, 7:30pm UTC](https://forum.ansible.com/t/newbie-first-playbook/17479/7 "2015-02-10T19:30:43Z")

</div>

No - same error

# ansible -C -m yum -a “name=httpd state=present” dbb001.stt.local

dbb001.stt.local | FAILED \>\> {  
“changed”: false,  
“failed”: true,  
“msg”: “No Package matching ‘httpd’ found available, installed or updated”,  
“rc”: 0,  
“results”:   
}

but adding --sudo did work…

# ansible -C -m yum -a “name=httpd state=present” dbb001rmdev02.stt-internal.local --sudo

dbb001.stt.local | success \>\> {  
“changed”: true  
}

So I am gathering that I don’t have sudo: yes in the right spot in site.yml

# cat site.yml
