Re: [ansible-project] Could ansile access remote hosts by serial console over LAN

2018-10-24 Thread rong zhao
Hi Don,
   Hm.. finally, I wrote a python script which reads jinja2 commands
template to generate shell commands and run generated commands by
pyexpect.

   Then, run this python script on ansible controller host, we have
several ways to do that, similar with the method mentioned by Andrew
above, or using local_action to call the python script.

Thanks.
Andrew Latham  于2018年10月25日周四 上午3:11写道:
>
> Look at the example for out-of-band on 
> https://docs.ansible.com/ansible/latest/modules/shell_module.html#shell-module
>
>
> On Wed, Oct 24, 2018 at 1:53 PM Dongxian Yao  wrote:
>>
>> Hi Rong,
>>
>> do you have any updates on this one? did you write a new module you can 
>> share?
>>
>> Thanks!
>> Don
>>
>> On Thursday, February 16, 2017 at 1:36:24 AM UTC-5, rong zhao wrote:
>>>
>>> Yes, you said totally right, it is exactly my problem. I have tried your 
>>> suggestion, someone already logged on that same console.
>>>
>>> but ansible still reports Authentication or permission failure.
>>>
>>> now, I want to study ansible's source code, try to rewrite the code after 
>>> initial connection. it should send a 'enter' key, and try to login if the 
>>> console is not logged on.
>>>
>>> thank you for your help, I will update my trial later.
>>>
>>> 在 2017年2月15日星期三 UTC+8下午8:55:40,Dag Wieers写道:

 On Tue, 14 Feb 2017, rong zhao wrote:

 >   My remote hosts' management port is serial console over LAN.
 >   When connect by ssh manually, I use ops account connect to remote 
 > hosts,
 > and then it become the Linux console, I just run ssh command.
 >
 >   Now, I use ansible -m ping to test reachable, it reports:
 >   "Authentication or permission failure. In some cases, you may have been
 > able to authenticate and did not have permissions on the remote 
 > directory.
 > Consider changing the remote temp path in ansible.cfg to a path rooted in
 > "
 >
 >   yes, it should report this error, because this is not real ssh session,
 > it is console.
 >
 >   is there any method to modify the reachable test command? or do you 
 > have
 > any suggestion for serial console over LAN?

 Ansible expects to run python scripts remotely, so it requires a transport
 (SSH) and the ability to run python.

 In your case I assume you connect over SSH to an out-of-band management
 board (using its own credentials) then get a serial console and then you
 have to log on again on the console prompt.

 This is not supported by Ansible at the moment, but is not impossible to
 implement. Although there are pitfalls you have to consider (eg. someone
 already logged in on that same console, or not having properly logged out
 due to unexpected disconnect).

 --
 Dag
>>
>> --
>> 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/787f74d8-9e9e-4abe-ad7b-a574a3832366%40googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> - Andrew "lathama" Latham -
>
> --
> You received this message because you are subscribed to a topic in the Google 
> Groups "Ansible Project" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/ansible-project/KO-mkKnW6Tk/unsubscribe.
> To unsubscribe from this group and all its topics, 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/CA%2Bqj4S_2SvYPZ%3DA-GnMOjmfo-YvcnSTh2BjCTzUe_ktvxz8xCw%40mail.gmail.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/CAOHr083%3DOV3NSm9uQ4O-9-cPeXz3-h5DJQVXcW0fi79TuXLP1g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: apt result is changed incorrectly?

2018-10-24 Thread Vladimir Botka
You asked apt to update the cache

 update_cache: yes

The cache was updated and the task was flagged "changed".

"cache_update_time": 1540395343,
"cache_updated": true,
"changed": true,

-- 
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/090d308a-ad12-4be1-ab1f-b9bde9580ea8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Get IP address, replace first three octets

2018-10-24 Thread LJ Medina
Thank you all very much for your feedback! All the replies helped me solve 
the task.
cheers!

On Monday, October 22, 2018 at 6:11:26 AM UTC-5, Brad Van Orden wrote:
>
> Not an ansible response (use command or shell to execute), but can 
> retrieve the iLO network settings and change with:
>
> # This is coded against iLO4!
> # Run as root
> cd /var/tmp # or where ever you would like to have your temporary files
> #
> # Get the current configuration
> #
> hponcfg --writeconfig ilo
> #
> # Delete the directory information and user information portions of the 
> xml file.
> #
> sed -i '/^   sed -i '/^   #
> # Compute your new ip address.  Note, OCT4 is based on RHEL 7 type OS 
> using eth0 as the NIC.
> # Adjust as needed.
> #
> BASE_IP=11.11.11.
> OCT4=$(ifconfig eth0 | grep inet | awk '{ print $2 }' | cut -d. -f4)
> #
> # You will probably also want to change the netmask and default gateway.
> # The netmask can be found at: SUBNET_MASK
> # and the gateway at: GATEWAY_IP_ADDRESS
> # Change accordingly.
> #
> sed -i "s|^\(|" ilo
> #
> # Write the new ip to the iLO
> #
> hponcfg --file ilo
>
>
>
> On Saturday, October 20, 2018 at 11:38:38 AM UTC-4, LJ Medina wrote:
>>
>> Hello,
>> I'm trying to assign ILO IP addresses to a range of systems, using a 
>> different subnet than their host IP, just matching the fourth octet.  For 
>> example, if their IP would be 10.10.10.10, I want their ILO IP to be 
>> 11.11.11.10.( Plan is to use "hponcfg" module to configure the host's ILO 
>> after I obtain this address)
>> What is the best way to achieve this with ansible?
>
>

-- 
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/fe5eb71b-b6ad-4f7a-8aa3-ab4abe2bbf54%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: ansible yaml question for retries module

2018-10-24 Thread rd
Hi Dmitry,

Thanks for your response.

I think I should clarify, that I am capturing the result and the do .. 
until logic works fine and does exit the `retries' based on the the until 
pattern of the result.  However, what I am trying to achieve 

1) Either to replace "FAILED RETRYING" with the actual STDOUT of "X2".

OR

2) To display STDOUT(of X2) along with "FAILED RETRYING" for each retry.


Here is the code for the retry:

 - name: Status
   command: 
   register: result
   until: result.stdout.find("complete") != -1
   retries: 100
   delay: 30

Here is the output on AWX screen, which I want to update to include my 
stdout.

FAILED - RETRYING: Status check (100 retries left).
FAILED - RETRYING: Status check (99 retries left).
FAILED - RETRYING: Status check (98 retries left).


Note: I did try the debug with retries but it breaks the retry loop.

thanks
Rd






On Wednesday, October 24, 2018 at 8:24:09 PM UTC-4, Dmitry Makovey wrote:
>
> my first reaction would be to suggest looking into "until" loop structure. 
> if your module can query for results reutrning some value, until will keep 
> calling it until N retries run out or module will execute successfully
>
>
> On Wednesday, October 24, 2018 at 1:21:19 PM UTC-7, rd wrote:
>>
>> Hello,
>>
>> I have a use case where I need drop a long running command(x1) on a 
>> remote host and then track its status via another command(x2).
>> I have tried doing that using async with Poll "0" for x1 command , and 
>> then run retries for the other command(x2) until i see a certain output.
>>
>>
>> My questions:
>>
>> 1) Is there another alternate to use using retries in this case?
>>
>> 2) Is there a way to:
>>
>>1.  Change the "FAILED RETRYING" to a custom message?... 
>>please note I am using a shared environment and have no flexibility to 
>>modify the actual ansible configuration.
>>2.  Display STDOUT from each retry show along with "FAILED 
>>RETRYING" ?
>>
>>
>> Please let me know if I can provide any other details.
>> Any assistance is greatly appreciated.  
>>
>>
>> thanks
>> Rd
>>
>

-- 
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/82b8c4be-8d93-42ba-87b7-853c0f9eca91%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] When running a playbook, the task's names are not printed

2018-10-24 Thread Jean-Francois Anctil
Hi,
I'm using ansible on my macbook (running Mojave) and when I run a playbook, 
the task's names are not printed.

ansible version:
ansible 2.4.6.0
  config file = /Users/x/ansible/ansible.cfg
  configured module search path = 
[u'/Users/x/.ansible/plugins/modules', 
u'/usr/share/ansible/plugins/modules']
  ansible python module location = /Library/Python/2.7/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 2.7.10 (default, Aug 17 2018, 17:41:52) [GCC 4.2.1 
Compatible Apple LLVM 10.0.0 (clang-1000.0.42)]

Playbook: test.yml

---
- name: test
  hosts: localhost
  tasks:
- name: debug from me
  debug:
msg: "hello world"

Expected result:
PLAY [test play] **


TASK [Gathering Facts] *

Wednesday 24 October 2018  15:50:49 -0400 (0:00:00.167)   0:00:00.167 
*

ok: [localhost]

 
TASK [my debug] 
*

Wednesday 24 October 2018  15:50:51 -0400 (0:00:02.155)   0:00:02.322 
*

ok: [localhost] => {

"msg": "hello world"

}


What I get:
Wednesday 24 October 2018  15:50:49 -0400 (0:00:00.167)   0:00:00.167 
*

ok: [localhost]


Wednesday 24 October 2018  15:50:51 -0400 (0:00:02.155)   0:00:02.322 
*

ok: [localhost] => {

"msg": "hello world"

}






Anyone has an idea why the task's name are not printed?


Regards,

-- 
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/5f6abd51-c5c6-4bb6-9095-e880899f3824%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: ansible yaml question for retries module

2018-10-24 Thread Dmitry Makovey
my first reaction would be to suggest looking into "until" loop structure. 
if your module can query for results reutrning some value, until will keep 
calling it until N retries run out or module will execute successfully


On Wednesday, October 24, 2018 at 1:21:19 PM UTC-7, rd wrote:
>
> Hello,
>
> I have a use case where I need drop a long running command(x1) on a remote 
> host and then track its status via another command(x2).
> I have tried doing that using async with Poll "0" for x1 command , and 
> then run retries for the other command(x2) until i see a certain output.
>
>
> My questions:
>
> 1) Is there another alternate to use using retries in this case?
>
> 2) Is there a way to:
>
>1.  Change the "FAILED RETRYING" to a custom message?... 
>please note I am using a shared environment and have no flexibility to 
>modify the actual ansible configuration.
>2.  Display STDOUT from each retry show along with "FAILED 
>RETRYING" ?
>
>
> Please let me know if I can provide any other details.
> Any assistance is greatly appreciated.  
>
>
> thanks
> Rd
>

-- 
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/a635c35a-b221-439c-ba98-9dc853c88cee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] ansible yaml question for retries module

2018-10-24 Thread rd
Hello,

I have a use case where I need drop a long running command(x1) on a remote 
host and then track its status via another command(x2).
I have tried doing that using async with Poll "0" for x1 command , and then 
run retries for the other command(x2) until i see a certain output.


My questions:

1) Is there another alternate to use using retries in this case?

2) Is there a way to:

   1.  Change the "FAILED RETRYING" to a custom message?... please 
   note I am using a shared environment and have no flexibility to modify the 
   actual ansible configuration.
   2.  Display STDOUT from each retry show along with "FAILED 
   RETRYING" ?
   

Please let me know if I can provide any other details.
Any assistance is greatly appreciated.  


thanks
Rd

-- 
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/503cb2c8-68d3-4bc3-bb2c-87e0de53c8ee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Could ansile access remote hosts by serial console over LAN

2018-10-24 Thread Andrew Latham
Look at the example for out-of-band on
https://docs.ansible.com/ansible/latest/modules/shell_module.html#shell-module


On Wed, Oct 24, 2018 at 1:53 PM Dongxian Yao  wrote:

> Hi Rong,
>
> do you have any updates on this one? did you write a new module you can
> share?
>
> Thanks!
> Don
>
> On Thursday, February 16, 2017 at 1:36:24 AM UTC-5, rong zhao wrote:
>>
>> Yes, you said totally right, it is exactly my problem. I have tried your
>> suggestion, someone already logged on that same console.
>>
>> but ansible still reports Authentication or permission failure.
>>
>> now, I want to study ansible's source code, try to rewrite the code after
>> initial connection. it should send a 'enter' key, and try to login if the
>> console is not logged on.
>>
>> thank you for your help, I will update my trial later.
>>
>> 在 2017年2月15日星期三 UTC+8下午8:55:40,Dag Wieers写道:
>>>
>>> On Tue, 14 Feb 2017, rong zhao wrote:
>>>
>>> >   My remote hosts' management port is serial console over LAN.
>>> >   When connect by ssh manually, I use ops account connect to remote
>>> hosts,
>>> > and then it become the Linux console, I just run ssh command.
>>> >
>>> >   Now, I use ansible -m ping to test reachable, it reports:
>>> >   "Authentication or permission failure. In some cases, you may have
>>> been
>>> > able to authenticate and did not have permissions on the remote
>>> directory.
>>> > Consider changing the remote temp path in ansible.cfg to a path rooted
>>> in
>>> > "
>>> >
>>> >   yes, it should report this error, because this is not real ssh
>>> session,
>>> > it is console.
>>> >
>>> >   is there any method to modify the reachable test command? or do you
>>> have
>>> > any suggestion for serial console over LAN?
>>>
>>> Ansible expects to run python scripts remotely, so it requires a
>>> transport
>>> (SSH) and the ability to run python.
>>>
>>> In your case I assume you connect over SSH to an out-of-band management
>>> board (using its own credentials) then get a serial console and then you
>>> have to log on again on the console prompt.
>>>
>>> This is not supported by Ansible at the moment, but is not impossible to
>>> implement. Although there are pitfalls you have to consider (eg. someone
>>> already logged in on that same console, or not having properly logged
>>> out
>>> due to unexpected disconnect).
>>>
>>> --
>>> Dag
>>>
>> --
> 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/787f74d8-9e9e-4abe-ad7b-a574a3832366%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
- Andrew "lathama" Latham -

-- 
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/CA%2Bqj4S_2SvYPZ%3DA-GnMOjmfo-YvcnSTh2BjCTzUe_ktvxz8xCw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Could ansile access remote hosts by serial console over LAN

2018-10-24 Thread Dongxian Yao
Hi Rong,

do you have any updates on this one? did you write a new module you can 
share?

Thanks!
Don

On Thursday, February 16, 2017 at 1:36:24 AM UTC-5, rong zhao wrote:
>
> Yes, you said totally right, it is exactly my problem. I have tried your 
> suggestion, someone already logged on that same console.
>
> but ansible still reports Authentication or permission failure. 
>
> now, I want to study ansible's source code, try to rewrite the code after 
> initial connection. it should send a 'enter' key, and try to login if the 
> console is not logged on.
>
> thank you for your help, I will update my trial later.
>
> 在 2017年2月15日星期三 UTC+8下午8:55:40,Dag Wieers写道:
>>
>> On Tue, 14 Feb 2017, rong zhao wrote: 
>>
>> >   My remote hosts' management port is serial console over LAN. 
>> >   When connect by ssh manually, I use ops account connect to remote 
>> hosts, 
>> > and then it become the Linux console, I just run ssh command. 
>> > 
>> >   Now, I use ansible -m ping to test reachable, it reports: 
>> >   "Authentication or permission failure. In some cases, you may have 
>> been 
>> > able to authenticate and did not have permissions on the remote 
>> directory. 
>> > Consider changing the remote temp path in ansible.cfg to a path rooted 
>> in 
>> > " 
>> > 
>> >   yes, it should report this error, because this is not real ssh 
>> session, 
>> > it is console. 
>> > 
>> >   is there any method to modify the reachable test command? or do you 
>> have 
>> > any suggestion for serial console over LAN? 
>>
>> Ansible expects to run python scripts remotely, so it requires a 
>> transport 
>> (SSH) and the ability to run python. 
>>
>> In your case I assume you connect over SSH to an out-of-band management 
>> board (using its own credentials) then get a serial console and then you 
>> have to log on again on the console prompt. 
>>
>> This is not supported by Ansible at the moment, but is not impossible to 
>> implement. Although there are pitfalls you have to consider (eg. someone 
>> already logged in on that same console, or not having properly logged out 
>> due to unexpected disconnect). 
>>
>> -- 
>> Dag 
>>
>

-- 
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/787f74d8-9e9e-4abe-ad7b-a574a3832366%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Parsing and creating new variables from inventory hostgroup

2018-10-24 Thread Kai Stian Olstad
On Wednesday, 24 October 2018 19:20:25 CEST Brent Weaver wrote:
> This does not seem to work:
> 
> ---
> - hosts:
> - "*westus_azure_ops*"
>   vars:
> X: "{{ groups['splunk_cluster_label_westus_azure_ops'] | random_choice 
> }}"
>   tasks:
> - debug: var=X
> 
> no filter named 'random_choice' is likely the error tripping us up

The filter is called random, random_choice is a lookup plugin.

-- 
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/11032901.hsV2AAqsVp%40x1.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Changing http port for a host that ansible uses to connect to a host

2018-10-24 Thread Dick Visser
On Wed, 24 Oct 2018 at 18:22, Robinhood Junior
 wrote:
>
> How can we change the default http port ansible uses for a host? Instead of 
> default port 80 I'd like to change it to a custom one, say port 70.
> `#hosts
> host1 ansible_host=44# changes the ssh port to 44
> # anything similar to this that changes the http port?`

You're mixing a few things up here.

1. Ansible doesn't have anything to do with 'http'. The only thing it
uses is SSH, which runs op port 22 by default.
2. If you want to run this on a different port, use the 'ansible_port' option.
3. 'ansible_host' configures the *host* that ansible connects to.

Please read 
https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html#working-with-inventory


Dick

-- 
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/CAL8fbwM55S_zeMJ2y2ESuxz5K5g6XYe38EM%3D%3DeonORmMj6seDw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Unable to parse ansible/contrib/inventory/ec2.py as an inventory source

2018-10-24 Thread Dick Visser
On Wed, 24 Oct 2018 at 14:02,  wrote:
>
> Hi Oriol, Can you give me some suggestions about this problems? Thanks in 
> advance.

So far 3 different people have given you such suggestions.
Please carefully read them.

Not much use in asking a 4th time...

Dick




> 在 2018年10月24日星期三 UTC+8下午5:15:09,Oriol Tauleria写道:
>>
>> Hi!
>> Kai sorry for my confusion with the names.
>> I answering the OP (he requested more information again).
>> Sorry again!
>>
>>
>>
>> El mié., 24 oct. 2018 a las 9:43, Kai Stian Olstad 
>> () escribió:
>>>
>>> On 24.10.2018 09:22, Oriol Tauleria wrote:
>>> > Hi Kai,
>>> >
>>> > Error origin:
>>> > The file you have downloaded is not marked as executable, so when you
>>> > pass
>>> > as inventory file, Ansible tries to read (not to execute it).
>>>
>>> You need to read the whole thread, I'm not the one with the problem.
>>> I actually wrote the same solution that you write here to the OP.
>>>
>>> --
>>> 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-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/f2bc9ba73bf6340ee4c654345fdd395b%40olstad.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/1d13be84-fd65-42f3-a749-2c9f65c04371%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/CAL8fbwNaytqDnCSa9-x1JpEWTbF8NUX1CJe-nDKfroGxWz40Bw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Parsing and creating new variables from inventory hostgroup

2018-10-24 Thread Brent Weaver
This does not seem to work:

---
- hosts:
- "*westus_azure_ops*"
  vars:
X: "{{ groups['splunk_cluster_label_westus_azure_ops'] | random_choice 
}}"
  tasks:
- debug: var=X

no filter named 'random_choice' is likely the error tripping us up

On Tuesday, October 23, 2018 at 11:18:14 AM UTC-4, Brian Coca wrote:
>
> for the first, the random_choice filter seems to be what you want: 
> ``` 
> anynode: "{{ groups['shc_hosts']|random_choice }}" 
> ``` 
> for the 2nd something like: 
> ``` 
> urllist: "{{ groups['shc_hosts']|map('regex_replace', '^(.*)$', 
> 'https://'')|list|join(':8089,')}}:8089" 
> ``` 
>
> -- 
> -- 
> Brian Coca 
>

-- 
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/23a9b468-b229-455d-917c-bebeb29bb7b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: How to develop an Ansible agent for another OS

2018-10-24 Thread jobarker
Hi,
Thanks for the detail.

So, just to clarify some things:

   - ansible-playbook will still be run on a standard Linux machine, that's 
   the controller
   - Ansible doesn't have an agent. It communicates over ssh, nothing to 
   install on the remote-node
   - We are talking about supporting OpenVMS/Itanium as a *remote-node*
   

Assuming you have an inventory file that defines openvms-01

1) If we start with the simplest task:
ansible openvms-01 -m ping
This ensure we have connectivity

2) Then look at 
ansible openvms-01 -m setup -a 'gather_subset=!min'
Which should return something like

SUCCESS => {
"ansible_facts": {
"gather_subset": [
"!min"
], 
"module_setup": true
}, 
"changed": false

You can play around with the various gather_subset as defined on 
https://docs.ansible.com/ansible/latest/modules/setup_module.html 

3) Then
ansible openvms-01 -m setup -a 'gather_subset=min'


How do those commands seem?


If any fail add -vv and rerun


This should give us an indication of what works "out of the box".


You can see the code for the existing for facts in 
https://github.com/ansible/ansible/tree/devel/lib/ansible/module_utils/facts

Kind regards,
gundalow

-- 
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/a6166a80-e8cf-44ce-83c4-2001f7751f0b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Changing http port for a host that ansible uses to connect to a host

2018-10-24 Thread Robinhood Junior
How can we change the default http port ansible uses for a host? Instead of 
default port 80 I'd like to change it to a custom one, say port 70.
`#hosts
host1 ansible_host=44# changes the ssh port to 44
# anything similar to this that changes the http port?`

-- 
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/71a91e9c-f91a-4b47-954b-5605b78074c2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: How to develop an Ansible agent for another OS

2018-10-24 Thread k3c palmi
Hello

I was trying to port Ansible to OpenVMS Itanium.

Ansible is written in Python, and Python is available for OpenVMS

I thought I had read some time ago some Ansible  doc explaining how to deal
with another OS, but I can't find it in the docs.

Regards

Le mer. 24 oct. 2018 à 17:37,  a écrit :

> Hi,
>
> Could you please explain what you are trying to achieve, so we can guide
> you?
>
> The existing code supports most common Operating Systems even if their
> isn't a specific Python file for that Operating System.
>
> Kind regards,
> gundalow
>
>
> On Wednesday, October 24, 2018 at 1:39:10 PM UTC+1, k3c...@gmail.com
> wrote:
>>
>> Hello
>>
>> I am looking for some docs explaining how to develop  an agent for
>> another Operating System
>>
>> I noticed in
>>
>> /usr/local/python2.7/dist-packages:ansible/modules-utils/facts/hardware
>>
>> some files like
>> aix.py
>> sunos.py
>> netbsd.py
>> linux.py
>> hpux.py
>>
>> and so
>>
>> It seems ansible_distribution may be the name of the OS, according to
>>
>>
>> https://docs.ansible.com/ansible/2.6/user_guide/playbooks_best_practices.html?highlight=operating%20system
>>
>> Thanks for any hint
>>
> --
> 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/9ad684c1-016f-456e-ae9c-1ba8811a80c5%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/CAC91cNYXk_U-D-RNtTLhU9S%3DLHNW-rKj%3DjV-A6wK2999kJSXMg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: apt result is changed incorrectly?

2018-10-24 Thread Barry Kaplan
I posted the non-wildcard version above. But that too marks the task as 
changed. Which then is very different from what I would expect.

-- 
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/73baac6d-46e4-4f56-b56d-2e1739c90c34%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: apt result is changed incorrectly?

2018-10-24 Thread Barry Kaplan
Sorry, posted the wrong version expression

- name: Install python
  apt:
name: python2.7='2.7.14*'
state: present
update_cache: yes
  register: _apt_python
- debug: var=_apt_python
- fail:



-- 
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/85ba56b3-7f2d-4aa2-a347-8ece43a79853%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] apt result is changed incorrectly?

2018-10-24 Thread Barry Kaplan
I am running apt with a wildcard. The package is not being 
installed/updated, but task is marked as changed. Is this is a bug or how I 
should expect apt to work with a wildcard.


ansible❯ ansible --version
ansible 2.6.5


- name: Install python
  apt:
name: python2.7='2.7.14-2ubuntu1~14.04.york1'
state: present
update_cache: yes
  register: _apt_python
- debug: var=_apt_python
- fail:


TASK [debug] 
**
ok: [10.11.140.238] => {
"_apt_python": {
"cache_update_time": 1540395343,
"cache_updated": true,
"changed": true,
"diff": {},
"failed": false,
"stderr": "",
"stderr_lines": [],
"stdout": "Reading package lists...\nBuilding dependency 
tree...\nReading state information...\npython2.7 is already the newest 
version.\n0 upgraded, 0 newly installed, 0 to remove and 120 not 
upgraded.\n",
"stdout_lines": [
"Reading package lists...",
"Building dependency tree...",
"Reading state information...",
"python2.7 is already the newest version.",
"0 upgraded, 0 newly installed, 0 to remove and 120 not 
upgraded."
]
}
}

-- 
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/916d67fa-cb37-4705-908c-7112013829bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: How to develop an Ansible agent for another OS

2018-10-24 Thread jobarker
Hi,

Could you please explain what you are trying to achieve, so we can guide 
you?

The existing code supports most common Operating Systems even if their 
isn't a specific Python file for that Operating System.

Kind regards,
gundalow


On Wednesday, October 24, 2018 at 1:39:10 PM UTC+1, k3c...@gmail.com wrote:
>
> Hello
>
> I am looking for some docs explaining how to develop  an agent for another 
> Operating System
>
> I noticed in
>
> /usr/local/python2.7/dist-packages:ansible/modules-utils/facts/hardware
>
> some files like 
> aix.py
> sunos.py
> netbsd.py
> linux.py
> hpux.py
>
> and so
>
> It seems ansible_distribution may be the name of the OS, according to
>
>
> https://docs.ansible.com/ansible/2.6/user_guide/playbooks_best_practices.html?highlight=operating%20system
>
> Thanks for any hint
>

-- 
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/9ad684c1-016f-456e-ae9c-1ba8811a80c5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Diffculty with registering the script output

2018-10-24 Thread itssitaram9
Thanks alot!
when: not scrtipt_output.failed  

*This is worked for me!!!*


On Wednesday, October 24, 2018 at 1:21:46 AM UTC-4, Vladimir Botka wrote:
>
>
> Remove the quotation marks. The conditionals are expanded automatically. 
>  
>
>> when: "scrtipt_output.rc !=0"
>>
>  ...
>
>> The error was: template error while templating string: unexpected char 
>> u\"'\" at 29
>>
>
> Alternatively you might want to use:
>
> when: not scrtipt_output.failed
>
>

-- 
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/ba0e2163-cead-4c06-ade3-ef4784915630%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] How to develop an Ansible agent for another OS

2018-10-24 Thread k3ck3c
Hello

I am looking for some docs explaining how to develop  an agent for another 
Operating System

I noticed in

/usr/local/python2.7/dist-packages:ansible/modules-utils/facts/hardware

some files like 
aix.py
sunos.py
netbsd.py
linux.py
hpux.py

and so

It seems ansible_distribution may be the name of the OS, according to

https://docs.ansible.com/ansible/2.6/user_guide/playbooks_best_practices.html?highlight=operating%20system

Thanks for any hint

-- 
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/b2cd5619-e3db-421c-b326-a8fedaaab1eb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Unable to parse ansible/contrib/inventory/ec2.py as an inventory source

2018-10-24 Thread heguimin36
Hi Oriol, Can you give me some suggestions about this problems? Thanks in 
advance.

在 2018年10月24日星期三 UTC+8下午5:15:09,Oriol Tauleria写道:
>
> Hi! 
> Kai sorry for my confusion with the names.
> I answering the OP (he requested more information again).
> Sorry again!
>
>
>
> El mié., 24 oct. 2018 a las 9:43, Kai Stian Olstad (<
> ansible-pr...@olstad.com >) escribió:
>
>> On 24.10.2018 09:22, Oriol Tauleria wrote:
>> > Hi Kai,
>> > 
>> > Error origin:
>> > The file you have downloaded is not marked as executable, so when you 
>> > pass
>> > as inventory file, Ansible tries to read (not to execute it).
>>
>> You need to read the whole thread, I'm not the one with the problem.
>> I actually wrote the same solution that you write here to the OP.
>>
>> -- 
>> 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-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/f2bc9ba73bf6340ee4c654345fdd395b%40olstad.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/1d13be84-fd65-42f3-a749-2c9f65c04371%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] git update

2018-10-24 Thread Jonathan Lozada De La Matta
That just seems like bad practice. I wouldn't recommend this.

On Wed, Oct 24, 2018 at 2:44 AM SUMIT SAHAY 
wrote:

> Hi All,
>
> I have one use case where if the new user is created in the server then
> ansible playbook update the file /etc/passwd and /etc/shadow file in
> version control.
>
> The ansible script check the difference and update the version control
> with the latest copy of both the file.
>
> Looking forward for reply.
>
>
> Regards
> Sumit Sahay
> 7044112109
>
> --
> 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/42d19931-641b-430a-b79f-5a763b947a3e%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
-- 

Jonathan lozada de la matta

AUTOMATION PRACTICE

-- 
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/CAFYJA%2BKua%3DrYJV2cjAQhJi9kXL8ei0ZTKiJhUyhq_hEUNe4%3DNA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: how to pass ansible variables from Jenkins by using parameters

2018-10-24 Thread kumar kittu
Thanks Adrian 

command line parameters we could give ,but that also we need to open 
jenkins job and then add the variables.
My intention is we just give parameter like string parameter in jenkins and 
it would map to ansible variables .
Request to help me.

On Wednesday, October 24, 2018 at 2:12:42 PM UTC+5:30, Adrian Sebastian 
Dutu wrote:
>
> -e allows you to pass variables to the command line. So you can put that 
> in your job. Also, there's an ansible jenkins plugin. You can take a look 
> at that.
> https://wiki.jenkins.io/display/JENKINS/Ansible+Plugin
>
> On Wednesday, October 24, 2018 at 8:40:34 AM UTC+2, kumar kittu wrote:
>>
>> Hello All,
>>
>> I have ansible-playbook which has variables defined and that playbook is 
>> executed successfully from jenkins by creating job.
>>
>> my query is :
>>
>> I need to pass ansible variables defined in playbook from jenkins ,as 
>> parameter(or what ever),so it would eliminate hard coding in 
>> ansible-playbook.
>>
>> Searched a lot but couldn't get exact solution.
>>
>> Request anyone to help me at the earliest
>>
>> 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/320efdf6-e337-46e1-8f13-b17cb40426e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Python error with ansible

2018-10-24 Thread Tcpip
Hi all,

Im getting the error *"The Python 2 bindings for rpm are needed for this 
module. If you require Python 3 support use the `dnf` Ansible module 
instead*."

ansible 2.5.4
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/juraj/.ansible/plugins/modules', 
u'/usr/share/ansible/plugins/modules']
  ansible python module location = 
/usr/local/lib/python2.7/dist-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 
20160609]


python
python python2-glance-rootwrap
python2-migratepython2-oslopolicy-checker
 python3
python2python2-jsonschema
 python2-migrate-repository python2-osprofiler
 python3.5  
python2.7  python2-keystone  
 python2-oslo-config-generator  python2-pbr
python3.5m 
python2-alembicpython2-lockutils-wrapper  
python2-oslo-messaging-zmq-broker  python2-unit2  
python3m 


All this is from the server I'm running Ansible.



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/0b799d2f-4880-4fe2-bf5b-ee0ae4f86101%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Unable to parse ansible/contrib/inventory/ec2.py as an inventory source

2018-10-24 Thread Oriol Tauleria
Hi!
Kai sorry for my confusion with the names.
I answering the OP (he requested more information again).
Sorry again!



El mié., 24 oct. 2018 a las 9:43, Kai Stian Olstad (<
ansible-project+l...@olstad.com>) escribió:

> On 24.10.2018 09:22, Oriol Tauleria wrote:
> > Hi Kai,
> >
> > Error origin:
> > The file you have downloaded is not marked as executable, so when you
> > pass
> > as inventory file, Ansible tries to read (not to execute it).
>
> You need to read the whole thread, I'm not the one with the problem.
> I actually wrote the same solution that you write here to the OP.
>
> --
> 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/f2bc9ba73bf6340ee4c654345fdd395b%40olstad.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/CABN89neWCpNUdXJj%3D%2B3YhkaTJRaCTmygwcjTO%3DzO74Ztpu7PSA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible Play error - Template error while templating string: no filter named 'map'. String:

2018-10-24 Thread Kishore Ponniah
Hello all,

This is the continuation of my other Post creating direct connect gateway. 
This is the same but using assume roles and cross-account deployment. I 
have added loops but there are 2 sections which are not working (debug role 
arns & assume cross account roles). Can some one help?

Error:
TASK [debug role arns] 

task path: 
/home/ec2-user/environment/aws-rxgt-mgmt-platform/ansible/rxgt-ps-rxgtmgmt-playbook.yaml:29
fatal: [infrastructure]: FAILED! => {
"msg": "template error while templating string: no filter named 'map'. 
String: {{ rxgt_identity_account['deploy_accounts']|map('extract', 
rxgt_identity_account['account_config'])|list }}"
}

===
Main playbook:

---
# This playbook builds Network infrastructure in all configured accounts
- name: Install/Update RXGT Mgmt account CF templates
  hosts: infrastructure
  tasks:

- name: Install/Update RXGT PS cross account CF templates
  hosts: infrastructure
  tasks:
- name: get sts session token
  sts_session_token:
duration_seconds: "{{ sts_session_duration | default(3600) }}"
mfa_serial_nunber: "{{ sts_mfa_serial_number | default(omit) }}"
mfa_token: "{{ sts_mfa_token | default(omit) }}"
  register: sts_session_token
  when: with_sts
  tags: 
rxgt-ps-mgmt-stack-deploy
  
- name: retrieve sts credentials
  set_fact:
sts_access_key: "{{ sts_session_token.sts_creds.access_key }}"
sts_secret_key: "{{ sts_session_token.sts_creds.secret_key }}"
sts_session_token: "{{ sts_session_token.sts_creds.session_token }}"
  when: with_sts  
  tags:
rxgt-ps-mgmt-stack-deploy

- name: debug role arns
  debug:
msg: "Assuming role: {{ account_config.sts_role_arn }}"
verbosity: 1
  loop: "{{ rxgt_identity_account['deploy_accounts']|map('extract', 
rxgt_identity_account['account_config'])|list }}"
  loop_control:
loop_var: account_config
label: "{{ account_config.sts_role_arn }}"
  tags:
rxgt-ps-mgmt-stack-deploy

- name: assume cross account roles
  sts_assume_role:
role_arn: "{{ account_config.sts_role_arn }}"
role_session_name: "ansibledeploy"
duration_seconds: "{{ sts_session_duration | default(3600) }}"
aws_access_key: "{{ sts_access_key | default(omit) }}"
aws_secret_key: "{{ sts_secret_key | default(omit) }}"
security_token: "{{ sts_session_token | default(omit) }}"
mfa_serial_nunber: "{{ sts_mfa_serial_number | default(omit) }}"
mfa_token: "{{ sts_mfa_token | default(omit) }}"
  loop: "{{ rxgt_identity_account['deploy_accounts']|map('extract', 
rxgt_identity_account['account_config'])|list }}"
  loop_control:
loop_var: account_config
label: "{{ account_config.sts_role_arn }}"
  register: assumed_roles_with_account_config
  tags:
rxgt-ps-mgmt-stack-deploy

- name: create rxgt-ps-mgmt-direct-connect-gateway stack
  aws_direct_connect_gateway:
state: present
region: "{{ account_config.1 }}"
aws_access_key: "{{ account_config.0.sts_creds.access_key }}"
aws_secret_key: "{{ account_config.0.sts_creds.secret_key }}"
security_token: "{{ account_config.0.sts_creds.session_token }}"
name: "{{ 
rxgt_identity_account.account_config.rxgtmgmt.stacks['rxgt-ps-mgmt-direct-connect-gateway'].params.name
 
}}"
amazon_asn: "{{ 
rxgt_identity_account.account_config.rxgtmgmt.stacks['rxgt-ps-mgmt-direct-connect-gateway'].params.amazon_asn
 
}}"
  loop: "{{ 
assumed_roles_with_account_config.results|subelements('account_config.regions', 
skip_missing=True) }}"
  loop_control:
loop_var: account_config
label: "{{ account_config.0.account_config.account_alias }}:{{ 
account_config.1 }}"
  register: created_aws_direct_connect_gateway
  tags:
rxgt-ps-mgmt-stack-deploy
  
  
- name: debug stack outputs
  vars:
msg: "{{ account_config | to_nice_yaml }}"
  debug:
msg: "{{ msg.split('\n') }}"
verbosity: 0
  loop: "{{ 
assumed_roles_with_account_config.results|subelements('account_config.regions', 
skip_missing=True) }}"
  loop_control:
loop_var: account_config
label: "{{ account_config.0.account_config.account_alias }}:{{ 
account_config.1 }}"
  tags:
- 'never'
- 'debug'
- rxgt-ps-mgmt-stack-deploy

===
account_config.yaml

---
ansible_python_interpreter: "{{ lookup('env', 'VIRTUAL_ENV') }}/bin/python"
rxgt_identity_account:
  deploy_accounts:
  - XX

  account_config:
XX:
  id: 
  account

[ansible-project] Re: how to pass ansible variables from Jenkins by using parameters

2018-10-24 Thread Adrian Sebastian Dutu
-e allows you to pass variables to the command line. So you can put that in 
your job. Also, there's an ansible jenkins plugin. You can take a look at 
that.
https://wiki.jenkins.io/display/JENKINS/Ansible+Plugin

On Wednesday, October 24, 2018 at 8:40:34 AM UTC+2, kumar kittu wrote:
>
> Hello All,
>
> I have ansible-playbook which has variables defined and that playbook is 
> executed successfully from jenkins by creating job.
>
> my query is :
>
> I need to pass ansible variables defined in playbook from jenkins ,as 
> parameter(or what ever),so it would eliminate hard coding in 
> ansible-playbook.
>
> Searched a lot but couldn't get exact solution.
>
> Request anyone to help me at the earliest
>
> 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/c940e59a-e939-4b32-8096-1159ebda2216%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Unable to parse ansible/contrib/inventory/ec2.py as an inventory source

2018-10-24 Thread Kai Stian Olstad

On 24.10.2018 09:22, Oriol Tauleria wrote:

Hi Kai,

Error origin:
The file you have downloaded is not marked as executable, so when you 
pass

as inventory file, Ansible tries to read (not to execute it).


You need to read the whole thread, I'm not the one with the problem.
I actually wrote the same solution that you write here to the OP.

--
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/f2bc9ba73bf6340ee4c654345fdd395b%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Unable to parse ansible/contrib/inventory/ec2.py as an inventory source

2018-10-24 Thread Oriol Tauleria
Hi Kai,

Error origin:
The file you have downloaded is not marked as executable, so when you pass
as inventory file, Ansible tries to read (not to execute it).
Ansible tries to read as "ini" file (you have the first warning) but, of
course, this is not an ini file so it raises the warning.

Solution:
As Dick suggest, you need to mark as executable the script  (chmod +x ec2.py)
and launch again the ansible command (ansible -i ec2.py all -m ping).

Have you tried this solution?




El mar., 23 oct. 2018 a las 17:25,  escribió:

> HI Dick, thanks for your feedback. I know this docs and the command, but
> this command can not work. I want to know the error reason and how I should
> do?
>
> 在 2018年10月23日星期二 UTC+8下午4:15:57,Dick Visser写道:
>
>> On Tue, 23 Oct 2018 at 09:02,  wrote:
>> >
>> > HI Kai, thanks for your feedback. I referred to the docs:
>> https://docs.ansible.com/ansible/latest/user_guide/intro_dynamic_inventory.html.
>> Is it correct?
>>
>> Yes, it actually says so:
>>
>> 'The easiest is to use Ansible’s -i command line option and specify
>> the path to the script after marking it executable:'
>>
>>
>> Dick
>>
> --
> 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/0af65ca9-ec45-4b05-b207-603b618c0092%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/CABN89neAg8QgqnsaYVRAiwhn5OoLk3pFEOvQPBrSj%2B%2B8bT38Lw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.