Giter Site home page Giter Site logo

ansible / ansible-examples Goto Github PK

View Code? Open in Web Editor NEW
11.4K 715.0 7.4K 51.29 MB

A few starter examples of ansible playbooks, to show features and how they work together. See http://galaxy.ansible.com for example roles from the Ansible community for deploying many popular applications.

Shell 59.46% Python 4.25% PowerShell 1.78% PHP 23.34% Makefile 0.84% Rust 10.33%

ansible-examples's Introduction

Ansible Examples

This repository contains examples and best practices for building Ansible Playbooks.

ansible-examples's People

Contributors

abadger avatar akasurde avatar bcoca avatar bennojoy avatar cmluciano avatar ctam avatar cuongnv23 avatar dfederlein avatar gregdek avatar habbie avatar ipvsean avatar jimi-c avatar knechtionscoding avatar kylejameswalker avatar lamosty avatar leerich avatar m0rganic avatar mpdehaan avatar scottbrenner avatar skyl avatar soulmachine avatar takis avatar tgerla avatar thefury avatar thisdavejohnson avatar truedays avatar tuladhar avatar usurusr avatar varnav avatar webknjaz 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-examples's Issues

Need to update for RHEL 7.1

I get the following error running the playbook on RHEL 7.1

msg: There are unfinished transactions remaining. You might consider running yum-complete-transaction, or "yum-complete-transaction --cleanup-only" and "yum history redo last", first to finish them. If those don't work you'll have to try removing/installing packages by hand (maybe package-cleanup can help).
http://download.fedoraproject.org/pub/epel/6/x86_64/p/python-pip-7.1.0-1.el7.noarch.rpm: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.

Error downloading packages:
python-pip-7.1.0-1.el7.noarch: [Errno 256] No more mirrors to try.

FATAL: all hosts have already failed -- aborting

License

I would like to use your example files to train a classifier (to distinguish regular YAML files from Ansible playbooks) but I don't know what licensing terms you're distributing it under. Any chance you could pick one from here: http://choosealicense.com?

Having issue with lamp_haproxy nagios

I use AWS ec2 Linux AMI instance. While running lamp_haproxy site.yml below error occurs while strting nagios.

TASK: [nagios | start nagios] *************************************************
failed: [54.68.11.54] => {"failed": true}

msg: Starting nagios:CONFIG ERROR! Start aborted. Check your Nagios configuration.

When I tried locally start nagios service below is the details

Nagios Core 3.5.1
Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-30-2013
License: GPL

Website: http://www.nagios.org
Warning: Cannot open log file '/var/log/nagios/nagios.log' for writing
Error: Cannot open main configuration file '/usr/local/start' for reading!
Warning: Cannot open log file '/var/log/nagios/nagios.log' for writing
Nagios 3.5.1 starting... (PID=11741)
Warning: Cannot open log file '/var/log/nagios/nagios.log' for writing
Local time is Wed Nov 05 10:07:18 UTC 2014
Warning: Cannot open log file '/var/log/nagios/nagios.log' for writing
Warning: Cannot open log file '/var/log/nagios/nagios.log' for writing
Bailing out due to one or more errors encountered in the configuration files. Run Nagios from the command line with the -v option to verify your config before restarting. (PID=11741)

Please help to resolve this issue.

Namenode format fails

While executing: ansible-playbook -vvvv -i hosts site.yml

I end up encountering:

TASK: [Format the namenode] *************************************************** 
 ESTABLISH CONNECTION FOR USER: subroto
 EXEC ['ssh', '-tt', '-vvv', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/Users/subroto/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'Port=22', '-o', 'KbdInteractiveAuthentication=no', '-o', 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', '-o', 'PasswordAuthentication=no', '-o', 'ConnectTimeout=10', 'ec2-50-16-176-201.compute-1.amazonaws.com', "/bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-1384258178.59-209258933647175 && chmod a+rx $HOME/.ansible/tmp/ansible-1384258178.59-209258933647175 && echo $HOME/.ansible/tmp/ansible-1384258178.59-209258933647175'"]
 REMOTE_MODULE command creates=/usr/lib/hadoop/namenode.formatted su - hdfs -c "hadoop namenode -format" && touch /usr/lib/hadoop/namenode.formatted #USE_SHELL
 PUT /var/folders/4w/yr852nyj3dbd1qj4w6qcwtqm0000gn/T/tmpkJz6kN TO /root/.ansible/tmp/ansible-1384258178.59-209258933647175/command
 EXEC ['ssh', '-tt', '-vvv', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/Users/subroto/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'Port=22', '-o', 'KbdInteractiveAuthentication=no', '-o', 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', '-o', 'PasswordAuthentication=no', '-o', 'ConnectTimeout=10', 'ec2-50-16-176-201.compute-1.amazonaws.com', "/bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-1384258178.59-209258933647175/command; rm -rf /root/.ansible/tmp/ansible-1384258178.59-209258933647175/ >/dev/null 2>&1'"]
failed: [ec2-50-16-176-201.compute-1.amazonaws.com] => {"changed": true, "cmd": " su - hdfs -c \"hadoop namenode -format\" && touch /usr/lib/hadoop/namenode.formatted ", "delta": "0:00:04.824282", "end": "2013-11-12 07:09:45.620571", "item": "", "rc": 1, "start": "2013-11-12 07:09:40.796289"}
stderr: DEPRECATED: Use of this script to execute hdfs command is deprecated.
Instead use the hdfs command for it.

13/11/12 07:09:42 INFO namenode.NameNode: STARTUP_MSG: 
/************************************************************
STARTUP_MSG: Starting NameNode
STARTUP_MSG:   host = ip-10-143-182-148/10.143.182.148
STARTUP_MSG:   args = [-format]
STARTUP_MSG:   version = 2.0.0-cdh4.4.0
STARTUP_MSG:   classpath = /etc/hadoop/conf:/usr/lib/hadoop/lib/protobuf-java-2.4.0a.jar:/usr/lib/hadoop/lib/xmlenc-0.52.jar:/usr/lib/hadoop/lib/jasper-runtime-5.5.23.jar:/usr/lib/hadoop/lib/jline-0.9.94.jar:/usr/lib/hadoop/lib/commons-codec-1.4.jar:/usr/lib/hadoop/lib/jsp-api-2.1.jar:/usr/lib/hadoop/lib/commons-logging-1.1.1.jar:/usr/lib/hadoop/lib/guava-11.0.2.jar:/usr/lib/hadoop/lib/jasper-compiler-5.5.23.jar:/usr/lib/hadoop/lib/commons-io-2.1.jar:/usr/lib/hadoop/lib/jackson-mapper-asl-1.8.8.jar:/usr/lib/hadoop/lib/commons-digester-1.8.jar:/usr/lib/hadoop/lib/paranamer-2.3.jar:/usr/lib/hadoop/lib/avro-1.7.4.jar:/usr/lib/hadoop/lib/junit-4.8.2.jar:/usr/lib/hadoop/lib/zookeeper-3.4.5-cdh4.4.0.jar:/usr/lib/hadoop/lib/servlet-api-2.5.jar:/usr/lib/hadoop/lib/snappy-java-1.0.4.1.jar:/usr/lib/hadoop/lib/jackson-jaxrs-1.8.8.jar:/usr/lib/hadoop/lib/jackson-xc-1.8.8.jar:/usr/lib/hadoop/lib/commons-lang-2.5.jar:/usr/lib/hadoop/lib/jets3t-0.6.1.jar:/usr/lib/hadoop/lib/jersey-core-1.8.jar:/usr/lib/hadoop/lib/slf4j-api-1.6.1.jar:/usr/lib/hadoop/lib/asm-3.2.jar:/usr/lib/hadoop/lib/jettison-1.1.jar:/usr/lib/hadoop/lib/jersey-json-1.8.jar:/usr/lib/hadoop/lib/commons-net-3.1.jar:/usr/lib/hadoop/lib/commons-math-2.1.jar:/usr/lib/hadoop/lib/xz-1.0.jar:/usr/lib/hadoop/lib/jackson-core-asl-1.8.8.jar:/usr/lib/hadoop/lib/jetty-6.1.26.cloudera.2.jar:/usr/lib/hadoop/lib/commons-beanutils-core-1.8.0.jar:/usr/lib/hadoop/lib/stax-api-1.0.1.jar:/usr/lib/hadoop/lib/commons-cli-1.2.jar:/usr/lib/hadoop/lib/commons-beanutils-1.7.0.jar:/usr/lib/hadoop/lib/jsch-0.1.42.jar:/usr/lib/hadoop/lib/mockito-all-1.8.5.jar:/usr/lib/hadoop/lib/jetty-util-6.1.26.cloudera.2.jar:/usr/lib/hadoop/lib/jsr305-1.3.9.jar:/usr/lib/hadoop/lib/commons-httpclient-3.1.jar:/usr/lib/hadoop/lib/commons-configuration-1.6.jar:/usr/lib/hadoop/lib/commons-el-1.0.jar:/usr/lib/hadoop/lib/jaxb-api-2.2.2.jar:/usr/lib/hadoop/lib/kfs-0.3.jar:/usr/lib/hadoop/lib/log4j-1.2.17.jar:/usr/lib/hadoop/lib/commons-collections-3.2.1.jar:/usr/lib/hadoop/lib/commons-compress-1.4.1.jar:/usr/lib/hadoop/lib/activation-1.1.jar:/usr/lib/hadoop/lib/jersey-server-1.8.jar:/usr/lib/hadoop/lib/slf4j-log4j12-1.6.1.jar:/usr/lib/hadoop/lib/jaxb-impl-2.2.3-1.jar:/usr/lib/hadoop/.//hadoop-annotations.jar:/usr/lib/hadoop/.//hadoop-common-2.0.0-cdh4.4.0-tests.jar:/usr/lib/hadoop/.//hadoop-common.jar:/usr/lib/hadoop/.//hadoop-common-2.0.0-cdh4.4.0.jar:/usr/lib/hadoop/.//hadoop-annotations-2.0.0-cdh4.4.0.jar:/usr/lib/hadoop/.//hadoop-auth.jar:/usr/lib/hadoop/.//hadoop-auth-2.0.0-cdh4.4.0.jar:/usr/lib/hadoop-hdfs/./:/usr/lib/hadoop-hdfs/lib/protobuf-java-2.4.0a.jar:/usr/lib/hadoop-hdfs/lib/xmlenc-0.52.jar:/usr/lib/hadoop-hdfs/lib/jasper-runtime-5.5.23.jar:/usr/lib/hadoop-hdfs/lib/jline-0.9.94.jar:/usr/lib/hadoop-hdfs/lib/commons-codec-1.4.jar:/usr/lib/hadoop-hdfs/lib/jsp-api-2.1.jar:/usr/lib/hadoop-hdfs/lib/commons-logging-1.1.1.jar:/usr/lib/hadoop-hdfs/lib/guava-11.0.2.jar:/usr/lib/hadoop-hdfs/lib/commons-io-2.1.jar:/usr/lib/hadoop-hdfs/lib/jackson-mapper-asl-1.8.8.jar:/usr/lib/hadoop-hdfs/lib/zookeeper-3.4.5-cdh4.4.0.jar:/usr/lib/hadoop-hdfs/lib/commons-daemon-1.0.3.jar:/usr/lib/hadoop-hdfs/lib/servlet-api-2.5.jar:/usr/lib/hadoop-hdfs/lib/commons-lang-2.5.jar:/usr/lib/hadoop-hdfs/lib/jersey-core-1.8.jar:/usr/lib/hadoop-hdfs/lib/asm-3.2.jar:/usr/lib/hadoop-hdfs/lib/jackson-core-asl-1.8.8.jar:/usr/lib/hadoop-hdfs/lib/jetty-6.1.26.cloudera.2.jar:/usr/lib/hadoop-hdfs/lib/commons-cli-1.2.jar:/usr/lib/hadoop-hdfs/lib/jetty-util-6.1.26.cloudera.2.jar:/usr/lib/hadoop-hdfs/lib/jsr305-1.3.9.jar:/usr/lib/hadoop-hdfs/lib/commons-el-1.0.jar:/usr/lib/hadoop-hdfs/lib/log4j-1.2.17.jar:/usr/lib/hadoop-hdfs/lib/jersey-server-1.8.jar:/usr/lib/hadoop-hdfs/.//hadoop-hdfs-2.0.0-cdh4.4.0-tests.jar:/usr/lib/hadoop-hdfs/.//hadoop-hdfs.jar:/usr/lib/hadoop-hdfs/.//hadoop-hdfs-2.0.0-cdh4.4.0.jar:/usr/lib/hadoop-yarn/.//*:/usr/lib/hadoop-0.20-mapreduce/./:/usr/lib/hadoop-0.20-mapreduce/lib/protobuf-java-2.4.0a.jar:/usr/lib/hadoop-0.20-mapreduce/lib/xmlenc-0.52.jar:/usr/lib/hadoop-0.20-mapreduce/lib/jasper-runtime-5.5.23.jar:/usr/lib/hadoop-0.20-mapreduce/lib/hsqldb-1.8.0.10.jar:/usr/lib/hadoop-0.20-mapreduce/lib/jline-0.9.94.jar:/usr/lib/hadoop-0.20-mapreduce/lib/commons-codec-1.4.jar:/usr/lib/hadoop-0.20-mapreduce/lib/jsp-api-2.1.jar:/usr/lib/hadoop-0.20-mapreduce/lib/commons-logging-1.1.1.jar:/usr/lib/hadoop-0.20-mapreduce/lib/guava-11.0.2.jar:/usr/lib/hadoop-0.20-mapreduce/lib/jasper-compiler-5.5.23.jar:/usr/lib/hadoop-0.20-mapreduce/lib/commons-io-2.1.jar:/usr/lib/hadoop-0.20-mapreduce/lib/avro-compiler-1.7.4.jar:/usr/lib/hadoop-0.20-mapreduce/lib/jackson-mapper-asl-1.8.8.jar:/usr/lib/hadoop-0.20-mapreduce/lib/commons-digester-1.8.jar:/usr/lib/hadoop-0.20-mapreduce/lib/paranamer-2.3.jar:/usr/lib/hadoop-0.20-mapreduce/lib/avro-1.7.4.jar:/usr/lib/hadoop-0.20-mapreduce/lib/junit-4.8.2.jar:/usr/lib/hadoop-0.20-mapreduce/lib/zookeeper-3.4.5-cdh4.4.0.jar:/usr/lib/hadoop-0.20-mapreduce/lib/servlet-api-2.5.jar:/usr/lib/hadoop-0.20-mapreduce/lib/snappy-java-1.0.4.1.jar:/usr/lib/hadoop-0.20-mapreduce/lib/jackson-jaxrs-1.8.8.jar:/usr/lib/hadoop-0.20-mapreduce/lib/jackson-xc-1.8.8.jar:/usr/lib/hadoop-0.20-mapreduce/lib/commons-lang-2.5.jar:/usr/lib/hadoop-0.20-mapreduce/lib/jets3t-0.6.1.jar:/usr/lib/hadoop-0.20-mapreduce/lib/jersey-core-1.8.jar:/usr/lib/hadoop-0.20-mapreduce/lib/slf4j-api-1.6.1.jar:/usr/lib/hadoop-0.20-mapreduce/lib/asm-3.2.jar:/usr/lib/hadoop-0.20-mapreduce/lib/jettison-1.1.jar:/usr/lib/hadoop-0.20-mapreduce/lib/jersey-json-1.8.jar:/usr/lib/hadoop-0.20-mapreduce/lib/commons-net-3.1.jar:/usr/lib/hadoop-0.20-mapreduce/lib/commons-math-2.1.jar:/usr/lib/hadoop-0.20-mapreduce/lib/xz-1.0.jar:/usr/lib/hadoop-0.20-mapreduce/lib/hadoop-fairscheduler-2.0.0-mr1-cdh4.4.0.jar:/usr/lib/hadoop-0.20-mapreduce/lib/jackson-core-asl-1.8.8.jar:/usr/lib/hadoop-0.20-mapreduce/lib/jetty-6.1.26.cloudera.2.jar:/usr/lib/hadoop-0.20-mapreduce/lib/kfs-0.2.2.jar:/usr/lib/hadoop-0.20-mapreduce/lib/commons-beanutils-core-1.8.0.jar:/usr/lib/hadoop-0.20-mapreduce/lib/stax-api-1.0.1.jar:/usr/lib/hadoop-0.20-mapreduce/lib/commons-cli-1.2.jar:/usr/lib/hadoop-0.20-mapreduce/lib/commons-beanutils-1.7.0.jar:/usr/lib/hadoop-0.20-mapreduce/lib/jsch-0.1.42.jar:/usr/lib/hadoop-0.20-mapreduce/lib/mockito-all-1.8.5.jar:/usr/lib/hadoop-0.20-mapreduce/lib/jetty-util-6.1.26.cloudera.2.jar:/usr/lib/hadoop-0.20-mapreduce/lib/jsr305-1.3.9.jar:/usr/lib/hadoop-0.20-mapreduce/lib/commons-httpclient-3.1.jar:/usr/lib/hadoop-0.20-mapreduce/lib/ant-contrib-1.0b3.jar:/usr/lib/hadoop-0.20-mapreduce/lib/commons-configuration-1.6.jar:/usr/lib/hadoop-0.20-mapreduce/lib/commons-el-1.0.jar:/usr/lib/hadoop-0.20-mapreduce/lib/jaxb-api-2.2.2.jar:/usr/lib/hadoop-0.20-mapreduce/lib/kfs-0.3.jar:/usr/lib/hadoop-0.20-mapreduce/lib/log4j-1.2.17.jar:/usr/lib/hadoop-0.20-mapreduce/lib/commons-collections-3.2.1.jar:/usr/lib/hadoop-0.20-mapreduce/lib/commons-compress-1.4.1.jar:/usr/lib/hadoop-0.20-mapreduce/lib/activation-1.1.jar:/usr/lib/hadoop-0.20-mapreduce/lib/jersey-server-1.8.jar:/usr/lib/hadoop-0.20-mapreduce/lib/jaxb-impl-2.2.3-1.jar:/usr/lib/hadoop-0.20-mapreduce/.//hadoop-core-2.0.0-mr1-cdh4.4.0.jar:/usr/lib/hadoop-0.20-mapreduce/.//hadoop-test-2.0.0-mr1-cdh4.4.0.jar:/usr/lib/hadoop-0.20-mapreduce/.//hadoop-ant.jar:/usr/lib/hadoop-0.20-mapreduce/.//hadoop-core.jar:/usr/lib/hadoop-0.20-mapreduce/.//hadoop-examples.jar:/usr/lib/hadoop-0.20-mapreduce/.//hadoop-examples-2.0.0-mr1-cdh4.4.0.jar:/usr/lib/hadoop-0.20-mapreduce/.//hadoop-ant-2.0.0-mr1-cdh4.4.0.jar:/usr/lib/hadoop-0.20-mapreduce/.//hadoop-tools.jar:/usr/lib/hadoop-0.20-mapreduce/.//hadoop-test.jar:/usr/lib/hadoop-0.20-mapreduce/.//hadoop-tools-2.0.0-mr1-cdh4.4.0.jar
STARTUP_MSG:   build = file:///data/1/jenkins/workspace/generic-package-rhel64-6-0/topdir/BUILD/hadoop-2.0.0-cdh4.4.0/src/hadoop-common-project/hadoop-common -r c0eba6cd38c984557e96a16ccd7356b7de835e79; compiled by 'jenkins' on Tue Sep  3 19:33:17 PDT 2013
STARTUP_MSG:   java = 1.6.0_24
************************************************************/
13/11/12 07:09:42 INFO namenode.NameNode: registered UNIX signal handlers for [TERM, HUP, INT]
13/11/12 07:09:45 FATAL conf.Configuration: error parsing conf mapred-site.xml
java.io.FileNotFoundException: /etc/hadoop/conf.empty/mapred-site.xml (Permission denied)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.(FileInputStream.java:140)
    at java.io.FileInputStream.(FileInputStream.java:96)
    at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:87)
    at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:178)
    at java.net.URL.openStream(URL.java:1031)
    at org.apache.hadoop.conf.Configuration.parse(Configuration.java:1873)
    at org.apache.hadoop.conf.Configuration.loadResource(Configuration.java:1944)
    at org.apache.hadoop.conf.Configuration.loadResources(Configuration.java:1897)
    at org.apache.hadoop.conf.Configuration.getProps(Configuration.java:1815)
    at org.apache.hadoop.conf.Configuration.get(Configuration.java:712)
    at org.apache.hadoop.conf.Configuration.getTrimmed(Configuration.java:731)
    at org.apache.hadoop.conf.Configuration.getLong(Configuration.java:949)
    at org.apache.hadoop.security.Groups.(Groups.java:62)
    at org.apache.hadoop.security.Groups.getUserToGroupsMappingService(Groups.java:182)
    at org.apache.hadoop.security.UserGroupInformation.initUGI(UserGroupInformation.java:252)
    at org.apache.hadoop.security.UserGroupInformation.initialize(UserGroupInformation.java:223)
    at org.apache.hadoop.security.UserGroupInformation.ensureInitialized(UserGroupInformation.java:214)
    at org.apache.hadoop.security.UserGroupInformation.isSecurityEnabled(UserGroupInformation.java:277)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.format(NameNode.java:730)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1128)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1233)
13/11/12 07:09:45 FATAL namenode.NameNode: Exception in namenode join
java.lang.RuntimeException: java.io.FileNotFoundException: /etc/hadoop/conf.empty/mapred-site.xml (Permission denied)
    at org.apache.hadoop.conf.Configuration.loadResource(Configuration.java:2042)
    at org.apache.hadoop.conf.Configuration.loadResources(Configuration.java:1897)
    at org.apache.hadoop.conf.Configuration.getProps(Configuration.java:1815)
    at org.apache.hadoop.conf.Configuration.get(Configuration.java:712)
    at org.apache.hadoop.conf.Configuration.getTrimmed(Configuration.java:731)
    at org.apache.hadoop.conf.Configuration.getLong(Configuration.java:949)
    at org.apache.hadoop.security.Groups.(Groups.java:62)
    at org.apache.hadoop.security.Groups.getUserToGroupsMappingService(Groups.java:182)
    at org.apache.hadoop.security.UserGroupInformation.initUGI(UserGroupInformation.java:252)
    at org.apache.hadoop.security.UserGroupInformation.initialize(UserGroupInformation.java:223)
    at org.apache.hadoop.security.UserGroupInformation.ensureInitialized(UserGroupInformation.java:214)
    at org.apache.hadoop.security.UserGroupInformation.isSecurityEnabled(UserGroupInformation.java:277)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.format(NameNode.java:730)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1128)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1233)
Caused by: java.io.FileNotFoundException: /etc/hadoop/conf.empty/mapred-site.xml (Permission denied)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.(FileInputStream.java:140)
    at java.io.FileInputStream.(FileInputStream.java:96)
    at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:87)
    at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:178)
    at java.net.URL.openStream(URL.java:1031)
    at org.apache.hadoop.conf.Configuration.parse(Configuration.java:1873)
    at org.apache.hadoop.conf.Configuration.loadResource(Configuration.java:1944)
    ... 14 more
13/11/12 07:09:45 INFO util.ExitUtil: Exiting with status 1
13/11/12 07:09:45 INFO namenode.NameNode: SHUTDOWN_MSG: 
/************************************************************
SHUTDOWN_MSG: Shutting down NameNode at ip-10-143-182-148/10.143.182.148
************************************************************/

FATAL: all hosts have already failed -- aborting

PLAY RECAP ******************************************************************** 
           to retry, use: --limit @/Users/subroto/site.retry

Further the file permissions in conf.empty folder looks like this:

[root@ip-10-143-182-148 ~]# ls -l /etc/hadoop/conf.empty
total 60
-rw-r--r-- 1 root root 1335 Sep  3 22:48 configuration.xsl
-rw-r--r-- 1 root root 1001 Nov 12 07:03 core-site.xml
-rw-r--r-- 1 root root 2489 Nov 12 07:03 hadoop-metrics.properties
-rw-r--r-- 1 root root 1773 Nov 12 07:03 hadoop-metrics2.properties
-rw-r--r-- 1 root root 9196 Sep  3 22:48 hadoop-policy.xml
-rw-r--r-- 1 root root 3730 Nov 12 07:03 hdfs-site.xml
-rw-r--r-- 1 root root 8735 Sep  3 22:48 log4j.properties
-rw------- 1 root root 3752 Nov 12 07:03 mapred-site.xml
-rw-r--r-- 1 root root  125 Nov 12 07:03 slaves
-rw-r--r-- 1 root root 2316 Sep  3 22:48 ssl-client.xml.example
-rw-r--r-- 1 root root 2251 Sep  3 22:48 ssl-server.xml.example

lamp_simple doesn't work with CentOS 7

192.168.1.5 is a web server.
Trying lamp_simple playbook on CentOS 7 gives an error:


TASK: [web | Creates the index.php file] **************************************
fatal: [192.168.1.5] => {'msg': "AnsibleUndefinedVariable: One or more undefined variables: 'ansible_eth0' is undefined", 'failed': True}
fatal: [192.168.1.5] => {'msg': "AnsibleUndefinedVariable: One or more undefined variables: 'ansible_eth0' is undefined", 'failed': True}

FATAL: all hosts have already failed -- aborting


It may be linked to the fact that there are no more 'eth1' and so on in CentOS 7, my interface is called 'enp0s3'

Ticket Monster JBoss application

I have successfully used the JBoss playbook to deploy the hello world app to an ec2 node. I can see it on port 8080. How can I see the ticket monster app? Where in the playbook is it configured that the hello world app comes up instead of the ticket monster app on 8080?

Here's what I see on 8080:

image

Thanks!

ansible-examples/openshift fails on "add the admin user"

Just ran playbook twice against the same vanilla box just to get:

TASK: [add the admin user] ****************************************************
fatal: [192.168.0.121] => failed to parse: Traceback (most recent call last):
File "/root/.ansible/tmp/ansible-1384561696.97-274454575241870/mongodb_user", line 1147, in
main()
File "/root/.ansible/tmp/ansible-1384561696.97-274454575241870/mongodb_user", line 208, in main
if user_add(module, client, db_name, user, password, roles) is not True:
File "/root/.ansible/tmp/ansible-1384561696.97-274454575241870/mongodb_user", line 120, in user_add
db.add_user(user, password, False)
File "/usr/lib64/python2.6/site-packages/pymongo/database.py", line 646, in add_user
user = self.system.users.find_one({"user": name}) or {"user": name}
File "/usr/lib64/python2.6/site-packages/pymongo/collection.py", line 604, in find_one
for result in self.find(spec_or_id, _args, *_kwargs).limit(-1):
File "/usr/lib64/python2.6/site-packages/pymongo/cursor.py", line 904, in next
if len(self.__data) or self._refresh():
File "/usr/lib64/python2.6/site-packages/pymongo/cursor.py", line 848, in _refresh
self.__uuid_subtype))
File "/usr/lib64/python2.6/site-packages/pymongo/cursor.py", line 800, in __send_message
self.__uuid_subtype)
File "/usr/lib64/python2.6/site-packages/pymongo/helpers.py", line 98, in _unpack_response
raise AutoReconnect(error_object["$err"])
pymongo.errors.AutoReconnect: not master and slaveOk=false

FATAL: all hosts have already failed -- aborting

CloudFormation playbook fails

TASK: [launch ansible cloudformation example] ********************************* 
<localhost> REMOTE_MODULE cloudformation stack_name="ansible-cloudformation" state=present region=us-east-1 disable_rollback=true template=files/cloudformation-example.json
<localhost> EXEC ['/bin/sh', '-c', 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1406741436.71-221187267455298 && echo $HOME/.ansible/tmp/ansible-tmp-1406741436.71-221187267455298']
<localhost> PUT /tmp/tmpCpY5ED TO /root/.ansible/tmp/ansible-tmp-1406741436.71-221187267455298/cloudformation
<localhost> EXEC ['/bin/sh', '-c', '/usr/bin/python /root/.ansible/tmp/ansible-tmp-1406741436.71-221187267455298/cloudformation; rm -rf /root/.ansible/tmp/ansible-tmp-1406741436.71-221187267455298/ >/dev/null 2>&1']
failed: [localhost] => {"changed": true, "events": ["StackEvent AWS::CloudFormation::Stack ansible-cloudformation CREATE_FAILED", "StackEvent AWS::EC2::SecurityGroup InstanceSecurityGroup CREATE_FAILED", "StackEvent AWS::CloudFormation::WaitConditionHandle ApplicationWaitHandle CREATE_COMPLETE", "StackEvent AWS::IAM::User CFNInitUser CREATE_FAILED", "StackEvent AWS::IAM::Role RootRole CREATE_FAILED", "StackEvent AWS::CloudFormation::WaitConditionHandle ApplicationWaitHandle CREATE_IN_PROGRESS", "StackEvent AWS::EC2::SecurityGroup InstanceSecurityGroup CREATE_IN_PROGRESS", "StackEvent AWS::IAM::User CFNInitUser CREATE_IN_PROGRESS", "StackEvent AWS::CloudFormation::WaitConditionHandle ApplicationWaitHandle CREATE_IN_PROGRESS", "StackEvent AWS::IAM::Role RootRole CREATE_IN_PROGRESS", "StackEvent AWS::CloudFormation::Stack ansible-cloudformation CREATE_IN_PROGRESS"], "failed": true, "output": "Stack CREATE failed", "stack_outputs": {}}

lamp_simple_rhel7 fails on SELinux and firewalld

The playbook failed on me running the Configure ntp file task in common, this is due to the libselinux-python package not installed on both hosts.
Also, there is an issue with firewalld not present on minimal install CentOS7 machine, which causes the playbook to fail.
Please see my pull request (#146) which fixes both issues.

User Info while using ansible-pull

Hi,

How do we pass a mix of static + dynamic inventory info while using ansible-pull?

ansible-pull -d /home/gvenka008c/reponame --key-file=/home/users/rsa.id -U [email protected]:reponame.git playbook.yml

[WARNING]: provided hosts list is empty, only localhost is available

Thanks,
Govind

The structure of this repository makes it difficult to contribute to, please separate it to its own account.

In my opinion...

ansible-examples should be its own GitHub account (and it's available, ATM).

Each of the subdirectories in this "ansible/ansible-examples" repository should be its own repository within the ansible-examples account.

This would separate out the tickets, pull requests, etc. into usable atomic chunks where pull requests could be much more easily merged and so forth.

The current structure is just chaos -- how can you handle a pull request when it's not particularly clear which of the various examples it applies to? How can you figure out which issues are related to which example?

This would get a lot more traction/contributions if it were possible to focus on just one example at a time for pull requests etc.

expected libselinux-python from the instance

Instead of expecting the package libselinux-python to be available in the instances/host; I think the Ansible should install this in the hosts.

I think just an entry of:

- name: Install the libselinux-python package
  yum: name=libselinux-python state=installed

in ansible-examples/hadoop/roles/common/tasks/common.yml should be enough.

The vars_files is skiped but the variables in vars_files can be used

Scenario:

1. The localhost in the group " application_hosts "

2. In the /group_vars/application_hosts file : ( defined a variable 'Enviroment' )

         Environment: stage

3. I made other variables in another file : vault/stage/hello.yml

         username: Clark
         testuser: clark

4. The Play Book: testplaybook.yml

  • hosts: localhost
    vars_files:
    • "vault/{{ Environment }}/hello.yml"
      tasks:
    • name: test for vars_files
      debug: var=Environment
    • name: hello
      debug: var=hostvars.localhost.username
    • name: hello
      debug: var=testuser
    • name: hello
      debug: var=username

5. execute with this playbook , and the below are out put:

clark@localhost:~> ansible-playbook testplaybook.yml -vvv
Using /home/clark/ansible.cfg as config file

PLAYBOOK: testplaybook.yml ******************************************************
1 plays in testplaybook.yml
skipping vars_file 'vault/{{ Environment }}/hello.yml' due to an undefined variable
skipping vars_file 'vault/{{ Environment }}/hello.yml' due to an undefined variable

PLAY [localhost] ***************************************************************

TASK [setup] *******************************************************************
ESTABLISH SSH CONNECTION FOR USER: None
SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/clark/.ansible/cp/ansible-ssh-%h-%p-%r localhost '/bin/sh -c '"'"'( umask 77 && mkdir -p "echo $HOME/.ansible/tmp/ansible-tmp-1470310770.4-132624051729407" && echo ansible-tmp-1470310770.4-132624051729407="echo $HOME/.ansible/tmp/ansible-tmp-1470310770.4-132624051729407" ) && sleep 0'"'"''
PUT /tmp/tmpB9bl8k TO /home/clark/.ansible/tmp/ansible-tmp-1470310770.4-132624051729407/setup
SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/clark/.ansible/cp/ansible-ssh-%h-%p-%r '[localhost]'
ESTABLISH SSH CONNECTION FOR USER: None
SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/clark/.ansible/cp/ansible-ssh-%h-%p-%r -tt localhost '/bin/sh -c '"'"'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /home/clark/.ansible/tmp/ansible-tmp-1470310770.4-132624051729407/setup; rm -rf "/home/clark/.ansible/tmp/ansible-tmp-1470310770.4-132624051729407/" > /dev/null 2>&1 && sleep 0'"'"''
ok: [localhost]

TASK [test for vars_files] *****************************************************
task path: /home/clark/testplaybook.yml:37
ok: [localhost] => {
"Environment": "stage"
}

TASK [hello] ********************************************************************
task path: /home/clark/testplaybook.yml:40
ok: [localhost] => {
"hostvars.localhost.username": "VARIABLE IS NOT DEFINED!"
}

TASK [hello] ********************************************************************
task path: /home/clark/testplaybook.yml:43
ok: [localhost] => {
"testuser": "clark"

}

TASK [hello] ********************************************************************
task path: /home/clark/testplaybook.yml:46
ok: [localhost] => {
"username": "Clark"

}

PLAY RECAP *********************************************************************
localhost : ok=5 changed=0 unreachable=0 failed=0

Question:

skipping vars_file 'vault/{{ Environment }}/hello.yml' due to an undefined variable mean the file hello.yml not loaded. So the variables defined in hello.yml should not work , but in output , the variabels testuser and username both get the values defined in hello.yml file. That's pretty weird !! And the hostvars of localhost don't have the variables named in hello.yml, that's why the "hostvars.localhost.username": "VARIABLE IS NOT DEFINED!" in output. but in the next tast , the variables in hello.yml file can be loaded, this is strange too.

So can someone explain it how does that work in this way ?

No defaults/main.yml example, trying to create one but can't get it to work

I'd like to add an example showing how Role Default Variables work by creating a defaults/main.yml file for a role.

The docs say:

Role default variables allow you to set default variables for included or dependent roles (see below). To create defaults, simply add a defaults/main.yml file in your role directory. These variables will have the lowest priority of any variables available, and can be easily overridden by any other variable, including inventory variables.

In this short and simple commit, I set up a playbook that should print out the value of a default variable, but instead it fails with the error:

fatal: [localhost] => One or more undefined variables: 'myvar' is undefined

This can be reproduced like so:

git clone [email protected]:coryfklein/ansible-examples.git
cd ansible-examples/debug_default_vars
./reproduce_problem.sh

I clearly must be missing a required step. I'd like to know what that step is so I can additionally submit a PR to the documentation for this feature so other new users like me don't experience the same frustration in getting this to work.

tasks: <null> should be empty list

We want to find any instances of

tasks: \n
(idiom to force fact gathering)

and replace with

tasks: []

both work, but the latter is clearer

postgresql.yml un able to connect to server

hello, when i execute postgressql.yml, i got the following result:

failed: [trustme] => {"failed": true}
msg: unable to connect to database: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

FATAL: all hosts have already failed -- aborting

my ansible version is: 1.9.2
my remote host is: ubuntu server 14.04 32 bit (inside virtual box)

Is there anything wrong, and how do i fix it?
thanks

wordpress-nginx Need add Start Of the Services on Reboot

Provisioned the machine OK, which is awesome, but after the machine reboot everything is down. Need to add autostart of:

  • nginx
  • php-fpm

Something like this should do

- name: Autostart stuff
  shell: sudo /sbin/chkconfig --add {{ item }} && sudo /sbin/chkconfig {{ item }} on
with_items:
 - nginx
 - "php-fpm"

Again thanks for sharing the ansible scripts. Work like charm!

Hadoop example does not install cleanly

At least on my use case, the hadoop example fails to start up the namenode.

I could trace at least one problem to the playbook using a semicolon to separate shell commands. Even if for example hadoop namenode -format fails, the following touch /usr/lib/hadoop/namenode.formatted gets created.

I'd recommend replacing the semicolons with &&, which would at least alert the user about the problem earlier.

(Circumstances prevent me from making a pull request about this. I'm sorry.)

Ansible Bugs affect template-generated configurations for Nagios

I wanted to point out some Ansible bugs affect the way the jinja2 .conf.j2 templates are generated when using {{ hostvars[host].ansible_default_ipv4.address }} not being able to be ascertained without first gathering facts due to:

ansible/ansible#9260

Code in reference:
https://github.com/ansible/ansible-examples/blob/master/lamp_haproxy/roles/nagios/templates/dbservers.cfg.j2#L13

The workaround stated for adding this to playbooks in ansible/ansible#9260 does not work:

- hosts: all
  tasks: []

Due to ansible/ansible#15525

I can't start my tomcat with ansible

centos 6
ansible 2.2.1.0
tomcat: 8.0.15.0
jdk:1.8.0_112

All executor are root

My shell files "start_stop.sh ,deploy.sh"

start_stop.sh:

#!/bin/bash
set -e

#PATH
export PATH=/opt/java/jdk1.8.0_112/bin/:/opt/java/jdk1.8.0_112/jre/bin:/opt/java/jdk1.8.0_112:$PATH

export JAVA_HOME=/opt/java/jdk1.8.0_112
export CATALINA_HOME=/data/server/tomcat8-card-ocr-8015
export JRE_HOME=/opt/java/jdk1.8.0_112/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH


function start_server()
{
    #start project server
    su - root -c /data/server/tomcat8-card-ocr-8015/bin/startup.sh    
    sleep 2
    #Determine whether the program start success
    Pid=$(ps aux|grep tomcat8-card-ocr-8015|grep -v grep |awk '{print $2}')
    if [ ! -n "$Pid" ];then
        echo  "Project server start error!"
        return 1
    else
        echo  "Project server start success!"
        return 0
}

function stop_server()
{
    #stop project server
    su - root -c /data/server/tomcat8-card-ocr-8015/bin/shutdown.sh 

    sleep 10

    #Determine whether the program stop success
    Pid=$(ps aux|grep tomcat8-card-ocr-8015|grep -v grep |awk '{print $2}')
    if [ ! -n "$Pid" ];then
        echo  "Project server stop success!" 
    else
        echo  "Project server stop failed!"
        for i in $Pid;do
            kill -9 $i
        done
    fi  
}

deploy.sh:

#!/bin/bash

 set -e
#Load dependent files
source ./start_stop.sh
#PATH
export PATH=/opt/java/jdk1.8.0_112/bin/:/opt/java/jdk1.8.0_112/jre/bin:/opt/java/jdk1.8.0_112:$PATH

function deploy()
{
  stop_server     
  start_server
  
}

function main()
{
    deploy
}
main

I can execute deploy.sh on remote server to start tomcat!
but I can't start tomcat with ansible

ansible ERROR:

na.startup.Catalina stopServer
SEVERE: Could not contact localhost:8006. Tomcat may not be running.
Mar 07, 2017 3:45:47 PM org.apache.catalina.startup.Catalina stopServer
SEVERE: Catalina.stop: 
java.net.ConnectException: Connection refused (Connection refused)
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
	at java.net.Socket.connect(Socket.java:589)
	at java.net.Socket.connect(Socket.java:538)
	at java.net.Socket.<init>(Socket.java:434)
	at java.net.Socket.<init>(Socket.java:211)
	at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:450)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:400)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:487)

Note: I have changed my tomcat shutdown port to 8006

tomcat's catalina.out ERROR:

07-Mar-2017 15:46:02.128 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8015"]
07-Mar-2017 15:46:02.134 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8010"]
07-Mar-2017 15:46:02.135 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 3496 ms
07-Mar-2017 15:46:05.925 INFO [Thread-6] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-nio-8015"]
07-Mar-2017 15:46:05.979 INFO [Thread-6] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["ajp-nio-8010"]
07-Mar-2017 15:46:06.029 INFO [Thread-6] org.apache.catalina.core.StandardService.stopInternal Stopping service Catalina
07-Mar-2017 15:46:06.032 INFO [localhost-startStop-1] org.springframework.web.context.support.XmlWebApplicationContext.doClose Closing WebApplicationContext for namespace 'springmvc-servlet': startup date [Tue Mar 07 15:46:01 CST 2017]; parent: Root WebApplicationContext
07-Mar-2017 15:46:06.039 INFO [localhost-startStop-1] org.springframework.web.context.support.XmlWebApplicationContext.doClose Closing Root WebApplicationContext: startup date [Tue Mar 07 15:46:00 CST 2017]; root of context hierarchy
07-Mar-2017 15:46:06.044 WARNING [localhost-startStop-1] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [ROOT] appears to have started a thread named [Thread-5] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 java.net.PlainSocketImpl.socketAccept(Native Method)
 java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:409)
 java.net.ServerSocket.implAccept(ServerSocket.java:545)
 java.net.ServerSocket.accept(ServerSocket.java:513)
 com.jingwei.mobile.socket.OcrSocketServer.run(OcrSocketServer.java:53)
07-Mar-2017 15:46:06.064 INFO [Thread-6] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["http-nio-8015"]
07-Mar-2017 15:46:06.065 INFO [Thread-6] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["ajp-nio-8010"]
07-Mar-2017 15:46:06.067 INFO [Thread-6] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["http-nio-8015"]
07-Mar-2017 15:46:06.067 INFO [Thread-6] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["ajp-nio-8010"]

How can I solve this problem????

Thanks !!!!

Incorrect usage of 'register' and 'with_items' in lamp_haproxy

Hi,

there are (at least) two files which incorrectly use 'register' along 'with_items'.
Apparently, 'register' creates an array of results, but the next task in each of those files seems to expect a single result only (as it checks for $last_run.changed).

See https://groups.google.com/d/topic/ansible-project/htHzfr5HzQE/discussion

https://github.com/ansible/ansible-examples/blob/master/lamp_haproxy/roles/web/tasks/add_to_lb.yml
https://github.com/ansible/ansible-examples/blob/master/lamp_haproxy/roles/web/tasks/remove_from_lb.yml

I have no idea how to get that fixed, hence only an issue, not a pull request :)

Into tomcat-standalone example the epel repository doesn't exist

Into the tomcat-standalone example, inside the selinux role (https://github.com/ansible/ansible-examples/blob/master/tomcat-standalone/roles/selinux/tasks/main.yml), when the epel try to be downloaded (tested into RHEL 7.1) from the url "http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm" I received the following error:

TASK [selinux : Download EPEL Repo - Centos/RHEL 7] ****************************
fatal: [xxxxxx]: FAILED! => {"changed": false, "dest": "/tmp/epel-release-7-5.noarch.rpm", "failed": true, "msg": "Request failed", "response": "HTTP Error 404: Not Found", "state": "absent", "status_code": 404, "url": "http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm"}

I fix it hardcoding the URL provided with the latest epel RPM available (https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm).

Now seems to be working with this.

problem with using ansible-playbook

hey,
hope its the right place to ask,
im trying to install onp package of intel by this manual:
https://software.intel.com/en-us/articles/quick-set-up-onp
and when im getting to the part that needs to use the ansible-playbook im getting an error:
the command is: (part III in the manual):

ansible-playbook –I inventory.ini multinode.yml
i am getting this error:
ERROR: inventory.ini: No JSON object could be decoded
thanks for the help, Itay.

ansible/tomcat

I am having error message at the last step (wait_for )

fatal: [webserver1]: FAILED! => {"changed": false, "elapsed": 300, "failed": true, "invocation": {"module_args": {"connect_timeout": 5, "delay": "10", "exclude_hosts": null, "host": "127.0.0.1", "path": null, "port": "8080", "search_regex": null, "state": "started", "timeout": 300}, "module_name": "wait_for"}, "msg": "Timeout when waiting for 127.0.0.1:8080"}

NO MORE HOSTS LEFT *************************************************************
to retry, use: --limit @mmc.retry

S3 module copy object to remote machine using dest parameter

Hi Team ,

As we have a central server from where we have been running the ansible code for instance creation and configuration.
Requirement :- Copy an object from S3 to instance being created
Approach :- As the other configuration are being taken care by winrm the machine , when it comes to copy the stuff from S3 I have been using delegate_to : localhost

code snippet used ;

  • name: Simple GET operation S3 for installersq
    delegate_to: 127.0.0.1
    s3:
    bucket: MybucketName
    object: /object path
    dest: "C:\Somefoldername" (which is meant to be the instance created)
    mode: get

Issue:- As I have used delegate_to : localhost I believe the destination taken is also localhost , where as , as per my requirement I need to copy the object to instances being created .

Note:- I can't pass the Ip as everytime the new server will be created and I need to copy the object on go and not in parts.

Thanks
Dilraj

Issues with wordpress-nginx

I'm making a RHEL7 adaptation of wordpress-nginx, and I see two issues:

  • Nginx restart fails, because there is a duplicate line

Listen 80 default_server

in nginx.conf and /conf.d/default.conf
I believe this affects not only RHEL 7 but earlier versions too.

  • SElinux keeps blocking nginx, you will get 403 forbidden if SElinux is enabled.

second part of the playbook "eucalyptus-ec2" not working

It simply fails to connect to the newly created server. The instance is up and running and manually ssh'able. I tried after pausing for 5 minutes. Even I am not clear about the method, how it is trying to connect to the host without any credentials? Or how the ssh key can be specified in the playbook.

PLAY [Configure instance] ******************************************************

TASK [setup] *******************************************************************
fatal: [184.72.194.8]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh.", "unreachable": true}
[WARNING]: Could not create retry file 'deploy_conf.retry'. [Errno 2] No such file or directory: ''

EC2 API keys exposed

Your EC2 API keys are exposed in the openshift/openshift_2 example playbook: https://github.com/ansible/ansible-examples/blob/master/openshift/openshift_ec2/group_vars/all#L5-L6

These should be revoked immediately and rotated out...

Also it looks like the openshift_ec2 playbook is a copy of the openshift playbook directly above it?

$ ec2-describe-group -O AKIAI7ALWJR5VQUFDNXQ -W Ryhzrvfz9EmsKqVzGRkdWBl4pncTz1wzZ3kmtMEu
GROUP   sg-83858eea     257667568502    default default group
PERMISSION      257667568502    default ALLOWS  tcp     0       65535   FROM    USER    257667568502    NAME default    ID sg-83858eea  ingress
PERMISSION      257667568502    default ALLOWS  udp     0       65535   FROM    USER    257667568502    NAME default    ID sg-83858eea  ingress
PERMISSION      257667568502    default ALLOWS  icmp    -1      -1      FROM    USER    257667568502    NAME default    ID sg-83858eea  ingress
PERMISSION      257667568502    default ALLOWS  tcp     22      22      FROM    CIDR    0.0.0.0/0       ingress
PERMISSION      257667568502    default ALLOWS  tcp     25      25      FROM    CIDR    0.0.0.0/0       ingress
PERMISSION      257667568502    default ALLOWS  tcp     80      80      FROM    CIDR    0.0.0.0/0       ingress
PERMISSION      257667568502    default ALLOWS  tcp     443     443     FROM    CIDR    0.0.0.0/0       ingress
PERMISSION      257667568502    default ALLOWS  tcp     3636    3636    FROM    CIDR    0.0.0.0/0       ingress
PERMISSION      257667568502    default ALLOWS  tcp     8161    8161    FROM    CIDR    0.0.0.0/0       ingress
GROUP   sg-6404aa0f     257667568502    CentOS 6-4 -x86_64- - Release Media-6-4 - 2013-03-09-AutogenByAWSMP-    This security group was generated by AWS Marketplace and is based on recommended settings for CentOS 64 x86_64 - Release Media version 64 - 2013-03-09 provided by CentOSorg
PERMISSION      257667568502    CentOS 6-4 -x86_64- - Release Media-6-4 - 2013-03-09-AutogenByAWSMP-    ALLOWS  tcp     22      22      FROM    CIDR    0.0.0.0/0       ingress


$ for x in `ec2-describe-regions | awk '{print $2}'`;do ec2-describe-instances --region $x -O AKIAI7ALWJR5VQUFDNXQ -W Ryhzrvfz9EmsKqVzGRkdWBl4pncTz1wzZ3kmtMEu ; done
RESERVATION     r-0b60195e      257667568502    websecuritygroup
INSTANCE        i-bb95ddee      ami-62f48f30                    stopped BenKey  0               t1.micro        2011-10-17T21:43:24+0000        ap-southeast-1a aki-9c235ace                    monitoring-disabled                          ebs                                      paravirtual     xen             sg-4ed5f71c     default false
BLOCKDEVICE     /dev/sda1       vol-0b487664    2011-10-17T18:27:15.000Z        true
BLOCKDEVICE     /dev/sdb        vol-f3447a9c    2011-10-17T18:35:26.000Z        false
TAG     instance        i-bb95ddee      Name

A bug in wordpress-nginx: ansible_selinux.status is not initialized on the first run

When I setup my server for the first time, I got this error when running site.yml.

TASK [mysql : Configure SELinux to start mysql on any port] ********************
fatal: [default]: FAILED! => {"failed": true, "msg": "The conditional check 'ansible_selinux.status == \"enabled\"' failed. The error was: error while evaluating conditional (ansible_selinux.status == \"enabled\"): 'bool object' has no attribute 'status'\n\nThe error appears to have been in '/Users/ctam/Projects/wordpress-nginx/roles/mysql/tasks/main.yml': line 10, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Configure SELinux to start mysql on any port\n  ^ here\n"}

When I re-ran site.yml the second time, though, it went fine. It turns out on the first run, common role would install libselinux-python, which gathers facts for ansible_selinux. Unfortunately, the installation of libselinux-python comes after the Ansible facts gathering. However, on the second run, since libselinux-python has already been installed, Ansible is able to gather ansible_selinux facts for the hosts.

Adding the follow right after Install libselinux-python in wordpress-nginx/roles/common/tasks/main.yml will fix this:

- name: Reload ansible_facts
  setup:

openshiftv3

openshift example is v2 , if you have a plan for v3 ,which is already released.

AnsibleUndefinedVariable

Hello all,

I have following error when I apply playbook for each one

{'msg': "AnsibleUndefinedVariable: One or more undefined variables: 'http_port' is undefined", 'failed': True}

Could you please explain how to configure those variables ? It would be great to add a note in the readme.

Thanks for help

Unable to Install Mongo with ansible-examples

I keep getting this error:

Starting mongod: about to fork child process, waiting until server is ready for connections.

forked process: 3270
ERROR: child process failed, exited with error number 1

This is my hosts file:

#The site wide list of mongodb servers

# the mongo servers need a mongod_port variable set, and they must not conflict.
[mongo_servers]
ansible-mongo-00 mongod_port=2700
ansible-mongo-01 mongod_port=2701
ansible-mongo-02 mongod_port=2702
ansible-mongo-03 mongod_port=2703

#The list of servers where replication should happen, by default include all servers
[replication_servers]
ansible-mongo-00
ansible-mongo-01
ansible-mongo-02
ansible-mongo-03

#The list of mongodb configuration servers, make sure it is 1 or 3
[mongoc_servers]
ansible-mongo-00
ansible-mongo-01
ansible-mongo-02

#The list of servers where mongos servers would run. 
[mongos_servers]
ansible-mongo-00
ansible-mongo-01

The hosts are in my /etc/hosts file.

I added sudo to the site.yml file because if not, nothing gets installed:


---
# This Playbook would deploy the whole mongodb cluster with replication and sharding.

- hosts: all
  sudo: True
  roles:
  - role: common

- hosts: mongo_servers
  sudo: True
  roles:
  - role: mongod

- hosts: mongoc_servers
  sudo: True
  roles:
  - role: mongoc

- hosts: mongos_servers
  sudo: True
  roles:
  - role: mongos

- hosts: mongo_servers
  sudo: True
  tasks:
  - include: roles/mongod/tasks/shards.yml 

The ansible-mongo-{00-03} hosts are CentOS6.5 x64 (DigitalOcean images). I created a sudo user for this playbook to work and added the 'sudo' rules to the site.yml. The mongo servers refuse to start with the first error message.

"Could not find the requested service \"'tomcat'\"

Hi,
I ran the script here on a AWS linux instance to setup and run a simple tomcat instance and I ran into 2 issues:

  1. I had to change the remote_user to a ec2-user in the site.yml --> any way around this ? What is the AWS best practice around this ?
  2. When I ran the script , it stopped at the 'Start Tomcat' command.

Would appreciate any help!

Thanks
JinPhil

change user: to remote_user:

The user parameter has been renamed to remote_user. Please update the playbooks to reflect the new parameter name.

replSet can't get local.system.replSet

This is in /var/log/mongo/mongod-172.....log repeated over and over.

2015-10-21T16:18:35.918-0500 [rsStart] replSet can't get local.system.replset config from self or any seed (EMPTYCONFIG)
2015-10-21T16:18:36.918-0500 [rsStart] replSet can't get local.system.replset config from self or any seed (EMPTYCONFIG)
2015-10-21T16:18:37.918-0500 [rsStart] replSet can't get local.system.replset config from self or any seed (EMPTYCONFIG)

I get the following when trying to run the playbook at the console:

ansible-playbook -i hosts site.yml --ask-pass

SSH password:

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

GATHERING FACTS ***************************************************************
ok: [172.19.17.143]
ok: [172.19.17.55]

TASK: [common | Create the hosts file for all machines] ***********************
ok: [172.19.17.55]
ok: [172.19.17.143]

TASK: [common | Create the repository for 10Gen] ******************************
ok: [172.19.17.55]
ok: [172.19.17.143]

TASK: [common | Create the EPEL Repository.] **********************************
ok: [172.19.17.143]
ok: [172.19.17.55]

TASK: [common | Create the GPG key for EPEL] **********************************
ok: [172.19.17.143]
ok: [172.19.17.55]

TASK: [common | Create the mongod user] ***************************************
ok: [172.19.17.143]
ok: [172.19.17.55]

TASK: [common | Create the data directory for the namenode metadata] **********
ok: [172.19.17.143]
ok: [172.19.17.55]

TASK: [common | Install the mongodb package] **********************************
failed: [172.19.17.55] => (item=libselinux-python,mongo-10gen,mongo-10gen-server,bc,python-pip) => {"changed": true, "item": "libselinux-python,mongo-10gen,mongo-10gen-server,bc,python-pip", "rc": 1, "results": ["libselinux-python-2.2.2-6.el7.x86_64 providing libselinux-python is already installed", "bc-1.06.95-13.el7.x86_64 providing bc is already installed", "Loaded plugins: langpacks, product-id, subscription-manager\nPackage mongo-10gen is obsoleted by mongodb-org, trying to install mongodb-org-2.6.11-1.x86_64 instead\nPackage mongo-10gen-server is obsoleted by mongodb-org-server, trying to install mongodb-org-server-2.6.11-1.x86_64 instead\nResolving Dependencies\n--> Running transaction check\n---> Package mongodb-org.x86_64 0:2.6.11-1 will be installed\n--> Processing Dependency: mongodb-org-shell = 2.6.11 for package: mongodb-org-2.6.11-1.x86_64\n--> Processing Dependency: mongodb-org-mongos = 2.6.11 for package: mongodb-org-2.6.11-1.x86_64\n--> Processing Dependency: mongodb-org-tools = 2.6.11 for package: mongodb-org-2.6.11-1.x86_64\n---> Package mongodb-org-server.x86_64 0:2.6.11-1 will be installed\n---> Package python-pip.noarch 0:7.1.0-1.el6 will be installed\n--> Processing Dependency: python(abi) = 2.6 for package: python-pip-7.1.0-1.el6.noarch\n--> Running transaction check\n---> Package mongodb-org-mongos.x86_64 0:2.6.11-1 will be installed\n---> Package mongodb-org-shell.x86_64 0:2.6.11-1 will be installed\n---> Package mongodb-org-tools.x86_64 0:2.6.11-1 will be installed\n---> Package python-pip.noarch 0:7.1.0-1.el6 will be installed\n--> Processing Dependency: python(abi) = 2.6 for package: python-pip-7.1.0-1.el6.noarch\n--> Finished Dependency Resolution\n You could try using --skip-broken to work around the problem\n You could try running: rpm -Va --nofiles --nodigest\n"]}
msg: Error: Package: python-pip-7.1.0-1.el6.noarch (epel)
Requires: python(abi) = 2.6
Installed: python-2.7.5-16.el7.x86_64 (@anaconda/7.1)
python(abi) = 2.7
python(abi) = 2.7
Available: python-2.7.5-18.el7_1.1.x86_64 (rhel-7-server-rpms)
python(abi) = 2.7
python(abi) = 2.7

ok: [172.19.17.143] => (item=libselinux-python,mongo-10gen,mongo-10gen-server,bc,python-pip)

TASK: [common | Install the latest pymongo package] ***************************
ok: [172.19.17.143]

TASK: [common | Create the iptables file] *************************************
ok: [172.19.17.143]

PLAY [mongo_servers] **********************************************************

GATHERING FACTS ***************************************************************
ok: [172.19.17.143]

TASK: [mongod | create data directory for mongodb] ****************************
ok: [172.19.17.143 -> 172.19.17.143] => (item=172.19.17.143)
ok: [172.19.17.143 -> 172.19.17.55] => (item=172.19.17.55)

TASK: [mongod | create data directory for mongodb] ****************************
ok: [172.19.17.143]

TASK: [mongod | create data directory for mongodb] ****************************
ok: [172.19.17.143]

TASK: [mongod | Create the mongodb startup file] ******************************
ok: [172.19.17.143 -> 172.19.17.143] => (item=172.19.17.143)
ok: [172.19.17.143 -> 172.19.17.55] => (item=172.19.17.55)

TASK: [mongod | Create the mongodb configuration file] ************************
ok: [172.19.17.143 -> 172.19.17.143] => (item=172.19.17.143)
ok: [172.19.17.143 -> 172.19.17.55] => (item=172.19.17.55)

TASK: [mongod | Copy the keyfile for authentication] **************************
ok: [172.19.17.143]

TASK: [mongod | Start the mongodb service] ************************************
ok: [172.19.17.143 -> 172.19.17.143] => (item=172.19.17.143)
failed: [172.19.17.143 -> 172.19.17.55] => (item=172.19.17.55) => {"changed": true, "cmd": ["/etc/init.d/mongod-172.19.17.143", "start"], "delta": "0:00:00.069731", "end": "2015-10-21 17:13:13.903516", "item": "172.19.17.55", "rc": 1, "start": "2015-10-21 17:13:13.833785", "warnings": []}
stderr: Job for mongod-172.19.17.143.service failed. See 'systemctl status mongod-172.19.17.143.service' and 'journalctl -xn' for details.
stdout: Starting mongod-172.19.17.143 (via systemctl): [FAILED]

FATAL: all hosts have already failed -- aborting

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

172.19.17.143 : ok=17 changed=0 unreachable=0 failed=1
172.19.17.55 : ok=7 changed=0 unreachable=0 failed=1

[root@localhost mongodb]# systemctl status mongod-172.19.17.143.service -l
mongod-172.19.17.143.service - SYSV: Mongo is a scalable, document-oriented database.
Loaded: loaded (/etc/rc.d/init.d/mongod-172.19.17.143)
Active: failed (Result: timeout) since Wed 2015-10-21 15:54:34 CDT; 20min ago
Process: 16946 ExecStart=/etc/rc.d/init.d/mongod-172.19.17.143 start (code=exited, status=0/SUCCESS)

Oct 21 15:49:34 localhost.localdomain runuser[16950]: pam_unix(runuser:session): session opened for user mongod by (uid=0)
Oct 21 15:49:34 localhost.localdomain mongod-172.19.17.143[16946]: Starting mongod: about to fork child process, waiting until server is ready for connections.
Oct 21 15:49:34 localhost.localdomain mongod-172.19.17.143[16946]: forked process: 16954
Oct 21 15:49:35 localhost.localdomain mongod-172.19.17.143[16946]: child process started successfully, parent exiting
Oct 21 15:49:35 localhost.localdomain runuser[16950]: pam_unix(runuser:session): session closed for user mongod
Oct 21 15:49:35 localhost.localdomain mongod-172.19.17.143[16946]: [ OK ]
Oct 21 15:49:35 localhost.localdomain systemd[1]: PID file /var/run/mongo/mongod.pid not readable (yet?) after start.
Oct 21 15:54:34 localhost.localdomain systemd[1]: mongod-172.19.17.143.service operation timed out. Terminating.
Oct 21 15:54:34 localhost.localdomain systemd[1]: Failed to start SYSV: Mongo is a scalable, document-oriented database..
Oct 21 15:54:34 localhost.localdomain systemd[1]: Unit mongod-172.19.17.143.service entered failed state.

hadoop playbook file permission

[root@GroupI-LTMP-1 ~]# ll /etc/hadoop/conf/
总用量 60
-rw-r--r-- 1 root root 1335 11月 21 07:25 configuration.xsl
-rw-r--r-- 1 root root 1009 2月 25 17:06 core-site.xml
-rw-r--r-- 1 root root 1773 2月 25 17:06 hadoop-metrics2.properties
-rw-r--r-- 1 root root 2489 2月 25 17:06 hadoop-metrics.properties
-rw-r--r-- 1 root root 9196 11月 21 07:25 hadoop-policy.xml
-rw-r--r-- 1 root root 1791 2月 25 17:06 hdfs-site.xml
-rw-r--r-- 1 root root 8735 11月 21 07:25 log4j.properties
-rw------- 1 root root 461 2月 25 17:06 mapred-site.xml

14/02/25 17:21:12 FATAL conf.Configuration: error parsing conf mapred-site.xml
java.io.FileNotFoundException: /etc/hadoop/conf.empty/mapred-site.xml (Permission denied)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.(FileInputStream.java:120)
at java.io.FileInputStream.(FileInputStream.java:79)
at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:70)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:161)
at java.net.URL.openStream(URL.java:1010)
at org.apache.hadoop.conf.Configuration.parse(Configuration.java:2030)

why only mapred-site.xml is 600?

ansible-examples/lamp_simple - fails on selinux (says it's disabled)

I presume this is a relic of these playbooks not being ready for 1.3x but I receive the following error when I try to run this playbook:

failed: [[REDACTED IP]] => {"failed": true, "item": ""}
msg: SELinux is disabled on this host.

This happens for all hosts I'm running this against.

lamp_simple is incompatible with CentOS 7

Hello!

One of incompatibilities was fixed by #118 - but two remain:

  1. There is no mysql-server package in the default repo
  2. There is no iptables service, it was replaced by firewalld

This can be fixed easily, and I can do this, but that will make this example incompatible with CentOS earlier than 7. Is it worth doing this?

enable-iis : A parameter cannot be found that matches parameter name 'IncludeManagementTools'

When running the playbook enable-iis.yml i receive the following error:

###>: ansible-playbook -i hosts playbooks/enable-iis.yml --user vagrant --ask-passSSH password: 

PLAY [Install IIS] ************************************************************ 

TASK: [Install IIS] *********************************************************** 
failed: [server4] => {"failed": true}
msg: A parameter cannot be found that matches parameter name 'IncludeManagementTools'.

FATAL: all hosts have already failed -- aborting

PLAY RECAP ******************************************************************** 
           to retry, use: --limit @/home/vagrant/iis.retry

server4                    : ok=0    changed=0    unreachable=0    failed=1   

Can you please help ?
Thanks

lamp_haproxy example shouldn't for loop lbservers

File: https://github.com/ansible/ansible-examples/blob/master/lamp_haproxy/roles/haproxy/templates/haproxy.cfg.j2

Line 33

    {% for host in groups.lbservers %}
    	listen {{ daemonname }} 0.0.0.0:{{ listenport }}
    {% endfor %}
    balance     {{ balance }}

Each lbserver has daemonname, listenport, and balance defined. Further, each lbserver seems to get one of these haproxy cfg files. It doesn't make sense to loop through them here. If there were more than 1 lbserver, you'd have multiple identical lines.

Is that correct?

user module password param

"Optionally set the user's password to this crypted value. See the user example in the github examples directory for what this looks like in a playbook."

There is no 'user example' in this repo.

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.