newbie - first playbook

275 views
Skip to first unread message

Craig White

unread,
Feb 9, 2015, 3:53:46 PM2/9/15
to ansible...@googlegroups.com
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
---
# This playbook deploys the whole application stack in this site.

- name: apply common configuration to all nodes
  hosts: dbb001.stt.local
  remote_user: rundeck

  roles:
    - common

- name: configure and deploy the webservers and application code
  hosts: dbb001.stt.local
  remote_user: rundeck

  roles:
    - web

Why is it saying there is 'No Package matching 'httpd' found available?  RHEL 6.6

Thanks
Craig

James Cammarata

unread,
Feb 10, 2015, 1:25:49 AM2/10/15
to ansible...@googlegroups.com
Hi Craig, not quite sure here but it might be that your remote repos are not setup correctly on that system? 

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/7cb499d4-1708-49fa-9f43-a7a60972aee7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Craig White

unread,
Feb 10, 2015, 11:23:08 AM2/10/15
to ansible...@googlegroups.com
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

Mark McCoy

unread,
Feb 10, 2015, 11:36:53 AM2/10/15
to ansible-project
Can you post the contents of the tasks from the web role?

Craig White

unread,
Feb 10, 2015, 12:24:02 PM2/10/15
to ansible...@googlegroups.com
sure

# cat roles/web/tasks/copy_code.yml
---
# These tasks are responsible for copying the latest dev/production code from
# the version control system.

#- name: Copy the code from repository
#  git: repo={{ repository }} dest=/var/www/html/

- name: Creates the index.php file
  template: src=index.php.j2 dest=/var/www/html/index.php

# cat roles/web/tasks/install_httpd.yml
---
# These tasks install http and the php modules.

- name: Install http and php etc
  yum: name={{ item }} state=present
  with_items:
   - httpd
   - php55u
   - git


- name: http service state
  service: name=httpd state=started enabled=yes

# cat roles/web/tasks/main.yml
---
- include: install_httpd.yml
- include: copy_code.yml

James Cammarata

unread,
Feb 10, 2015, 2:05:35 PM2/10/15
to ansible...@googlegroups.com
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" <hostname>'?

Craig White

unread,
Feb 10, 2015, 2:30:43 PM2/10/15
to ansible...@googlegroups.com
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
---
# This playbook deploys the whole application stack in this site.

- name: apply common configuration to all nodes
  hosts: dbb001.stt.local
  remote_user: rundeck
  sudo: yes

  roles:
    - common

- name: configure and deploy the webservers and application code
  hosts: dbb001.stt.local
  remote_user: rundeck

  roles:
    - web

Reply all
Reply to author
Forward
0 new messages