[ansible-project] How to make mandatory variables if variable is defined

2018-04-04 Thread Javier Martí
Hi, I want to make sure before execution of the role that if a variable is 
defined you have to define another variables, can I do that?

I have a template:

{% if variable1 != '' %}
variable1 = {{ variable1 }}
variable2 = {{ variable2 }}
variable3 = {{ variable3 }}
{% endif %}

How to make mandatory variable2 and variable3 if variable1 is defined?

-- 
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/5de44439-f65c-4d0d-be40-0640dc0152b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] ansible-vault encrypt_string and inventory files

2018-04-04 Thread Kai Stian Olstad

On 04.04.2018 22:09, John Harmon wrote:

I believe I just have a syntax issue:

Inventory File:

win:
  hosts:
ansible-win.nspnet.net
  vars:
ansible_connection: winrm
ansible_user: ansible
ansible_password: >
 !vault |
  $ANSIBLE_VAULT;1.1;AES256
  
3065343135663463316531666438326431363662313662383166356630343661383436653666
  
623435613164306162346261666339353230356365360a383661333263656465646533386561
  
3339393732383864626439616633326663306260386630643161343365313533306135663332
  
6438373531326334310a316232386532313563363531303833373964363130633735636631396364

  6662



Have you tried

ansible_password: !vault |
  $ANSIBLE_VAULT;1.1;AES256
  
3065343135663463316531666438326431363662313662383166356630343661383436653666
  
623435613164306162346261666339353230356365360a383661333263656465646533386561
  
3339393732383864626439616633326663306260386630643161343365313533306135663332
  
6438373531326334310a316232386532313563363531303833373964363130633735636631396364

  6662

because I think the string should come right after the colon and no 
grater than sign.


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


[ansible-project] AWX Installation - Help

2018-04-04 Thread Vino B
Hi All,

  Trying to install AWX and facing the below error, request your help on 
the same. There are few blogs stating to downgrade pip-docker to 3.0.0 
(https://github.com/ansible/awx/issues/1197) so do we need to downgrade the 
same as this issue seem to be in pip-docker versions : 3.0.0, 3.0.1 and 
3.1.0. where as our version is 3.2.1


TASK [local_docker : Start the containers] 
*
fatal: [we1t1te02003s.cd2.bp.com]: FAILED! => {"changed": false, "msg": 
"Error connecting: load_config() got an unexpected keyword argument 
'config_dict'"}
to retry, use: --limit @/AWX/awx/installer/install.retry

Version
ansible 2.5.0
docker (3.2.1)
docker-compose (1.20.1)
docker-py (1.10.6)


*docker-compose version*
docker-compose version 1.20.1, build 5d8c71b
docker-py version: 3.2.1
CPython version: 3.6.5
OpenSSL version: OpenSSL 1.0.2j-fips  26 Sep 2016


From,
Vino.B

-- 
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/adbc0e8f-572b-4418-bf84-9a2aa0efeb03%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] ansible-vault encrypt_string and inventory files

2018-04-04 Thread Kai Stian Olstad

On 04.04.2018 23:52, John Harmon wrote:
Thx Brian.  I deleted my original post (didn't see a response to it 
yet, so

you probably were responding when I deleted it) due to semi-sensitive
information.


Google groups is a mailing list, so when you post, it sends mail to 
everyone that have subscribed to the list by e-mail.

So deleting a post won't work since the mail i already sent.


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


[ansible-project] Subject: Ansible 2.4.4.0 Final released

2018-04-04 Thread Toshio Kuratomi
Hi all, For everyone who has not yet decided to upgrade to
ansible-2.5.0 we're happy to announce that ansible- 2.4.4.0 has been
released.

--
How do you get it?


The tar.gz of the release can be found here:

https://releases.ansible.com/ansible/ansible-2.4.4.0.tar.gz
SHA256: 2b02756b9b6bc02d9028a4577ef332f8126c607528e18db825672b0301343358


You can also install it via pip by pinning the version:
$ pip install ansible==2.4.4.0

Or you can retrieve the release from the git repository as follows:

$ git clone https://github.com/ansible/ansible.git
$ cd ansible
$ git checkout v2.4.4.0-1

You can then source our testing script:

$ . hacking/env-setup

or you can build your own .tar.gz (output will be dist/ansible-2.4.4.0.tar.gz):

$ make sdist

--
This is the last regularly scheduled release in the 2.4.x series.
We'll make further 2.4.x releases if we discover critical or security
bugs that must be fixed while 2.4.x is still supported but the
majority of new bugfixes will be made to the 2.5.x release series.

Thanks to everyone who's participated in bug reporting and bug fixing
to make this release possible!

-Toshio

-- 
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/CAPrnkaRFighjF09RXPYoVCiozW%3DDDtCwh_DNPpSbqep%3DRkWc%3Dg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: ansible regex with lineinfile module not updating all host

2018-04-04 Thread rraka1002
Ah! that works John! thnx a mile.

On Thursday, April 5, 2018 at 1:41:14 AM UTC+5:30, John Harmon wrote:
>
> You need to account for white space. Try:
>
> regexp: '^passwd:.*files ldap'
>
>
>
>

-- 
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/2f6c48b5-372a-480f-ab42-dee7b05cf4fe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: win_group_membership

2018-04-04 Thread anil kumar
thanks much for the example.

Quick question on ConfigureRemotingForAnsible.ps1 -ForceNewSSLCert
-DisableBasicAuth, does this mean we can use any auth protocol as below
expect Basic(not secure), correct? I am more inclined toward kerberos auth.

* Basic
* Certificate (not the same as SSH keys)
* NTLM
* Kerberos
* CredSSP



On Thu, Mar 29, 2018 at 4:12 AM, 'J Hawkesworth' via Ansible Project <
ansible-project@googlegroups.com> wrote:

> vmware_guest module allows you to run scripts in 'runonce' section, so you
> can run the configure for remoting script as part of this, and any other
> steps you need.
>
> I use a playbook like the following to create vm from template.   Before
> using you have to add a hostname to the 'domainmember' group and allocate
> it an ip address in your inventory, like this
>
> # ansible inventory
> [domainmember]
> testmachine01 ip=172.17.0.1
>
>
>
>
> ---
> # spin up a vm  from a template
>
>
> - hosts: localhost
>   gather_facts: true
>
>
> - hosts: domainmember
>   gather_facts: false
>   vars:
> template: Winserver-TEMPLATE
>   vars_prompt:
>  - name: 'vmware_user'
>prompt: 'Enter VMWare username'
>private: no
>  - name: 'vmware_cred'
>prompt: 'Enter VMWare password'
>private: yes
>   pre_tasks:
> - name: show what we are planning on doing
>   debug:
>  msg: "ensure vm with hostname {{inventory_hostname}} and ip
> {{hostvars[inventory_hostname]['ip']}} exists."
>
>
> - name: clone vmware template and customise so it is ready for use as
> domain member
>   vmware_guest:
>  annotation: "Ansible cloned from template '{{template}}' on
> {{hostvars['localhost']['ansible_date_time']['date']}} by {{vmware_user}}"
>  cluster: Dev Cluster
>  datacenter: Dev datacenter
>  folder: /Development/
>  hostname: vcenterhost
>  name: "{{inventory_hostname}}"
>  password: "{{ vmware_cred }}"
>  resource_pool: Normal
>  state: poweredon
>  template: "{{template}}"
>  username: '{{vmware_user}}'
>  validate_certs: no
>  hardware:
> memory_mb: 1024
> num_cpus: 1
>  networks:
>   - name: VM Network
> ip: "{{hostvars[inventory_hostname]['ip']}}"
> netmask: 255.255.128.0
> gateway: 172.x.x.1
> # deliberately not specifying a domain heredomain:
> devdomain.local
> dns_servers:
>   - 172.x.x.x
>   - 172.x.x.x2
> # I had trouble using vmxnet3, it allways seems to want to be
> dhcp-configured.
> # may be worth retrying in future but ensuring static ip configured in
> template
> #devicetype: vmxnet3
> devicetype: e1000e
> type: static
>  customization:
>autologon: yes
>autologoncount: 5
>hostname: "{{inventory_hostname}}"
>ip: "{{hostvars[inventory_hostname]['ip']}}"
>netmask: 255.255.128.0
>gateway: 172.x.x.x
>dns_servers:
>   - 172.x.x.x
>   - 172.x.x.x2
> # deliberately not specifying a domain heredomain:
> devdomain.local
>password: "{{guest_administrator_pass}}"
>joindomain: devdomain.local
>domainadmin: "{{ win_dom_user }}"
>domainadminpassword: "{{ win_dom_cred }}"
>runonce:
>  - powershell.exe -ExecutionPolicy Unrestricted -File C:\Users
> \Administrator\Downloads\ConfigureRemotingForAnsible.ps1 -ForceNewSSLCert
>  - C:\finishsetup.bat
>timezone: 85
> # set timezone correctly or domain trust relationship will be lost
>   delegate_to: localhost
>
>
> - name: wait for connection to become reachable
>   wait_for_connection:
> delay: 75
> sleep: 11
> timeout: 675
>
>
> # by this point host should be on the domain so you can start running
> roles to provision your windows host
>
>
>
>
>
> On Thursday, March 29, 2018 at 12:05:32 AM UTC+1, anil kumar wrote:
>>
>> do you have any ideas on configuring winrm in the template(vmware)?
>>
>> On Wed, Mar 28, 2018 at 11:58 AM, Anil  wrote:
>>
>>> Thanks for elaborate information on ansible with windows.
>>>
>>> Winrm is disabled by default. Not sure about the security constraints
>>> when we enable this service.
>>>
>>> I will do research on it.
>>>
>>> On Mar 27, 2018, at 9:32 PM, Jordan Borean  wrote:
>>>
>>> You can currently only use the winrm connection plugin with Ansible to
>>> talk to Windows hosts. WinRM allows you to connect using both domain and
>>> local accounts and usually you need administrative rights on that host to
>>> both connect and manipulate group membership. WinRM allows you to
>>> authenticate using various protocol such as;
>>>
>>> * Basic
>>> * Certificate (not the same as SSH keys)
>>> * NTLM
>>> * Kerberos
>>> * CredSSP
>>>
>>> More details can be found

Re: [ansible-project] ansible-vault encrypt_string and inventory files

2018-04-04 Thread Brian Coca
my answer still stands, !vault is a YAMLism, it will never work in an INI file.


-- 
--
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/CACVha7e%2B6CBXjLacZFYesQQKi2t0TbO-KqcUYmMjCToUhxO7Pw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Remove missing files from a list

2018-04-04 Thread flowerysong
On Wednesday, April 4, 2018 at 4:43:14 PM UTC-4, Andy Smith wrote:
>
>
> I'd like to provide a default list of paths to all remote hosts, but 
> sometimes some of those paths won't be present. At the time the 
> /etc/foo/files_of_interest file is built I would like to exclude any 
> paths that don't exist. 
>
> I would prefer not to use per-host variables to specify a different 
> set of paths as that would be too much to manage and some of these 
> paths may spring into existence later on, without me knowing. 
>
> I found one way to do it: 
>
> https://gist.github.com/grifferz/a505e352baa18e06ba1ba1d02a123ee2 
>
> This works, but have I missed something which allows this to be done 
> in a more elegant way? 
>

Building the list of missing files doesn't need to be a multi-step process 
or involve an Ansible loop. I would preserve the ordering in the generated 
file instead of splitting it into two lists, so that someone manually 
adding a file and uncommenting its line creates the same state as 
re-templating the file.

So, something like 
this: https://gist.github.com/flowerysong/d6c5b16123473279c025fe8d34c20bd6

-- 
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/c75d5467-a92f-4af4-958e-de240bf6fe0f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] ansible-vault encrypt_string and inventory files

2018-04-04 Thread John Harmon
Thx Brian.  I deleted my original post (didn't see a response to it yet, so 
you probably were responding when I deleted it) due to semi-sensitive 
information.  I will post my general question below for context for people 
reading this in the future:

Can I utilize the encrypt_string output in my inventory file (tried 
multiple ways but couldn't get it to work):

Sample inventory file:
[win]
ansible-win.mydomain.com
[win:vars]
ansible_connection=winrm
ansible_user=ansible
ansible_password="!vault |
  $ANSIBLE_VAULT;1.1;AES256
  
3732303865323463323766613932313930613332333063356662356636326130626236366536
  
6138643739653436613930366165393161613932353865660a333939333666353435653433626536
  
36303430386438616234386639386439343433363962363563636436643562613339626536396332
  
6364393263646539650a656334373662343438336663666535343130336235616363343332356232
  3238"



On Wednesday, April 4, 2018 at 3:23:49 PM UTC-6, Brian Coca wrote:
>
> It will never work in ini file, you can encrypt the whole inventory 
> though (yaml or ini). 
>
> As for the single var, it 'should' work in a YAML inventory, but i 
> don't think we had it as a specific feature. 
>
>
>
> -- 
> -- 
> 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/db9a3a98-36ec-4694-9ecb-a5c2448c62f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] ansible-vault encrypt_string and inventory files

2018-04-04 Thread Brian Coca
It will never work in ini file, you can encrypt the whole inventory
though (yaml or ini).

As for the single var, it 'should' work in a YAML inventory, but i
don't think we had it as a specific feature.



-- 
--
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/CACVha7feQ0VtYa4QbjZdUU6p%2BdyqUOqMLWG5-9y%2BiA3Th74-cw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Remove missing files from a list

2018-04-04 Thread Andy Smith
Hi,

Imagine a service foo that has a config file
/etc/foo/files_of_interest which is just a list of other file paths,
one per line. If you put a path that doesn't exist into the file
then the service foo complains about it regularly, so you'd better
not do that.

I'd like to provide a default list of paths to all remote hosts, but
sometimes some of those paths won't be present. At the time the
/etc/foo/files_of_interest file is built I would like to exclude any
paths that don't exist.

I would prefer not to use per-host variables to specify a different
set of paths as that would be too much to manage and some of these
paths may spring into existence later on, without me knowing.

I found one way to do it:

https://gist.github.com/grifferz/a505e352baa18e06ba1ba1d02a123ee2

This works, but have I missed something which allows this to be done
in a more elegant way?

Cheers,
Andy

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


[ansible-project] Re: ansible regex with lineinfile module not updating all host

2018-04-04 Thread John Harmon
You need to account for white space. Try:

regexp: '^passwd:.*files ldap'



-- 
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/153a528c-86e7-44df-80fa-ef8fe05008f8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] ansible-vault encrypt_string and inventory files

2018-04-04 Thread John Harmon
I know I can encrypt my var files and get this to work, but I am just 
playing around.  Is it possible to take the output from the encrypt_string 
and use it in an inventory file?  I have been trying varying syntax, but 
can't get it to work.  I believe I just have a syntax issue:

# ansible-vault encrypt_string gomer --ask-vault-pass
New Vault password:
Confirm New Vault password:
!vault |
  $ANSIBLE_VAULT;1.1;AES256
  
62383564353563353933343161666435306464393165353337363035666363363663396336656238
  
3130313632386136333631643964616330336364623935620a333562363839353763336632613230
  
38383663313832396339646635383665613230643530373639646361306537613533306565363965
  
3639363061326263630a626537383662646430323866383633343630333561306164396366313836
  6234
Encryption successful

Inventory File:

win:
  hosts:
ansible-win.nspnet.net
  vars:
ansible_connection: winrm
ansible_user: ansible
ansible_password: >
!vault |
  $ANSIBLE_VAULT;1.1;AES256
  
3065343135663463316531666438326431363662313662383166356630343661383436653666
  
623435613164306162346261666339353230356365360a383661333263656465646533386561
  
3339393732383864626439616633326663306260386630643161343365313533306135663332
  
6438373531326334310a316232386532313563363531303833373964363130633735636631396364
  6662

also tried:
[win]
ansible-win.nspnet.net

[win:vars]
ansible_connection=winrm
ansible_user=ansible
ansible_password=!vault |
  $ANSIBLE_VAULT;1.1;AES256
  
3065343135663463316531666438326431363662313662383166356630343661383436653666
  
623435613164306162346261666339353230356365360a383661333263656465646533386561
  
3339393732383864626439616633326663306260386630643161343365313533306135663332
  
6438373531326334310a316232386532313563363531303833373964363130633735636631396364
  6662


-- 
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/16db8662-8b06-42db-a57f-9f65349ebdf5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Ansible help regex

2018-04-04 Thread Philippe Eveque
see https://www.regular-expressions.info/lookaround.html  for explanations.
lookaround is not consuming any characters.

try on https://regex101.com/ to make it concrete about what is matched or
not

HTH
Phil



2018-04-04 2:00 GMT+02:00 Numi :

> Hello, I was wondering if someone can possible help me with my Ansible
> playbook. I have a file called myfile.yml with a line that contains an
> image. Example line:
>
> service:
> blahblah
> image: myoldimagename
> blahblah
>
>
> I want to change everything after the word "image: " with a configuration
> line, however I'm having trouble. For example, I want to replace
> "myoldimagename" with "mynewline". I don'e want to match "myoldimagename"
> explicitly because that may be different.
>
> - name: Configure myfile.yml
>   replace:
> path: /data/config/myfile.yml
> regexp: "(?<=image: ).*"
> replace: \1mynewline
> backup: yes
>
> --
> 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/4f2d6e8a-516c-4b34-bf30-d33670de654e%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/CAB1FMuSXxEzCnp%3D_Br_QdFeYq6xpxch_MFpQZ8Dt2t9CgHUvTA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Ansible zabbix module issues

2018-04-04 Thread Linards Liepiņš
Hi, I am experiencing identical issue.

How did you changed this hardcoded path from python 2.6 (usr/bin/python) to 
python 2.7 (usr/bin/python)? What files you changed? How you changed them? 
To what values you changed the configuration?

trešdiena, 2018. gada 31. janvāris 07:07:33 UTC+2, Andrew Morgan rakstīja:
>
> thank you for "Ansible is hard coded to /usr/bin/python"..resolved
>
> On Wednesday, January 24, 2018 at 1:52:57 AM UTC-5, Andrew Morgan wrote:
>>
>> Hello All, 
>>
>> My ansible module is 
>>
>> ansible 2.4.2.0
>>   config file = /ansible/ansible.cfg
>>   configured module search path = [u'/root/.ansible/plugins/modules', u
>> '/usr/share/ansible/plugins/modules']
>>   ansible python module location = /usr/lib/python2.6/site-packages/
>> ansible
>>   executable location = /usr/bin/ansible
>>   python version = 2.6.6 (r266:84292, Aug 18 2016, 15:13:37) [GCC 4.4.7 
>> 20120313 (Red Hat 4.4.7-17)]
>>
>>
>> my play is 
>>
>> - hosts: zabbix
>>
>>   tasks:
>>   - name: This is installation
>> zabbix_maintenance:
>>  name: Zabbix123
>>  host_groups: Discovered host,Linux servers
>>  state: present
>>  minutes: 90
>>  server_url: http://zabbix.socialpatrol.net
>>  login_user: Admin
>>  login_password: yORKKEI1!
>>  desc: Setting up maintenance window for builds
>>
>>
>> my issue is that when I try to run ansible-playbook playbook.yaml
>>
>> I keep getting the error:
>>
>> TASK [This is installation] 
>> **
>> fatal: [zabbix_server]: FAILED! => {"changed": false, "msg": "Missing 
>> required zabbix-api module (check docs or install with: pip install 
>> zabbix-api)"}
>> to retry, use: --limit @/ansible/playbook.retry
>>
>>
>> I have installed pip zabbix-api , zabbix_api, pyzabbix and neither works. 
>> I have even tried installing them to the targe directory ansible has as 
>> python module location /usr/lib/python2.6/site-packages/ansible
>>  but I still get that error.Can someone please help.
>>
>>
>>

-- 
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/c1ca16ac-8aef-4834-a0f6-8f62d1610848%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] set_fact, map command combination returning 'undefined'

2018-04-04 Thread Gregory Mirsky
 

I am able to successfully execute Ansible module *ec2_vpc_subnet_facts* and 
register the output into a variable, *subnet_facts*.

 

I am using Ansible version 2.5.0and python version = 2.7.14 


I am able to check that subnet_facts contains the proper information using:

 

  - name: Debug for subnet_facts

  debug:

  var: subnet_facts

tags:

  - vpc_create

 

I am looking to create a list of subnet_ids from the 
*subnet_facts.results.subnets.id* attribute 

 

The set_fact example from the Ansible module documentation page (
http://docs.ansible.com/ansible/latest/modules/ec2_vpc_subnet_facts_module.html)
 
throws an error. This is what is on the documentation page:

 

- set_fact:

subnet_ids: "{{ subnet_facts.subnets|map(attribute='id')|list }}"

 

 

So far, I’ve managed to play around with the statement to get it to work 
(see permutations below) but now I get ‘undefined” as the output.

 

  - name: Set subnet_ids fact

set_fact:

  #subnet_ids: "{{ subnet_facts.results|map(attribute='id')|list }}"

  subnet_ids: "{{ 
subnet_facts.results|selectattr('subnets')|map(attribute='id')|list }}"

  #subnet_ids: "{{ 
subnet_facts.results|map(attribute='subnets')|map(attribute='id')|list }}"

  #subnet_ids: "{{ 
subnet_facts|selectattr('results.subnets')|map(attribute='id')|list }}"

 

Running this


  - name: Debug for subnet_ids

debug:

  var: subnet_ids

tags:

  - vpc_create


Yields this


 ok: [localhost] => {

 "ansible_facts": {

 "subnet_ids": "[Undefined, Undefined, Undefined]"

 },

 "changed": false

 }

 

I think I am at the “can’t see the forest for the trees” stage and I need 
the proverbial slap upside the head to show me what I am doing wrong. Any 
ideas? Suggestions?



-- 
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/ab47c7b3-e14d-41bb-8046-c6dbcf2abea8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: vsphere wait for vm powered off

2018-04-04 Thread Zeljko Dokman
Hi, I am trying to use this code to check VM power state and its failing 
for me with this error..

 "msg": "The conditional check 'result.hw_power_status == \"POWERED OFF\"' 
failed. The error was: error while evaluating conditional 
(result.hw_power_status == \"POWERED OFF\"): 'dict object' has no attribute 
'hw_power_status'"

My playbook..
Enter code here...   - name: Wait till {{ target }} is powered off
 vsphere_guest:
  vcenter_hostname="{{ vcenter_server }}"
  username=ansible@mbu.local
  password="{{ vc_passwd }}"
  guest=mbu-zabbix-ccp
  validate_certs=False
  vmware_guest_facts=yes
 register: result
 until: result.hw_power_status == "POWERED OFF"
 retries: 10
 delay: 5

i tried with 
result.hw_power_status == "POWERED OFF"
and
result.ansible_facts.hw_power_status == "POWERED OFF"

both fail with a same error..

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/17584e0c-9748-486c-a02f-92efb0b420dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: ansible.parsing.yaml.objects.AnsibleUnicode error

2018-04-04 Thread Biswadip Dutta
>From the information provided, I believe you are trying to reference 
dynamically named variables. You might find this Github issue (#19356 
) useful.

On Tuesday, April 3, 2018 at 4:00:39 PM UTC+5:30, Rıdvan KARATAŞ wrote:
>
> Hi
>
> I'm using ansible 2.5.0 
>
> When I'm trying to deploy a service it gives me this error: 
>
>
> ansible.parsing.yaml.objects.AnsibleUnicode object' has no attribute 'ipv4
> '
>
> I couldn't find much more relevant according to this
>
> any suggestions ?
>

-- 
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/d6558b80-bb13-45e0-bb34-56124ced1ab3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Installing Jenkins plugins with their dependencies

2018-04-04 Thread Biswadip Dutta

>
> state: latest
>

Please remove this and try. Apparently this is an open issue on Github. 
#24864 
 
On Tuesday, April 3, 2018 at 5:43:45 PM UTC+5:30, JiElPe-Fr38 wrote:
>
> Dear all,
>
> I have created a jenkins role that creates a jenkins instance and add 
> plugins.
> The task related to plugins is as follows :
>
> - name: Install plugins
>   jenkins_plugin:
> group: "{{ jenkins_process_group }}"
> owner: "{{ jenkins_process_user }}"
> name: "{{ item }}"
> state: latest
> url: "http://{{ jenkins_hostname }}:{{ jenkins_http_port }}{{ 
> jenkins_url_prefix }}"
> url_username: "{{ jenkins_admin_name }}"
> url_password: "{{ jenkins_admin_password }}"
> with_dependencies: yes
>
>   with_items: "{{ jenkins_plugins }}"
>   notify: restart jenkins
>   become: True
>   become_user: "{{ jenkins_process_user }}"
>
>
> All variables being known from files in vars or defaults.
>
> Plugins listed in the {{ jenkins_plugins }} list are those I actually 
> want. No dependency is listed here as I was hoping that the 
> with_dependencies: yes clause will install them. 
>
> *It is absolutely not the case !*The listed plugins are installed (so 
> there is no access rights or credentials problem), but the dependencies are 
> not.
> When going to the WEB UI, I have a context page that suggests me to 
> install dependencies.
>
>
> I can't find a way to get rid off that... If someone could help ?
>
> Best Regards
> J-L
>

-- 
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/63c5b3c2-6668-4aab-96ee-4eace386164f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Installing Jenkins plugins with their dependencies

2018-04-04 Thread Biswadip Dutta

>
> state: latest
>

Please remove this and try. 

On Tuesday, April 3, 2018 at 5:43:45 PM UTC+5:30, JiElPe-Fr38 wrote:
>
> Dear all,
>
> I have created a jenkins role that creates a jenkins instance and add 
> plugins.
> The task related to plugins is as follows :
>
> - name: Install plugins
>   jenkins_plugin:
> group: "{{ jenkins_process_group }}"
> owner: "{{ jenkins_process_user }}"
> name: "{{ item }}"
> state: latest
> url: "http://{{ jenkins_hostname }}:{{ jenkins_http_port }}{{ 
> jenkins_url_prefix }}"
> url_username: "{{ jenkins_admin_name }}"
> url_password: "{{ jenkins_admin_password }}"
> with_dependencies: yes
>
>   with_items: "{{ jenkins_plugins }}"
>   notify: restart jenkins
>   become: True
>   become_user: "{{ jenkins_process_user }}"
>
>
> All variables being known from files in vars or defaults.
>
> Plugins listed in the {{ jenkins_plugins }} list are those I actually 
> want. No dependency is listed here as I was hoping that the 
> with_dependencies: yes clause will install them. 
>
> *It is absolutely not the case !*The listed plugins are installed (so 
> there is no access rights or credentials problem), but the dependencies are 
> not.
> When going to the WEB UI, I have a context page that suggests me to 
> install dependencies.
>
>
> I can't find a way to get rid off that... If someone could help ?
>
> Best Regards
> J-L
>

-- 
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/9cd2ff4f-7f06-4393-819e-9a310d74ee52%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] ansible regex with lineinfile module not updating all host

2018-04-04 Thread rraka1002


Esteemed Collegues, I have created a Playbook to replcae the Entry in a 
file using a lineinfile module, while i tried running it run and replace in 
entry on the one host while not on the another host, i don't understand 
why? as it doesn't report any error even on the debug mode. Do i need to 
have some another regex pattern.

---
- name: Playbook to replace the line in file
  hosts: all
  remote_user: root
  gather_facts: False
  serial: 4
  tasks:
- name: replace line
  lineinfile:
dest: /tmp/test_master
state: present
regexp: '^passwd: files ldap' #  line to be replaced
line: 'passwd_compat: ldap'   #  new line which is replace existing , 
the one above
backrefs: yes
backup: yes
  register: nss

- name: replace line
  debug: var=nss



My Hostvar Inventory File:

# test_regex_hosts
[hosts]
Dev-mauj
Dev-pranjala
[hosts:vars]
ansible_ssh_user=root
ansible_ssh_private_key_file=/Dev/ansibleSpotin

Destination File contents:

$ cat /tmp/test_master
#
# nsswitch.conf
#
passwd: files ldap
shadow: files ldap
group:  files ldap
hosts:  files dns
bootparams: files
ethers: files
netmasks:   files ldap
networks:   files ldap
protocols:  files ldap
rpc:files ldap
services:   files ldap
netgroup:   files ldap
publickey:  files ldap
automount:  files ldap
printers:   user files ldap
sudoers:ldap
aliases:files ldap

Note: ansible 2.4

-- 
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/6ab8d218-03d0-4fc5-bef4-98153772252b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.