Re: [ansible-project] ansible 2.2.0 - ios_facts module

2016-08-29 Thread Peter Sprygada
Hi Rukka,

See sample playbook here:
https://gist.github.com/privateip/f473d9ce25dd699b14c9987264159616



On Mon, Aug 29, 2016 at 5:23 AM, Rukka Pal  wrote:

> I am a newbie and would like to use Ansible to automate network operation
> tasks, right now I am only interested in fact collection. I have been using
> the "raw" module which is not very flexible, hence I decided to install
> (from GitHub) ansible 2.2.0 to try the "ios_facts" module. First I was
> using paramiko, but it failed to open SFTP connection. Then I tried default
> ansible config, but it was complaining about SSH ("SSH Error: data could
> not be sent to the remote host. Make sure this host can be reached over
> ssh") so I changed "scp_if_ssh" to true. Now it says ""failed to transfer
> file to Line has invalid autocommand \"/bin/sh -c ( umask 77 && mkdir -p
> \"\"/ios_facts.py:\n\nPrivilege denied.\n" and the command won't run.
>
> What am I missing here? Could someone provide an example ad-hoc command or
> an example playbook?
>
> Environment: 3.13.0-93-generic Ubuntu 14, Perl 5.18.2-2ubuntu1.1
>
> Thanks in advance!
>
> --
> 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-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/ansible-project/1cee5cad-6ce4-4dfe-b99b-73ebb1a87e6f%40googlegroups.
> com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEkdrMhNJgK-SaU4%3D%2B-wgHRH3j%3DnZHKJNSA47AvJRvLJDhEJmQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Random SSH unreachables using delegation in Ansible 2.1.0

2016-08-29 Thread Soren Olegnowicz
Ok. Thank you for the tip. I set "forks=1" in the config file and that 
seems to have contained the problem. Runs a bit slower though.

On Friday, August 26, 2016 at 2:53:28 PM UTC-4, Kai Stian Olstad wrote:
>
> On 24. aug. 2016 23:23, Soren Olegnowicz wrote: 
> > So I have a task that delegates a template deployed to one server to a 
> > different server. When this task is run on just a single server I get no 
> > errors. However if I try running this delegation task on all the servers 
> > (16 servers) it needs to be deployed to in a single play, then it will 
> only 
> > succeed on only 50%-80% of the servers. The servers that it fails on are 
> > random every time I run the play (in dry mode). 
>
> Ansible default to running all task on all host before moving to the 
> next task. Forks is default to 5, so this template will have 5 
> simultaneous runs on the delegate_to host. 
> So if the template is changing the same file they will interfere with 
> each other. 
>
> -- 
> Kai Stian Olstad 
>

-- 
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1dd8414f-c3dd-4fcf-b81d-dcb408ce6c0f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] EC2 dynamic inventory: SSH rules

2016-08-29 Thread Soren Olegnowicz
Hey guys I need to connect to my ec2 instances in various ways using the 
ec2.ini provided. Right now my I can only get my ec2.ini to connect to my 
instances via their private or public IP alone, but I need to connect to 
some instances via their private IP and some via their public. Any 
suggestions for introducing logic to accomplish this?

-- 
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/906ad96f-1f4b-4376-abe8-aee0ab487ba2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: yum module not updating package when installing from local file

2016-08-29 Thread Andrea C
I'm having this same problem...

What is your output? What's wierd is that in the output it doesn't even 
tell me that my RPM is already installed. It has blank results:
ok: [10.0.201.83] => {"changed": false, "msg": "", "rc": 0, "results": []}

Anyone have an idea how to fix this??

On Friday, June 10, 2016 at 8:03:47 AM UTC-7, Dick Davies wrote:
>
> It's probably time to show us the playbooks in question. This does 
> work for most people, it's 
> possible you have made some error. 
>
> On 8 June 2016 at 08:09, Shay Rybak > 
> wrote: 
> > My issue is that even when stating full package name with version it 
> does 
> > not update the package. 
> > 
> > On Tuesday, June 7, 2016 at 9:02:14 PM UTC+3, Adam Morris wrote: 
> >> 
> >> If you are just giving the package name (without a version) then the 
> yum 
> >> module will check if that is installed.  It is so no task needs to be 
> >> performed.  If you were using a repository you would find no 
> difference.  If 
> >> you were using a repository and set the state to latest it would update 
> but 
> >> that is not valid for a local package.  Your best bet is to specify the 
> full 
> >> package name, with version (or use a repository) 
> > 
> > -- 
> > 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/36d5a57e-2721-4f88-9bc3-b44b0c4f2a26%40googlegroups.com.
>  
>
> > 
> > For more options, visit https://groups.google.com/d/optout. 
>

-- 
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b2d7e580-dad5-4dd3-a71c-0f7001767160%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] How to install specific version of things?

2016-08-29 Thread Cann
Hello Everyone,

I have a ubuntu 14 server and I simply want to have latest version of php 5 
on my machine.
I add a PPA repo and I ran following playbook to install my php extensions 
but *my PHP version is keep getting upgraded.*

I don't understand what I need to do to only get PHP 5.6.x
As soon as I ran my playbook, it install 4 different php version: 5.5  5.6 
 7.0  7.1

Please help.


---
- name: Add ppa Repository to get latest php5.xxx
  become: yes
  apt_repository: 
repo: ppa:ondrej/php
update_cache: true

- name: Install required php extensions
  apt: name={{ item }} update_cache=yes state=present
  become: yes
  with_items:
- php5.6-cli
- php5.6
- php5.6-gd
- php5.6-mcrypt
- php5.6-curl
- php5.6-fpm
- php5.6-mbstring
- php5.6-mysql
- php5.6-imagick
- mcrypt
- curl
- unzip
- zip
- git
- python-software-properties


-- 
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/347be0eb-7ca8-4cc8-9573-a5cecb6a23d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Configuring AWS EC2 instance after it's created through Ansible

2016-08-29 Thread Matt Davis
You can use the returned data from cloudformation to call add_host 
, then start a new 
play that targets that host, or set up an EC2 dynamic inventory script that 
will pick up the host(s) you're creating and conditionally call meta: 
inventory_refresh when you know an instance got created (then do the same 
thing: start another play that touches the right host(s)). I personally 
prefer the add_host approach as it's more definitive that you're touching 
exactly the right host, but potato, potahto...

-Matt

On Thursday, August 25, 2016 at 7:59:50 PM UTC-7, Michael Ludvig wrote:
>
> Hi there
>
> I've got a play that creates an AWS EC2 instance through a CloudFormation 
> template. After it's created I would like to configure it - I can use the 
> AWS tools to do that but I prefer to use Ansible to be consistent with our 
> other deployments.
>
> What I have now is:
>
> ---
> - name: Create Amazon Linux Instance
>   hosts: localhost
>   connection: local
>   gather_facts: no
>   vars_files:
>   - config.yml
>
>   tasks:
>   - name: Create CloudFormation Stack
> cloudformation:
>   stack_name: "{{ stack_name }}"
>   state: present
>   template: basic-ec2-stack.json
>   template_parameters:
> KeyName: "{{ key_name }}"
> VpcId: "{{ vpc_id }}"
> SubnetId: "{{ subnet_id }}"
> ...
> register: stack
>
>   # The new instance name is in stack.stack_outputs.DnsName ...
>   - debug: var=stack.stack_outputs.DnsName
>
>
> Now what? How can I run the rest of the playbook against the newly created 
> host?
> For example I would like to create user 'blah' but not on the localhost 
> (against which the cloudformation module is running) but obviously on the 
> EC2 instence. How do I do that?
>
> Thanks!
>
> Michael
>
>
>

-- 
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/9f020130-988a-474c-90a1-49c4bf10b951%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Version (and other) problems with Ansible Azure Modules

2016-08-29 Thread Matt Davis
It doesn't look like your Azure SDK is at the correct version- the rc5 
version of ComputeManagementClient 

 
does indeed take two positional args, and the version you have installed 
clearly only takes one. 

On Monday, August 29, 2016 at 7:24:57 AM UTC-7, Andrea Dixon wrote:
>
> Is azure 2.0.0rc5 + ansible stable-2.1 supposed to work now? I have azure 
> python sdk 2.0.0rc5 installed and I'm trying to run the azure_rm.py 
> inventory file that I plucked from the head of stable-2.1 but I get the 
> following error:
>
> [cafex@cfx-ansible stable-2.1]$ ./azure_rm.py --list
> Traceback (most recent call last):
>   File "./azure_rm.py", line 763, in 
> main()
>   File "./azure_rm.py", line 760, in main
> AzureInventory()
>   File "./azure_rm.py", line 369, in __init__
> self._compute_client = rm.compute_client
>   File "./azure_rm.py", line 353, in compute_client
> self._compute_client = ComputeManagementClient(self.azure_credentials, 
> self.subscription_id)
>   File 
> "/usr/lib/python2.7/site-packages/azure/mgmt/compute/compute_management_client.py",
>  
> line 146, 
> in
>  
> __init__
> self._serialize = Serializer(client_models)
> TypeError: __init__() takes exactly 1 argument (2 given)
>
> I'm assuming this azure_rm.py just has a dependency on the azure sdk and 
> not my ansible install? As my ansible is not from stable-2.1.
>
> On Friday, 8 July 2016 20:06:08 UTC+1, Matt Davis wrote:
>>
>> I've cherry-picked everything back to 2.1 that's been fixed in devel, so 
>> it *should* all work on current stable-2.1 (slash 2.1.1 RC2). If there's 
>> stuff that still isn't working, please file issues so we can get it fixed.
>>
>> Thanks!
>>
>> -Matt
>>
>> On Thursday, July 7, 2016 at 6:25:25 PM UTC-7, Steven Carter wrote:
>>>
>>> That worked!  I really appreciate it!  Should the other functions work 
>>> at this point or will that still take some time?
>>>
>>> Steven.
>>>
>>> On Thu, Jul 7, 2016 at 2:02 PM, Matt Davis  wrote:
>>>
 Yeah, looks like the azure_rm_deployment module got missed for rc5 
 updates. I've tested and pushed a fix to devel and stable-2.1 (just in the 
 nick of time for 2.1.1rc2), so try updating from stable-2.1 with 
 submodules- should work now.

 -Matt


 On Thursday, July 7, 2016 at 5:51:12 AM UTC-7, Steven Carter wrote:
>
> I am installing with 'pip install --no-cache-dir git+git://
> github.com/ansible/ansible.git@stable-2.1', so the source directory 
> gets plowed over every time.
>
> Thanks,
>
> Steven.
>
> On Thu, Jul 7, 2016 at 4:38 AM, 'J Hawkesworth' via Ansible Project <
> ansible...@googlegroups.com> wrote:
>
>> Just a guess but if you are running ansible from source and switching 
>> between branches, you may need to run a 
>>
>> make clean
>>
>> to get rid of any .pyc files
>>
>> Hope this helps,
>>
>> Jon
>>
>> On Thursday, July 7, 2016 at 4:26:17 AM UTC+1, Steven Carter wrote:
>>>
>>> Strange, I thought that I had this working with azure 2.0.0rc5 + 
>>> ansible stable-2.1, but when I tried to re-install and run my ansible, 
>>> I 
>>> get:
>>>
>>> An exception occurred during task execution. The full traceback is:
>>> Traceback (most recent call last):
>>>   File "/tmp/ansible_nsnYjC/ansible_module_azure_rm_deployment.py", 
>>> line 661, in 
>>> main()
>>>   File "/tmp/ansible_nsnYjC/ansible_module_azure_rm_deployment.py", 
>>> line 657, in main
>>> AzureRMDeploymentManager()
>>>   File "/tmp/ansible_nsnYjC/ansible_module_azure_rm_deployment.py", 
>>> line 438, in __init__
>>> supports_check_mode=False)
>>>   File 
>>> "/tmp/ansible_nsnYjC/ansible_modlib.zip/ansible/module_utils/azure_rm_common.py",
>>>  
>>> line 192, in __init__
>>>   File "/tmp/ansible_nsnYjC/ansible_module_azure_rm_deployment.py", 
>>> line 449, in exec_module
>>> deployment = self.deploy_template()
>>>   File "/tmp/ansible_nsnYjC/ansible_module_azure_rm_deployment.py", 
>>> line 476, in deploy_template
>>> deploy_parameter = DeploymentProperties()
>>> TypeError: __init__() takes at least 2 arguments (1 given)
>>>
>>> fatal: [localhost]: FAILED! => {"changed": false, "failed": true, 
>>> "invocation": {"module_name": "azure_rm_deployment"}, "module_stderr": 
>>> "Traceback (most recent call last):\n  File 
>>> \"/tmp/ansible_nsnYjC/ansible_module_azure_rm_deployment.py\", line 
>>> 661, in 
>>> \nmain()\n  File 
>>> \"/tmp/ansible_nsnYjC/ansible_module_azure_rm_deployment.py\", line 
>>> 657, in 
>>> main\nAzureRMDeploymentManager()\n  File 

[ansible-project] Re: In Ansible, how do I use the ec2_group module to query if a security group exists, and then check for the result?

2016-08-29 Thread ZillaYT
Essentially, I want to do this in Ansible

aws ec2 describe-security-groups --filters 
Name=group-name,Values=sg_ansible_test 
--query 'SecurityGroups[*].{Name:GroupName}'




On Monday, August 29, 2016 at 1:56:47 PM UTC-4, ZillaYT wrote:
>
> Im trying to write a role that queries a security group if it exists, and 
> then create if if not. So I manually created the security group first via 
> AWS GUI.
>
> Then I tried the following for the query.
>
> - name: Query if security group exits
>   ec2_group: name="my_test_sg" description="Test SG" region="us-east-1"
>   register: sg_query
>
> But I get the following
>
> TASK [security_group : Query if the the security group exists] 
> *
>
>  
>
> fatal: [10.22.9.27]: FAILED! => {"changed": false, "failed": true, 
> "module_stderr": "", "module_stdout": "Traceback (most recent call 
> last):\r\n  File \"/tmp/ansible_jGKApb/ansible_module_ec2_group.py\", line 
> 472, in \r\nmain()\r\n  File 
> \"/tmp/ansible_jGKApb/ansible_module_ec2_group.py\", line 271, in main\r\n 
>for curGroup in ec2.get_all_security_groups():\r\n  File 
> \"/usr/lib/python2.7/site-packages/boto/ec2/connection.py\", line 2984, in 
> get_all_security_groups\r\n[('item', SecurityGroup)], verb='POST')\r\n 
>  File \"/usr/lib/python2.7/site-packages/boto/connection.py\", line 1186, 
> in get_list\r\nraise self.ResponseError(response.status, 
> response.reason, body)\r\nboto.exception.EC2ResponseError: 
> EC2ResponseError: 403 Forbidden\r\n encoding=\"UTF-8\"?>\r\nUnauthorizedOperationYou
>  
> are not authorized to perform this 
> operation.5b101381-5d4f-43f0-b225-7a042e6151cf\r\n"
> , "msg": "MODULE FAILURE", "parsed": false}
>
>
> It looks like it's trying to create the security group. Any clues?
>
>
> Thanks.
>

-- 
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/33291cad-bfb2-4d5c-810c-6a1a1542ff9c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: replace public ip from /etc/hosts file with private ip using Ansible

2016-08-29 Thread ZillaYT
Look at the "lineinfile" module.

On Monday, August 29, 2016 at 10:24:36 AM UTC-4, BB wrote:
>
> I need to replace public ip from /etc/hosts file with private ip in bulk 
> cluster of systems.
> Ansible gathered fact , may work but not sure which is for what.
>
> Another way, I can have public and private ip register as variable and 
> swap them.
>
> What would be the best practice to do in ansible way?
>
> Currently in /etc/hosts 
> 
> public_ip   hostname short_hostname
>
> I need to change it to 
>
> private_ip  hostname short_hostname
>
>
>
>

-- 
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/49551c3b-7e0a-4086-a48f-994f6ae665b3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Confused By EC2 Dynamic Inventory

2016-08-29 Thread ZillaYT
Provide the whole "ansible-playbook" command line you're invoking.

On Monday, August 29, 2016 at 10:25:01 AM UTC-4, Jon Forrest wrote:
>
> I'm 90% done with a problem. The remaining 10% requires using 
> EC2 dynamic inventory, but I'm missing something important. 
> I'm creating two instances ('frontend' and 'backend') where 
> backend only allows SSH access from frontend, and nowhere else. 
> Backend runs MySQL so I want to limit MySQL logins 
> to only from frontend. This is trivial to do manually 
> but I want to do it from an Ansible playbook. 
>
> There are 2 things I still need to do: 
>
> 1) Add a rule to the security group used by backend to 
> allow access for SSH and MySQL only from frontend. 
>
> 2) Without using dynamic inventory I've had to populate 
> the hosts file with lines like: 
>
> frontend ansible_ssh_host=52.32.251.105 
> backend ansible_ssh_host=52.27.199.119 
>
> I'd want to somehow do this dynamically. 
>
> I've looked at both the Ansible docs and an excellent page 
> at https://djaodjin.com/blog/deploying-on-ec2-with-ansible.blog.html 
> (see below) but I'm not seeing how to accomplish these 2 tasks. 
>
> I know about the ec2.py script, which I can successfully run manually, 
> but I don't know how to incorporate what it produces into a playbook. 
>
> I'd appreciate any help. 
>
> Cordially, 
> Jon Forrest 
>
> P.S. What I'm confused about in the djaodjin page is where he lists 
> basic-delete.yml and shows this line: 
>
> hosts: security_group_*my-security-group*# <-- MAGIC IS HERE! 
>
> I'm guessing that somehow this is invoking the ec2.py script but I 
> don't see how. 
>
>
>

-- 
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/598c955a-e8f4-41f7-8723-631f7f5faefa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] In Ansible, how do I use the ec2_group module to query if a security group exists, and then check for the result?

2016-08-29 Thread ZillaYT
Im trying to write a role that queries a security group if it exists, and 
then create if if not. So I manually created the security group first via 
AWS GUI.

Then I tried the following for the query.

- name: Query if security group exits
  ec2_group: name="my_test_sg" description="Test SG" region="us-east-1"
  register: sg_query

But I get the following

TASK [security_group : Query if the the security group exists] 
*

 

fatal: [10.22.9.27]: FAILED! => {"changed": false, "failed": true, 
"module_stderr": "", "module_stdout": "Traceback (most recent call 
last):\r\n  File \"/tmp/ansible_jGKApb/ansible_module_ec2_group.py\", line 
472, in \r\nmain()\r\n  File 
\"/tmp/ansible_jGKApb/ansible_module_ec2_group.py\", line 271, in main\r\n 
   for curGroup in ec2.get_all_security_groups():\r\n  File 
\"/usr/lib/python2.7/site-packages/boto/ec2/connection.py\", line 2984, in 
get_all_security_groups\r\n[('item', SecurityGroup)], verb='POST')\r\n 
 File \"/usr/lib/python2.7/site-packages/boto/connection.py\", line 1186, 
in get_list\r\nraise self.ResponseError(response.status, 
response.reason, body)\r\nboto.exception.EC2ResponseError: 
EC2ResponseError: 403 Forbidden\r\n\r\nUnauthorizedOperationYou
 
are not authorized to perform this 
operation.5b101381-5d4f-43f0-b225-7a042e6151cf\r\n"
, "msg": "MODULE FAILURE", "parsed": false}


It looks like it's trying to create the security group. Any clues?


Thanks.

-- 
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/f1b19c96-786c-4052-a6c7-995b84d8bf8e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Ansible Expect module can't match string/regex script questions

2016-08-29 Thread Kai Stian Olstad

On 26. aug. 2016 11:16, Andrea Francesco Speziale wrote:

I'm trying to automate a script installation through Ansible in a Vagrant
machine.

I tried a lot to find a solution across the web but the documentation and
the examples are very weak.

That script I'm trying to install is prompting questions that I'm trying to
answer programmatically with the *Ansible Expect Module*.

Ansible Task:

- name: "Running Lisk installation"
  become: True
  become_user: vagrant
  expect:
  command: bash installLisk.sh install -r {{env}}
  responses:
'Where do you want to install Lisk to? (Default
/home/vagrant)': "/home/vagrant"
'Would like to install NTP? (y/n):': "y"
  echo: yes

It seems it can't recognize the question or the answer, *this is the error
I'm getting back* from the provisioning


Since responses is regex, you need to escape all the regex special 
character with a backspace that you mean literally.


--
Kai Stian Olstad

--
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/68edfaf9-80a8-764b-ae06-b8523ef79227%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] replacing public ip with private in /etc/hosts

2016-08-29 Thread Auto-mate
I am trying to replace public ip  with private ip in /etc/hosts for bulk of 
hosts . 

Current setup


PUBLIC_IP   hostname  shot_hostname 

Needed :
 
PRIVATE _IP hostname  short_hostname



How I can do it using ansible? I wonder if it can be done using gathered 
facts by ansible? 
I would think of , getting the public ip and register as  variable and same 
time get the private ip . 
Now, replacing it using replace or inline module. Any best approach ?

-- 
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e0265d84-a006-4d11-ac9d-b245218870b9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible Expect module can't match string/regex script questions

2016-08-29 Thread Andrea Francesco Speziale


I'm trying to automate a script installation through Ansible in a Vagrant 
machine.

I tried a lot to find a solution across the web but the documentation and 
the examples are very weak.

That script I'm trying to install is prompting questions that I'm trying to 
answer programmatically with the *Ansible Expect Module*.

Ansible Task:

- name: "Running Lisk installation"
  become: True
  become_user: vagrant
  expect:
  command: bash installLisk.sh install -r {{env}}
  responses:
'Where do you want to install Lisk to? (Default 
/home/vagrant)': "/home/vagrant"
'Would like to install NTP? (y/n):': "y"
  echo: yes

It seems it can't recognize the question or the answer, *this is the error 
I'm getting back* from the provisioning

TASK [lisk : Running Lisk installation] 


fatal: [default]: FAILED! => {
"changed": true,
"cmd": "bash installLisk.sh install -r test",
"delta": "0:00:30.137468", 
"end": "2016-08-26 08:18:46.740017",
"failed": true,
"rc": null,
"start": "2016-08-26 08:18:16.602549",

"stdout": "Checking prerequisites:\r\n
Curl is installed.\t\t\t\t\t\u001b[32mPassed\u001b(B\u001b[m\r\n
Tar is installed.\t\t\t\t\t\u001b[32mPassed\u001b(B\u001b[m\r\n
Wget is installed.\t\t\t\t\t\u001b[32mPassed\u001b(B\u001b[m\r\n
Sudo is installed and 
authenticated.\t\t\t\u001b[32mPassed\u001b(B\u001b[m\r\n\
u001b[32mAll preqrequisites passed!\u001b(B\u001b[m\r\n
Where do you want to install Lisk to? (Default /home/vagrant): ",

"stdout_lines": [
"Checking prerequisites:", 
"Curl is installed.\t\t\t\t\t\u001b[32mPassed\u001b(B\u001b[m", 
"Tar is installed.\t\t\t\t\t\u001b[32mPassed\u001b(B\u001b[m", 
"Wget is installed.\t\t\t\t\t\u001b[32mPassed\u001b(B\u001b[m", 
"Sudo is installed and 
authenticated.\t\t\t\u001b[32mPassed\u001b(B\u001b[m",
"\u001b[32mAll preqrequisites passed!\u001b(B\u001b[m", 
"Where do you want to install Lisk to? (Default /home/vagrant): "
]}

*Thank you* all guys in advance

-- 
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/f0d8e9b8-fefe-40dd-ab69-8d3c902914ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Confused By EC2 Dynamic Inventory

2016-08-29 Thread Jon Forrest

I'm 90% done with a problem. The remaining 10% requires using
EC2 dynamic inventory, but I'm missing something important.
I'm creating two instances ('frontend' and 'backend') where
backend only allows SSH access from frontend, and nowhere else.
Backend runs MySQL so I want to limit MySQL logins
to only from frontend. This is trivial to do manually
but I want to do it from an Ansible playbook.

There are 2 things I still need to do:

1) Add a rule to the security group used by backend to
allow access for SSH and MySQL only from frontend.

2) Without using dynamic inventory I've had to populate
the hosts file with lines like:

frontend ansible_ssh_host=52.32.251.105
backend ansible_ssh_host=52.27.199.119

I'd want to somehow do this dynamically.

I've looked at both the Ansible docs and an excellent page
at https://djaodjin.com/blog/deploying-on-ec2-with-ansible.blog.html
(see below) but I'm not seeing how to accomplish these 2 tasks.

I know about the ec2.py script, which I can successfully run manually,
but I don't know how to incorporate what it produces into a playbook.

I'd appreciate any help.

Cordially,
Jon Forrest

P.S. What I'm confused about in the djaodjin page is where he lists
basic-delete.yml and shows this line:

hosts: security_group_*my-security-group*# <-- MAGIC IS HERE!

I'm guessing that somehow this is invoking the ec2.py script but I
don't see how.


--
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/npv3ph%24puh%241%40blaine.gmane.org.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] print public dns name of ec2 instance

2016-08-29 Thread Benjamin Fernandis
Hi,

I am testing to print ec2 instance public dns names by ansible.

- hosts:  localhost
  connection: local
  
  tasks:
- name: get instance public dns name
  ec2_remote_facts:
region: ap-southeast-2
filters:
  instance-state-name:  running
  register: ec2

- debug:  var=ec2.instances.public_dns_name

but i got " "ec2.instances.public_dns_name": "VARIABLE IS NOT DEFINED!" .

where i m doing mistake? 

Thanks
Benjo



-- 
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/fd26b6d1-2da2-4193-9ba1-63e2f5aab373%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] replace public ip from /etc/hosts file with private ip using Ansible

2016-08-29 Thread BB
I need to replace public ip from /etc/hosts file with private ip in bulk 
cluster of systems.
Ansible gathered fact , may work but not sure which is for what.

Another way, I can have public and private ip register as variable and swap 
them.

What would be the best practice to do in ansible way?

Currently in /etc/hosts 

public_ip   hostname short_hostname

I need to change it to 

private_ip  hostname short_hostname



-- 
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a39c18b5-08bf-463a-bce9-96aa2a88a129%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] HOstname always change

2016-08-29 Thread Pietro Leone
Hi, I created this playbook:

---
- name: basic host configuration
  hosts: ansibleclt00
  become: True
  tasks:
  - name: get hostname
shell: hostname
register: nomemacchina
  - name: change hostname
vars:
  mio_ipaddr: 192.168.43.101
  mio_prefix: 24
  mio_gateway: 192.168.43.1
  mio_dns: 8.8.8.8
  mio_hostname: ansibleclt00
command: hostnamectl set-hostname {{ mio_hostname }}
when: nomemacchina != mio_hostname
register: nomehost
  - name: reboot the server
shell: /sbin/shutdown -r 1
async: 0
poll: 0
ignore_errors: true
register: riavvio
when: nomehost.changed

When I run it:

PLAY [basic host configuration] 


TASK [setup] 
***
ok: [ansibleclt00]

TASK [get hostname] 

changed: [ansibleclt00]

TASK [change hostname] 
*
changed: [ansibleclt00]

TASK [reboot the server] 
***
changed: [ansibleclt00]

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

I'm experimenting with ansible, my idea is to verify the hostname of a 
server, if the name differs from the name in variable "mio_hostname", the 
hostname is changed (task "change hostname") to mio_hostname and then the 
server is rebooted.

But seems that the hostname differs everytime and I do not understand why.

Any idea?

ansible 2.1.1.0 on CentOS7

Thanks, Pietro.

-- 
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/2815f040-e382-436f-a09c-5714de9b94e8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] How to with Ansible's Git module ?

2016-08-29 Thread Sören Jentzsch
Hi Ansible-Community,

first of all I would like to mention that I am quite proud to be part of 
the Ansible Community.
I introduced Ansible within some innovative Robotic-related projects inside 
a large company where I am working, and so far everyone is happy.

When porting somebody elses code to Ansible 2.x, i found the following code 
block:

shell: git submodule update --init

Ansible gives me a warning:

[WARNING]: Consider using git module rather than running git

My question: What is the equivalent of that shell command by using the 
Ansible git module, in order to get rid of the warning?

I am a bit new to Git submodules, and all that the Git module tells me 
about submodules is that I can track_submodules yes/no, but I have no idead 
what it translates to shell-command-wise.

Thanks for helping out!!

Best from Munich
Sören

-- 
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/2c5d4721-fd5a-4ce9-ad45-006571e47a4c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Version (and other) problems with Ansible Azure Modules

2016-08-29 Thread Andrea Dixon
Is azure 2.0.0rc5 + ansible stable-2.1 supposed to work now? I have azure 
python sdk 2.0.0rc5 installed and I'm trying to run the azure_rm.py 
inventory file that I plucked from the head of stable-2.1 but I get the 
following error:

[cafex@cfx-ansible stable-2.1]$ ./azure_rm.py --list
Traceback (most recent call last):
  File "./azure_rm.py", line 763, in 
main()
  File "./azure_rm.py", line 760, in main
AzureInventory()
  File "./azure_rm.py", line 369, in __init__
self._compute_client = rm.compute_client
  File "./azure_rm.py", line 353, in compute_client
self._compute_client = ComputeManagementClient(self.azure_credentials, 
self.subscription_id)
  File 
"/usr/lib/python2.7/site-packages/azure/mgmt/compute/compute_management_client.py",
 
line 146, 
in  
   
__init__
self._serialize = Serializer(client_models)
TypeError: __init__() takes exactly 1 argument (2 given)

I'm assuming this azure_rm.py just has a dependency on the azure sdk and 
not my ansible install? As my ansible is not from stable-2.1.

On Friday, 8 July 2016 20:06:08 UTC+1, Matt Davis wrote:
>
> I've cherry-picked everything back to 2.1 that's been fixed in devel, so 
> it *should* all work on current stable-2.1 (slash 2.1.1 RC2). If there's 
> stuff that still isn't working, please file issues so we can get it fixed.
>
> Thanks!
>
> -Matt
>
> On Thursday, July 7, 2016 at 6:25:25 PM UTC-7, Steven Carter wrote:
>>
>> That worked!  I really appreciate it!  Should the other functions work at 
>> this point or will that still take some time?
>>
>> Steven.
>>
>> On Thu, Jul 7, 2016 at 2:02 PM, Matt Davis > > wrote:
>>
>>> Yeah, looks like the azure_rm_deployment module got missed for rc5 
>>> updates. I've tested and pushed a fix to devel and stable-2.1 (just in the 
>>> nick of time for 2.1.1rc2), so try updating from stable-2.1 with 
>>> submodules- should work now.
>>>
>>> -Matt
>>>
>>>
>>> On Thursday, July 7, 2016 at 5:51:12 AM UTC-7, Steven Carter wrote:

 I am installing with 'pip install --no-cache-dir git+git://
 github.com/ansible/ansible.git@stable-2.1', so the source directory 
 gets plowed over every time.

 Thanks,

 Steven.

 On Thu, Jul 7, 2016 at 4:38 AM, 'J Hawkesworth' via Ansible Project <
 ansible...@googlegroups.com > wrote:

> Just a guess but if you are running ansible from source and switching 
> between branches, you may need to run a 
>
> make clean
>
> to get rid of any .pyc files
>
> Hope this helps,
>
> Jon
>
> On Thursday, July 7, 2016 at 4:26:17 AM UTC+1, Steven Carter wrote:
>>
>> Strange, I thought that I had this working with azure 2.0.0rc5 + 
>> ansible stable-2.1, but when I tried to re-install and run my ansible, I 
>> get:
>>
>> An exception occurred during task execution. The full traceback is:
>> Traceback (most recent call last):
>>   File "/tmp/ansible_nsnYjC/ansible_module_azure_rm_deployment.py", 
>> line 661, in 
>> main()
>>   File "/tmp/ansible_nsnYjC/ansible_module_azure_rm_deployment.py", 
>> line 657, in main
>> AzureRMDeploymentManager()
>>   File "/tmp/ansible_nsnYjC/ansible_module_azure_rm_deployment.py", 
>> line 438, in __init__
>> supports_check_mode=False)
>>   File 
>> "/tmp/ansible_nsnYjC/ansible_modlib.zip/ansible/module_utils/azure_rm_common.py",
>>  
>> line 192, in __init__
>>   File "/tmp/ansible_nsnYjC/ansible_module_azure_rm_deployment.py", 
>> line 449, in exec_module
>> deployment = self.deploy_template()
>>   File "/tmp/ansible_nsnYjC/ansible_module_azure_rm_deployment.py", 
>> line 476, in deploy_template
>> deploy_parameter = DeploymentProperties()
>> TypeError: __init__() takes at least 2 arguments (1 given)
>>
>> fatal: [localhost]: FAILED! => {"changed": false, "failed": true, 
>> "invocation": {"module_name": "azure_rm_deployment"}, "module_stderr": 
>> "Traceback (most recent call last):\n  File 
>> \"/tmp/ansible_nsnYjC/ansible_module_azure_rm_deployment.py\", line 661, 
>> in 
>> \nmain()\n  File 
>> \"/tmp/ansible_nsnYjC/ansible_module_azure_rm_deployment.py\", line 657, 
>> in 
>> main\nAzureRMDeploymentManager()\n  File 
>> \"/tmp/ansible_nsnYjC/ansible_module_azure_rm_deployment.py\", line 438, 
>> in 
>> __init__\nsupports_check_mode=False)\n  File 
>> \"/tmp/ansible_nsnYjC/ansible_modlib.zip/ansible/module_utils/azure_rm_common.py\",
>>  
>> line 192, in __init__\n  File 
>> \"/tmp/ansible_nsnYjC/ansible_module_azure_rm_deployment.py\", line 449, 
>> in 
>> exec_module\ndeployment = self.deploy_template()\n  File 
>> \"/tmp/ansible_nsnYjC/ansible_module_azure_rm_deployment.py\", line 476, 
>> in 
>> deploy_template\n 

Re: [ansible-project] Re: Merging dictionaries for "environment" parameter

2016-08-29 Thread vadyochik
For version 2.0+ check this please:

http://docs.ansible.com/ansible/playbooks_filters.html#combining-hashes-dictionaries

"combine" filter might be what someone is searching for.

пятница, 21 августа 2015 г., 22:46:12 UTC+3 пользователь 
ke...@collectivehealth.com написал:
>
> Looks like update doesn't do a recursive hash merge. This might be the 
> solution, 
> https://www.xormedia.com/recursively-merge-dictionaries-in-python/
> Is the best practice be to add this as a jinja filter?
>
> On Monday, March 16, 2015 at 10:09:16 AM UTC-7, T.N. T. wrote:
>>
>>
>>
>> On Monday, March 16, 2015 at 5:01:33 PM UTC+1, Brian Coca wrote:
>>>
>>> there is a hash_merge PR pending but it won't make it into 1.9. 
>>>
>>
>> Looks nice. And nice to know. Thank you!
>>
>
> *This message may contain confidential, proprietary, or protected 
> information.  If you are not the intended recipient, you may not review, 
> copy, or distribute this message. If you received this message in error, 
> please notify the sender by reply email and delete this message.*

-- 
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/98ed7e6d-457b-4961-b542-3ba2560c49da%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Retrying a command until a JSON response contains a specific key

2016-08-29 Thread Jean-Denis Vauguet
Hi,

I have somewhat of an edge-case I just have no idea how to properly handle 
using Ansible.

In a playbook, I'm provisioning an AWS Elasticsearch domain, an 
asynchronous task. On AWS, booting the cluster takes a few minutes, so 
meanwhile I'm free to provision other stuff (EC2, RDS, etc.) At some point 
though, I must know what the URL (endpoint) of the Elasticsearch cluster 
is, so that I can register it and move forward with the playbook. Getting 
this info is easy, just an aws-cli command away: aws es 
describe-elasticsearch-domain--domain-name my-es-domain.

Now, by the time the command is issued, the cluster might not be ready. The 
JSON response will tell me, if the DomainStatus.Endpoint key is missing 
then the cluster is not up and running and I should wait until it becomes 
available.

So essentially, I'm trying to find the best way to emulate a "wait_for" 
behavior but for a JSON payload. Checking the JSON response and retrying 
the command on a regular basis until the expected key is available. Any 
insights?

Thank you!

-- 
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/8ff4f63c-da9e-4e4f-8098-16bb0b60b9ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] replace public ip from /etc/hosts file with private ip using Ansible

2016-08-29 Thread BB
I need to replace public ip from /etc/hosts file with private ip in bulk 
cluster of systems.
Ansible gathered fact , may work but not sure which is for what.

Another way, I can have public and private ip register as variable and swap 
them.

What would be the best practice to do in ansible way?

Currently in /etc/hosts 

public_ip   hostname short_hostname

I need to change it to 

private_ip  hostname short_hostname

-- 
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/43fb52e8-4388-4287-ada7-7c8f7692cb21%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Role Dependencies Skipping Included Files

2016-08-29 Thread steve
I have a scenario where I have two top level roles in a playbook:

```yml
{role: roleA, tag: roleA}
{role: roleB, tag: roleB}
```

Role A and Role both depend on Role C in their meta/main.yml

meta/main.yml for Role A
```yml
dependencies:
 - role: common
```

meta/main.yml for Role B
```yml
dependencies:
 - role: roleA
 - role: common
```
However, if I provision with the --tag roleB then it runs Role A if I 
include it in the meta/main.yml of Role B, but inside of common there is an 
include file task and Role A is always skipped.  As a note it actually runs 
the common role, but the task that includes a file is skipped.  If I 
re-order roleA to be below roleB in the playbook then it does include it 
just fine.  I think it has something to do with tags and order, but still 
debugging.  I have seen some stuff about the order in previous version of 
Ansible and they solved, but not sure if they solved the issue of includes 
in that scenario, so this might be a bug, but before I filed that I was 
wondering if anyone else has some thoughts.  Thanks!

-- 
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/3db2644e-00a1-4985-b927-b5a1a70b1eb7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Vaultier Installation Issue

2016-08-29 Thread puneet . sharma
Hi Guys,

I have installing Vaultier on Ubuntu server 14.04 i am getting below error 

(venv)oneadmin@us-server3:/opt/vaultier$ vaultier init

Traceback (most recent call last):

  File "/usr/local/bin/vaultier", line 9, in 

load_entry_point('Vaultier==0.7.5', 'console_scripts', 'vaultier')()

  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", 
line 519, in load_entry_point

return get_distribution(dist).load_entry_point(group, name)

  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", 
line 2630, in load_entry_point

return ep.load()

  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", 
line 2310, in load

return self.resolve()

  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", 
line 2316, in resolve

module = __import__(self.module_name, fromlist=['__name__'], level=0)

ImportError: No module named vaultier.runner



Can someone help me its urgent 

-- 
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/7e644dc6-7789-406a-bb83-255a0a41aadf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible tower setup failure

2016-08-29 Thread Utsav Kumar


I downloaded the war file for ansible, and after changing the passwords in 
inventory file, i tried running the setup.sh script. But, its getting 
failed.

Following errors came during the setup playbook run:

TASK [preflight : Preflight check - Read in tower version] 
*
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": 
"file not found: /var/lib/awx/.tower_version"}
...ignoring


TASK [migrations : Check to see if DATABASES is defined in the main 
settings file.] ***
fatal: [localhost]: FAILED! => {"changed": false, "cmd": "grep \"DATABASES 
= {\" /etc/tower/settings.py", "delta": "0:00:00.004295", "end": 
"2016-08-26 07:01:06.270207", "failed": true, "rc": 2, "start": "2016-08-26 
07:01:06.265912", "stderr": "grep: /etc/tower/settings.py: No such file or 
directory", "stdout": "", "stdout_lines": [], "warnings": []}
...ignoring

TASK [migrations : include] 

skipping: [localhost] => {"changed": false, "skip_reason": "Conditional 
check failed", "skipped": true}

TASK [migrations : Check to see if celery is already configured for 
RabbitMQ.] *
fatal: [localhost]: FAILED! => {"changed": false, "cmd": "grep \"amqp://\" 
/etc/tower/conf.d/celeryd.py", "delta": "0:00:00.003558", "end": 
"2016-08-26 07:01:06.483477", "failed": true, "rc": 2, "start": "2016-08-26 
07:01:06.479919", "stderr": "grep: /etc/tower/conf.d/celeryd.py: No such 
file or directory", "stdout": "", "stdout_lines": [], "warnings": []}
...ignoring


Following error is coming in the end:

PLAY RECAP 
*
localhost  : ok=31   changed=0unreachable=0failed=1

[error] Oops!  An error occured while running setup.
[warn] /var/log/tower does not exist.
Setup log saved to setup.log.

How to resolve this?

-- 
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/17454b4a-e9e5-467f-b135-9ae80560ec8b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] ansible 2.2.0 - ios_facts module

2016-08-29 Thread Rukka Pal
I am a newbie and would like to use Ansible to automate network operation 
tasks, right now I am only interested in fact collection. I have been using 
the "raw" module which is not very flexible, hence I decided to install 
(from GitHub) ansible 2.2.0 to try the "ios_facts" module. First I was 
using paramiko, but it failed to open SFTP connection. Then I tried default 
ansible config, but it was complaining about SSH ("SSH Error: data could 
not be sent to the remote host. Make sure this host can be reached over 
ssh") so I changed "scp_if_ssh" to true. Now it says ""failed to transfer 
file to Line has invalid autocommand \"/bin/sh -c ( umask 77 && mkdir -p 
\"\"/ios_facts.py:\n\nPrivilege denied.\n" and the command won't run.

What am I missing here? Could someone provide an example ad-hoc command or 
an example playbook?

Environment: 3.13.0-93-generic Ubuntu 14, Perl 5.18.2-2ubuntu1.1

Thanks in advance!

-- 
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1cee5cad-6ce4-4dfe-b99b-73ebb1a87e6f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Always append a '/' to variable whose value is supplied as extra vars

2016-08-29 Thread ishan jain
I have a variable config_src which i use in a lot many places (host vars, 
inventory file, playbook) and its value is supplied at the run time as 
extra vars (-e)
This variable is actually a path variable, so i need to ensure that it is 
always ending in a '/'. As this variable is in use in a lot of places, i 
want to make sure that a '/' is appended to it in a single place as 
applying some filter to all the places is not feasible. My inventory file 
is something that is common for all playbooks, so i think i should append 
the '/' somewhere in the inventory file only.
How can i do that ?

-- 
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/81107b51-0b82-4b25-ac4b-17e0c9310855%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] nova text shell to instances to use ansible

2016-08-29 Thread Maurizio Santovito
Hi all,
I need to use ansible playbooks to configure instances once deployed. 
Management and Guest networks are VLAN separated.
nova provides some VNC access by the option get-vnc-console, that is a 
graphic access, but this is not usable in ansible playbooks.
Is there any chance to get ssh access to the instances from the management 
network? Some nova services which tunnels communication between VM 
instances and management node?

Best Regards
Maurizio

-- 
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/33b14ea6-1b11-4713-9639-d57866188d16%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Vars defined in host file not getting the value when the value is supplied as extra vars during playbook run

2016-08-29 Thread ishan jain
My host file looks something like this:


[Group]
host.com

[Group:vars]
vars="{{src}}/varsFile.yaml


And in my playbook:

---
- hosts: "{{remote_hosts}}"
  vars_files:
 - "{{vars}}"
  gather_facts: yes
  tasks:
  ..


Now when i run this with the command:

ansible-playbook -i host playbook.yaml -e src=/opt/config

The playbook run fails as some variable (defined in varsFile.yaml) is not 
found.


But when i use the command:

ansible-playbook -i host playbook.yaml -e src=/opt/config -e 
vars=/opt/config/varsFile.yaml

Everything runs perfectly fine.

How can i make sure that when i provide this "src" as extra var, it can be 
used in multiple locations in my playbooks and host variables ?

-- 
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/dfc4c5f0-14c5-460c-aa1a-ed046e1b498d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.