Re: [ansible-project] Ansible process email

2018-02-08 Thread Brian Coca
I used to have Ansible triggered from a procmail file, so not really
reading, but procmail reading after MDA and calling Ansible.


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


Re: [ansible-project] Reusing custom action plugin across multiple custom modules

2018-02-08 Thread Brian Coca
use symlink from single 'action module' to the other names.



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


Re: [ansible-project] printing readable error message while in playbook debug mode

2018-02-08 Thread Tim Black
My issue isn't about whats wrong with my code, its a question about why
ansible debugger wont print the newlines in a python string.

On 8 Feb 2018 12:31, "Kai Stian Olstad" 
wrote:

> On Thursday, 8 February 2018 21.18.03 CET Tim Black wrote:
> > The error appears to have been in
> > '/home/pi/Source/ansible/playbooks/post-preseeded-debian-install.yml':
> line
> > 27, column 7, but may
> > be elsewhere in the file depending on the exact syntax problem.
>
> So this is a strong indication that you have some errors in your code, so
> you need to show us the code in the file to figure it out.
>
>
> --
> Kai Stian Olstad
>
> --
> 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/VEkV22Mf2ac/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/1534323.axfGH9Ad8Q%40x1.
> 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/CA%2B23wiT2cfsisXd_ODvtDthAg0UmqikhBDdrtspvMtxAQos-bg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: junos_command

2018-02-08 Thread Ganesh Nalawade
 
> *AnsibleError: ncclient is not installed*

Please install ncclient and retry.

Command to install ncclient using pip:
# pip install ncclient


Regards,
Ganesh

On Friday, 9 February 2018 04:00:01 UTC+5:30, Gennadiy Krokodilov wrote:
>
> Boker Tov Asaf,  did you managed to solve it?
>
> I have exactly the same problem with ex4200 and Ansible 2.3.3. netconf is 
> enabled on port 830 and accessible:
>
> *[ playbooks]# ssh -s -p 830 ansible@juniper_12 netconf*
> *Welcome to Juniper ex4300-48t *
> *Password:*
> **
> **
> **
> *  *
> *urn:ietf:params:netconf:base:1.0*
> *
> urn:ietf:params:netconf:capability:candidate:1.0*
> *
> urn:ietf:params:netconf:capability:confirmed-commit:1.0*
> *
> urn:ietf:params:netconf:capability:validate:1.0*
> *
> urn:ietf:params:netconf:capability:url:1.0?scheme=http,ftp,file*
> *urn:ietf:params:xml:ns:netconf:base:1.0*
> *
> urn:ietf:params:xml:ns:netconf:capability:candidate:1.0*
> *
> urn:ietf:params:xml:ns:netconf:capability:confirmed-commit:1.0*
> *
> urn:ietf:params:xml:ns:netconf:capability:validate:1.0*
> *
> urn:ietf:params:xml:ns:netconf:capability:url:1.0?protocol=http,ftp,file*
> *http://xml.juniper.net/netconf/junos/1.0 
> *
> *http://xml.juniper.net/dmi/system/1.0 
> *
> *  *
> *  11528*
> **
> *]]>]]>*
>
>
> This is debug log:
>
> *2018-02-09 01:13:25,964 p=17223 u=root |  creating new control socket for 
> host 192.168.89.240:830  as user ansible*
> *2018-02-09 01:13:25,965 p=17223 u=root |  control socket path is 
> /root/.ansible/pc/1007ccc67b*
> *2018-02-09 01:13:25,965 p=17223 u=root |  current working directory is 
> /etc/ansible/playbooks*
> *2018-02-09 01:13:25,966 p=17223 u=root |  using connection plugin netconf*
> *2018-02-09 01:13:25,968 p=17223 u=root |  failed to create control socket 
> for host 192.168.89.240*
> *2018-02-09 01:13:25,969 p=17223 u=root |  Traceback (most recent call 
> last):*
> *  File "/opt/ansible/bin/ansible-connection", line 298, in main*
> *server = Server(sf_path, pc)*
> *  File "/opt/ansible/bin/ansible-connection", line 134, in __init__*
> *self.conn = connection_loader.get(play_context.connection, 
> play_context, sys.stdin)*
> *  File "/opt/ansible/lib/ansible/plugins/__init__.py", line 358, in get*
> *self._module_cache[path] = self._load_module_source(name, path)*
> *  File "/opt/ansible/lib/ansible/plugins/__init__.py", line 343, in 
> _load_module_source*
> *module = imp.load_source(full_name, path, module_file)*
> *  File "/opt/ansible/lib/ansible/plugins/connection/netconf.py", line 39, 
> in *
> *raise AnsibleError("ncclient is not installed")*
> *AnsibleError: ncclient is not installed *
>
>
> If you realised how to fix it, please share. 
> Thanks!
>
>
> вторник, 25 апреля 2017 г., 22:31:13 UTC+3 пользователь Asif Iqbal написал:
>>
>> I am failing to make junos_command work
>>
>> 2017-04-25 15:28:49,152 p=4058 u=user |  PLAY [sdwan-routers] 
>> 
>> 2017-04-25 15:28:49,171 p=4058 u=user |  TASK [junos_command] 
>> 
>> 2017-04-25 15:28:49,572 p=4084 u=user |  creating new control socket for 
>> host router.example.net:830 as user None
>> 2017-04-25 15:28:49,572 p=4084 u=user |  control socket path is 
>> /home/user/.ansible/pc/c08d46d021
>> 2017-04-25 15:28:49,572 p=4084 u=user |  current working directory is 
>> /home/user/ansible/sdwan
>> 2017-04-25 15:28:49,572 p=4084 u=user |  using connection plugin netconf
>> 2017-04-25 15:28:49,629 p=4084 u=user |  network_os is set to junos
>> 2017-04-25 15:28:49,629 p=4084 u=user |  ssh connection done, stating 
>> ncclient
>> 2017-04-25 15:28:59,694 p=4084 u=user |  failed to create control socket 
>> for host router.example.net
>> 2017-04-25 15:28:59,695 p=4084 u=user |  Traceback (most recent call 
>> last):
>>   File "/usr/bin/ansible-connection", line 298, in main
>> server = Server(sf_path, pc)
>>   File "/usr/bin/ansible-connection", line 135, in __init__
>> self.conn._connect()
>>   File 
>> "/usr/lib/python2.7/dist-packages/ansible/plugins/connection/netconf.py", 
>> line 95, in _connect
>> device_params={'name': self._network_os}
>>   File "/usr/lib/python2.7/dist-packages/ncclient/manager.py", line 149, 
>> in connect
>> return connect_ssh(*args, **kwds)
>>   File "/usr/lib/python2.7/dist-packages/ncclient/manager.py", line 118, 
>> in connect_ssh
>> session.connect(*args, **kwds)
>>   File "/usr/lib/python2.7/dist-packages/ncclient/transport/ssh.py", line 
>> 372, in connect
>> raise SSHError("Could not open socket to %s:%s" % (host, port))
>> SSHError: Could not open socket to router.example.net:830
>>
>> 2017-04-25 15:29:19,598 p=4084 u=user |  number of connection 

Re: [ansible-project] In a loop everything executes at the same time?

2018-02-08 Thread Brian Coca
No, in a loop everything executes sequentially, but EACH host executes
their own version of the task AND the loop in parallel.

debug will give you misleading results as it is a 'local' process and
probably finishes before other forks can start, once you intorduce the
delay of remote tranfer+execution you start seeing the real and
correct behaviour.

You might want to put the task in a play with 'serial' to handle the
'global limit' correctly.


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


[ansible-project] remove previously used remote_user (possibly ControlMaster, ControlPersist problem)

2018-02-08 Thread 'Davide' via Ansible Project
Hi all,

to setup raspberry pis I would like to use the following palybooks (the 
actual
yaml is at the end).

  1. with remote_user=defaultuser, become and add newuser
  2. with remote_user=newuser, become and delete defaultuser

If I play this with some docker container as target it works but if the 
target
is a raspberry pi 3 (running archlinux or raspbian) I get:

TASK [remove default user] 
*
fatal: [192.168.1.129]: FAILED! => {"changed": false, "msg": "userdel: 
user defaultuser is currently used by process 615\n", "name": 
"defaultuser", "rc": 8}

This seems to happen because when the second playbook runs there is still a
defaultuser ssh process running from the first playbook.

Looking into it I found out about `-o ControlMaster=auto -o
ControlPersist=60s`. And if I `export ANSIBLE_SSH_ARGS='-o 
ControlMaster=no'`
before `ansible-playbook` it works also on the raspberry pi.

So my questions are the following.
Why does this affect the rasperry pi but not some docker containers? With 
the
default `ControlPersist=60s` it seems that it should also fail on the docker
container.

And is it possible to set `ControlMaster=no` for a specific playbook?

Thanks
Davide

Playbooks:

---
# login as default user and add new user
- hosts: testhost

  vars_files:
- secret
  vars:
ansible_password: "{{ defaultuserpassword }}"
ansible_become_pass: "{{ rootpassword }}"

  remote_user: "{{ defaultusername }}"
  become: yes
  become_method: su

  tasks:

  - name: "add user {{ remoteusername }}"
user:
  name: "{{ remoteusername }}"
  password: "{{ remoteuserpassword|password_hash('sha512') }}"
  shell: /bin/bash
  state: present

# login as newuser and remove default user
- hosts: testhost

  vars_files:
- secret
  vars:
ansible_password: "{{ remoteuserpassword }}"
ansible_become_pass: "{{ rootpassword}}"

  remote_user: "{{ remoteusername }}"
  become: yes
  become_method: su

  tasks:
- name: remove default user
  user:
name: "{{ defaultusername }}"
state: absent
remove: 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/09c3aba4-9b7e-4db7-8a0f-5bcab1c26883%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Failure on only one server running ansible playbook for key/user management

2018-02-08 Thread Joe G
I'll preface this by saying I'm novice to ansible and certainly not a linux 
expert so I might need extra details if you ask me to do anything, so 
please be specific with instructions. This has been working flawlessly in 
the past. I believe last week apt-get update and upgrade were run on the 
affected jss-01 server, this is the only change I can think of that could 
have caused this.  There were no issues on the jss-02 server which is a 
similarly built system.  We are attempting to push a new user key to our 
linux boxes and it fails only on one system as seen in the following.  The 
playbook continues on and completes on all the servers but the failed one.
  
[ansible@cm-01 ~]$ ansible-playbook 
/home/ansible/ansible-manage-ssh-keys.yml
[WARNING]: log file at /var/log/ansible.log is not writeable and we cannot 
create it, aborting

statically included: 
/home/ansible/roles/ansible-manage-ssh-keys/tasks/manage_ssh_keys.yml

PLAY [all] 
*

TASK [setup] 
***
ok: [smtp-01]
ok: [icin-02]
ok: [adweb-02]
ok: [nat-01]
ok: [icin-01]
fatal: [jss-01]: FAILED! => {"changed": false, "failed": true, 
"module_stderr": "", "module_stdout": "sudo: a password is required\r\n", 
"msg": "MODULE FAILURE"}
ok: [rad-01]
ok: [cm-01]
ok: [jds-01]
ok: [jss-02]
.
.
.
After combing around the settings on Ansible, I couldn't find any thing to 
try so I began looking at the target server. I found the following in 
auth.log

Feb  5 10:45:32 jss-01 sshd[24893]: Accepted publickey for ansible from 
10.8.5.5 port 53490 ssh2: RSA 
e4:cc:13:42:b8:4b:1e:74:2b:68:3f:3a:9f:ad:36:f5
Feb  5 10:45:32 jss-01 sshd[24893]: pam_unix(sshd:session): session opened 
for user ansible by (uid=0)
Feb  5 10:45:35 -jss-01 sudo:  ansible : user NOT in sudoers ; TTY=pts/0 ; 
PWD=/home/ansible ; USER=root ; COMMAND=/bin/bash -c echo 
BECOME-SUCCESS-czuqnnlgkgxdielnqutvrxodyiwwzgid; LANG=C LC_ALL=C 
LC_MESSAGES=C /usr/bin/python 
/home/ansible/.ansible/ansible-tmp-1517856376.69-76104663663977/setup; rm 
-rf "/home/ansible/.ansible/ansible-tmp-1517856376.69-76104663663977/" > 
/dev/null 2>&1
Feb  5 10:46:35 jss-01 sshd[25013]: Received disconnect from 10.8.5.51: 11: 
disconnected by user

So I ran the following on jss-01: usermod -aG sudo ansible

Then tailed the authlog while running the playbook again and now I'm 
getting:

Feb  7 15:49:01 jss-01 sshd[2805]: Accepted publickey for ansible from 
10.8.5.5 port 51642 ssh2: RSA 
e4:cc:13:42:b8:4b:1e:74:2b:68:3f:3a:9f:ad:36:f5
Feb  7 15:49:01 -jss-01 sshd[2805]: pam_unix(sshd:session): session opened 
for user ansible by (uid=0)
Feb  7 15:49:02 it-jss-01 sudo:  ansible : a password is required ; 
TTY=pts/0 ; PWD=/home/ansible ; USER=root ; COMMAND=/bin/bash -c echo 
BECOME-SUCCESS-eaiqfcczbkrxsfvznzbppfywmfxtikce; LANG=C LC_ALL=C 
LC_MESSAGES=C /usr/bin/python 
/home/ansible/.ansible/ansible-tmp-1518047386.27-104994896662402/setup; rm 
-rf "/home/ansible/.ansible/ansible-tmp-1518047386.27-104994896662402/" > 
/dev/null 2>&1

I'm not sure where to go from here.  There shouldn't be any password 
required from my understanding. I probably shouldn't have even added the 
ansible user to the sudoers, since that's not how it's configured 
elsewhere.  Any help would be appreciated.  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/22d20a50-cb58-41fe-bd72-01a43ca3cafa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: junos_command

2018-02-08 Thread Gennadiy Krokodilov
Boker Tov Asaf,  did you managed to solve it?

I have exactly the same problem with ex4200 and Ansible 2.3.3. netconf is 
enabled on port 830 and accessible:

*[ playbooks]# ssh -s -p 830 ansible@juniper_12 netconf*
*Welcome to Juniper ex4300-48t *
*Password:*
**
**
**
*  *
*urn:ietf:params:netconf:base:1.0*
*
urn:ietf:params:netconf:capability:candidate:1.0*
*
urn:ietf:params:netconf:capability:confirmed-commit:1.0*
*
urn:ietf:params:netconf:capability:validate:1.0*
*
urn:ietf:params:netconf:capability:url:1.0?scheme=http,ftp,file*
*urn:ietf:params:xml:ns:netconf:base:1.0*
*
urn:ietf:params:xml:ns:netconf:capability:candidate:1.0*
*
urn:ietf:params:xml:ns:netconf:capability:confirmed-commit:1.0*
*
urn:ietf:params:xml:ns:netconf:capability:validate:1.0*
*
urn:ietf:params:xml:ns:netconf:capability:url:1.0?protocol=http,ftp,file*
*http://xml.juniper.net/netconf/junos/1.0*
*http://xml.juniper.net/dmi/system/1.0*
*  *
*  11528*
**
*]]>]]>*


This is debug log:

*2018-02-09 01:13:25,964 p=17223 u=root |  creating new control socket for 
host 192.168.89.240:830 as user ansible*
*2018-02-09 01:13:25,965 p=17223 u=root |  control socket path is 
/root/.ansible/pc/1007ccc67b*
*2018-02-09 01:13:25,965 p=17223 u=root |  current working directory is 
/etc/ansible/playbooks*
*2018-02-09 01:13:25,966 p=17223 u=root |  using connection plugin netconf*
*2018-02-09 01:13:25,968 p=17223 u=root |  failed to create control socket 
for host 192.168.89.240*
*2018-02-09 01:13:25,969 p=17223 u=root |  Traceback (most recent call 
last):*
*  File "/opt/ansible/bin/ansible-connection", line 298, in main*
*server = Server(sf_path, pc)*
*  File "/opt/ansible/bin/ansible-connection", line 134, in __init__*
*self.conn = connection_loader.get(play_context.connection, 
play_context, sys.stdin)*
*  File "/opt/ansible/lib/ansible/plugins/__init__.py", line 358, in get*
*self._module_cache[path] = self._load_module_source(name, path)*
*  File "/opt/ansible/lib/ansible/plugins/__init__.py", line 343, in 
_load_module_source*
*module = imp.load_source(full_name, path, module_file)*
*  File "/opt/ansible/lib/ansible/plugins/connection/netconf.py", line 39, 
in *
*raise AnsibleError("ncclient is not installed")*
*AnsibleError: ncclient is not installed *


If you realised how to fix it, please share. 
Thanks!


вторник, 25 апреля 2017 г., 22:31:13 UTC+3 пользователь Asif Iqbal написал:
>
> I am failing to make junos_command work
>
> 2017-04-25 15:28:49,152 p=4058 u=user |  PLAY [sdwan-routers] 
> 
> 2017-04-25 15:28:49,171 p=4058 u=user |  TASK [junos_command] 
> 
> 2017-04-25 15:28:49,572 p=4084 u=user |  creating new control socket for 
> host router.example.net:830 as user None
> 2017-04-25 15:28:49,572 p=4084 u=user |  control socket path is 
> /home/user/.ansible/pc/c08d46d021
> 2017-04-25 15:28:49,572 p=4084 u=user |  current working directory is 
> /home/user/ansible/sdwan
> 2017-04-25 15:28:49,572 p=4084 u=user |  using connection plugin netconf
> 2017-04-25 15:28:49,629 p=4084 u=user |  network_os is set to junos
> 2017-04-25 15:28:49,629 p=4084 u=user |  ssh connection done, stating 
> ncclient
> 2017-04-25 15:28:59,694 p=4084 u=user |  failed to create control socket 
> for host router.example.net
> 2017-04-25 15:28:59,695 p=4084 u=user |  Traceback (most recent call last):
>   File "/usr/bin/ansible-connection", line 298, in main
> server = Server(sf_path, pc)
>   File "/usr/bin/ansible-connection", line 135, in __init__
> self.conn._connect()
>   File 
> "/usr/lib/python2.7/dist-packages/ansible/plugins/connection/netconf.py", 
> line 95, in _connect
> device_params={'name': self._network_os}
>   File "/usr/lib/python2.7/dist-packages/ncclient/manager.py", line 149, 
> in connect
> return connect_ssh(*args, **kwds)
>   File "/usr/lib/python2.7/dist-packages/ncclient/manager.py", line 118, 
> in connect_ssh
> session.connect(*args, **kwds)
>   File "/usr/lib/python2.7/dist-packages/ncclient/transport/ssh.py", line 
> 372, in connect
> raise SSHError("Could not open socket to %s:%s" % (host, port))
> SSHError: Could not open socket to router.example.net:830
>
> 2017-04-25 15:29:19,598 p=4084 u=user |  number of connection attempts 
> exceeded, unable to connect to control socket
> 2017-04-25 15:29:19,599 p=4084 u=user |  persistent_connect_interval=1, 
> persistent_connect_retries=30
> 2017-04-25 15:29:19,625 p=4058 u=user |  fatal: [router.example.net]: 
> FAILED! => {"changed": false, "failed": true, "msg": "unable to open shell. 
> Please see: 
> https://docs.ansible.com/ansible/network_debug_troubleshooting.html#unable-to-open-shell;,
>  
> "rc": 255}
> 2017-04-25 15:29:19,626 p=4058 u=user |  PLAY RECAP 
> 

[ansible-project] In a loop everything executes at the same time?

2018-02-08 Thread Guillem Sola
I want to limit the number of parllel executions for a certain task inside 
a playbook (I have some constrains with downloading artifacts)

In that way the rest of tasks wil execute in all hosts at the same time but 
when the download task executes it will be limited to batches of N.

For this I'm creating a sequence with the # of iterations needed. If I do 
this it seems to work quite well

- debug:
msg: "Sequence {{ item }} with modulus {{ (( 
ansible_play_batch.index(inventory_hostname) % (( play_hosts | length ) / 2 
)) | round) }}"
with_sequence: start=0 end={{ (( play_hosts | length ) / 2 ) | round (0, 
'floor') | int }}
loop_control:
pause: 5
when: "(( ansible_play_batch.index(inventory_hostname) % (( play_hosts | 
length ) / 2 )) | round) == (item | int)"

Output

TASK [debug] 

skipping: [PCT2EMFR0HP.pct2m.local] => (item=0) => {"changed": false, "item": 
"0", "skip_reason": "Conditional result was False"}
skipping: [PCT2EMFR0HQ.pct2m.local] => (item=0) => {"changed": false, "item": 
"0", "skip_reason": "Conditional result was False"}
skipping: [PCT2EMFR0HR.pct2m.local] => (item=0) => {"changed": false, "item": 
"0", "skip_reason": "Conditional result was False"}
ok: [PCT2EMFR0HO.pct2m.local] => (item=0) => {
"changed": false,
"item": "0",
"msg": "Sequence 0 with modulus 0.0"
}
skipping: [PCT2W00RDSH001.pct2m.local] => (item=0) => {"changed": false, 
"item": "0", "skip_reason": "Conditional result was False"}
ok: [PCT2EMFR0HP.pct2m.local] => (item=1) => {
"changed": false,
"item": "1",
"msg": "Sequence 1 with modulus 1.0"
}
skipping: [PCT2EMFR0HQ.pct2m.local] => (item=1) => {"changed": false, "item": 
"1", "skip_reason": "Conditional result was False"}
skipping: [PCT2EMFR0HO.pct2m.local] => (item=1) => {"changed": false, "item": 
"1", "skip_reason": "Conditional result was False"}
skipping: [PCT2W00RDSH001.pct2m.local] => (item=1) => {"changed": false, 
"item": "1", "skip_reason": "Conditional result was False"}
ok: [PCT2EMFR0HR.pct2m.local] => (item=1) => {
"changed": false,
"item": "1",
"msg": "Sequence 1 with modulus 1.0"
}
skipping: [PCT2EMFR0HP.pct2m.local] => (item=2) => {"changed": false, "item": 
"2", "skip_reason": "Conditional result was False"}
ok: [PCT2EMFR0HQ.pct2m.local] => (item=2) => {
"changed": false,
"item": "2",
"msg": "Sequence 2 with modulus 2.0"
}
skipping: [PCT2EMFR0HO.pct2m.local] => (item=2) => {"changed": false, "item": 
"2", "skip_reason": "Conditional result was False"}
skipping: [PCT2EMFR0HR.pct2m.local] => (item=2) => {"changed": false, "item": 
"2", "skip_reason": "Conditional result was False"}
ok: [PCT2W00RDSH001.pct2m.local] => (item=2) => {
"changed": false,
"item": "2",
"msg": "Sequence 2 with modulus 2.0"
}

But if I execute something in the remote server (in this case just a sleep 
or a download) it seems that at the end everything is executed in parallel. 
See output generated times for each task, there should be some timespan 
seconds between loop iterations

- name: Download at ratio three at most
win_get_url:
url: http://ipv4.download.thinkbroadband.com/100MB.zip
dest: c:/ansible/100MB.zip
force: yes
# win_shell: (0..5) | foreach { 
(date).ToString("hh:mm:ss:");Start-Sleep -Seconds 1 }
with_sequence: start=0 end={{ (( play_hosts | length ) / 2 ) | round (0, 
'floor') | int }}
when: "(( ansible_play_batch.index(inventory_hostname) % (( play_hosts | 
length ) / 2 )) | round) == (item | int)"

Output

TASK [Download at ratio three at most] 
**
skipping: [PCT2EMFR0HP.pct2m.local] => (item=0) => {"changed": false, "item": 
"0", "skip_reason": "Conditional result was False"}
skipping: [PCT2EMFR0HQ.pct2m.local] => (item=0) => {"changed": false, "item": 
"0", "skip_reason": "Conditional result was False"}
skipping: [PCT2EMFR0HQ.pct2m.local] => (item=1) => {"changed": false, "item": 
"1", "skip_reason": "Conditional result was False"}
skipping: [PCT2EMFR0HR.pct2m.local] => (item=0) => {"changed": false, "item": 
"0", "skip_reason": "Conditional result was False"}
skipping: [PCT2W00RDSH001.pct2m.local] => (item=0) => {"changed": false, 
"item": "0", "skip_reason": "Conditional result was False"}
skipping: [PCT2W00RDSH001.pct2m.local] => (item=1) => {"changed": false, 
"item": "1", "skip_reason": "Conditional result was False"}
changed: [PCT2EMFR0HP.pct2m.local] => (item=1) => {"changed": true, "cmd": 
"(0..5) 
| foreach { (date).ToString(\"hh:mm:ss:\");Start-Sleep -Seconds 1 }", 
"delta": "0:00:06.531287", "end": "2018-02-08 10:26:58.403828", "item": "1", 
"rc": 0, "start": "2018-02-08 10:26:51.872540", "stderr": "", "stderr_lines": 
[], "stdout": 

Re: [ansible-project] printing readable error message while in playbook debug mode

2018-02-08 Thread Kai Stian Olstad
On Thursday, 8 February 2018 21.18.03 CET Tim Black wrote:
> The error appears to have been in 
> '/home/pi/Source/ansible/playbooks/post-preseeded-debian-install.yml': line 
> 27, column 7, but may
> be elsewhere in the file depending on the exact syntax problem.

So this is a strong indication that you have some errors in your code, so you 
need to show us the code in the file to figure it out.


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


[ansible-project] printing readable error message while in playbook debug mode

2018-02-08 Thread Tim Black
I get this error when I run my playbook (with debug strategy enabled):

TASK [Add authorized keys for developer user] 
**
task path: /home/pi/Source/ansible/playbooks/post-preseeded-debian-install.
yml:27
fatal: [tblack-win10]: FAILED! => {
"msg": "The task includes an option with an undefined variable. The 
error was: 'item' is undefined\n\nThe error appears to have been in 
'/home/pi/Source/ansible/playbooks/post-preseeded-debian-install.yml': line 
27, column 7, but may\nbe elsewhere in the file depending on the exact 
syntax problem.\n\nThe offending line appears to be:\n\n  tasks:\n- 
name: \"Add authorized keys for {{ preseeded_username }} user\"\n  ^ 
here\nWe could be wrong, but this one looks like it might be an issue 
with\nmissing quotes.  Always quote template expression brackets when 
they\nstart a value. For instance:\n\nwith_items:\n  - {{ foo 
}}\n\nShould be written as:\n\nwith_items:\n  - \"{{ foo 
}}\"\n\nexception type: \nexception: 'item' is undefined"
}

It breaks into debug prompt, but when I print the error message there, it 
won't do it pythonically, or even readable:

(debug) p result['msg']
u'The task includes an option with an undefined variable. The error was: 
\'item\' is undefined\n\nThe error appears to have been in 
\'/home/pi/Source/ansible/playbooks/post-preseeded-debian-install.yml\': 
line 27, column 7, but may\nbe elsewhere in the file depending on the exact 
syntax problem.\n\nThe offending line appears to be:\n\n  tasks:\n- 
name: "Add authorized keys for {{ preseeded_username }} user"\n  ^ 
here\nWe could be wrong, but this one looks like it might be an issue 
with\nmissing quotes.  Always quote template expression brackets when 
they\nstart a value. For instance:\n\nwith_items:\n  - {{ foo 
}}\n\nShould be written as:\n\nwith_items:\n  - "{{ foo 
}}"\n\nexception type: \nexception: \'item\' is 
undefined'

However, I can copy/paste the entire unicode string def, paste and print in 
a separate python interactive session variable, and it looks correct:

/home/tblack > python
Python 2.7.13 (default, Nov 24 2017, 17:33:09)
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> m=u'The task includes an option with an undefined variable. The error 
was: \'item\' is undefined\n\nThe error appears to have been in 
\'/home/pi/Source/ansible/playbooks/post-preseeded-debian-install.yml\': 
line 27, column 7, but may\nbe elsewhere in the file depending on the exact 
syntax problem.\n\nThe offending line appears to be:\n\n  tasks:\n- 
name: "Add authorized keys for {{ preseeded_username }} user"\n  ^ 
here\nWe could be wrong, but this one looks like it might be an issue 
with\nmissing quotes.  Always quote template expression brackets when 
they\nstart a value. For instance:\n\nwith_items:\n  - {{ foo 
}}\n\nShould be written as:\n\nwith_items:\n  - "{{ foo 
}}"\n\nexception type: \nexception: \'item\' is 
undefined'
>>> type(m)

>>> print m
The task includes an option with an undefined variable. The error was: 
'item' is undefined


The error appears to have been in 
'/home/pi/Source/ansible/playbooks/post-preseeded-debian-install.yml': line 
27, column 7, but may
be elsewhere in the file depending on the exact syntax problem.


The offending line appears to be:


  tasks:
- name: "Add authorized keys for {{ preseeded_username }} user"
  ^ here
We could be wrong, but this one looks like it might be an issue with
missing quotes.  Always quote template expression brackets when they
start a value. For instance:


with_items:
  - {{ foo }}


Should be written as:


with_items:
  - "{{ foo }}"


exception type: 
exception: 'item' is undefined

How do I do same in the ansible debug prompt? Any other ideas on how to 
print this output in a READABLE fashion? 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/837d8c54-f728-4eea-a541-a4891ac9c8cf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible Tower can't reach SCM source or remote host.

2018-02-08 Thread Pranav Baitule
Hello,

I have installed Ansible Tower on Ubuntu using Windows Subsystem for Linux. 

Starting an SCM update or running a playbook against a remote host gives me 
the following error - 


Can't create signalfd: Function not implemented
Failed to make / slave: Invalid argument

How can I fix this?

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a50a1cca-9d47-4b9b-841d-25e78c5fbb2b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] How to loop over result and retry in the same task?

2018-02-08 Thread Brian Coca
you CAN retry the first task, use until condition, i dont see a block
of tasks ...





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


Re: [ansible-project] How to log what a perl script does,called from an Ansible shell module?

2018-02-08 Thread ZillaYT
I implemented your chdir idea and it worked for me. I like it better 
anyway. Thanks!

On Thursday, February 8, 2018 at 12:08:51 PM UTC-5, Matt Martz wrote:
>
> It is likely because you need to add a `;` after your `cd`.  Otherwise I'm 
> guessing it's being interpreted wrong.
>
> I'd expect `install_rc` to show something though, likely indicating what 
> the problem is.
>
> Also, instead of using `cd`, look at using `chdir` instead:
>
> shell: /usr/local/perl ./install.pl --no-prompt
> args:
> chdir: /tmp/git-sync
>
>
>
> On Thu, Feb 8, 2018 at 11:02 AM, ZillaYT  
> wrote:
>
>> I'm trying to automate installation of gitsyncd and gitmirrord 
>> applications via download of the git-syncing.git repository, which installs 
>> a /tmp/git-sync/install.pl PERL script. I then run the following:
>>
>> - name: Install git-sync services
>>   shell: |
>>  cd /tmp/git-sync
>>  /usr/local/perl ./install.pl --no-prompt
>>   environment:
>>  ENV_VAR1: env_value1
>>  ENV_VAR2: env_value2
>>   register: install_rc
>> - debug: var=install_rc
>>
>> install_rc shows nothing. Using -vv option to run my playbook shows 
>> nothing either.
>>
>> I expect the gitsyncd and gitmirrord services to be installed, but 
>> they're not so I'm trying to debug why. I can run the Perl script manually 
>> and it works.
>>
>> Any ideas?
>>
>>
>>
>> -- 
>> 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/bbe1771e-cb60-4297-ae81-0cdfe8b07ddd%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Matt Martz
> @sivel
> sivel.net
>

-- 
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/a610ed17-b61f-4614-8132-6cd495b86d31%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] How to log what a perl script does,called from an Ansible shell module?

2018-02-08 Thread ZillaYT
No the pipe "|" after the shell command will execute the commands as they 
are listed, I've done it a million times. I will try your suggestion though.

On Thursday, February 8, 2018 at 12:08:51 PM UTC-5, Matt Martz wrote:
>
> It is likely because you need to add a `;` after your `cd`.  Otherwise I'm 
> guessing it's being interpreted wrong.
>
> I'd expect `install_rc` to show something though, likely indicating what 
> the problem is.
>
> Also, instead of using `cd`, look at using `chdir` instead:
>
> shell: /usr/local/perl ./install.pl --no-prompt
> args:
> chdir: /tmp/git-sync
>
>
>
> On Thu, Feb 8, 2018 at 11:02 AM, ZillaYT  
> wrote:
>
>> I'm trying to automate installation of gitsyncd and gitmirrord 
>> applications via download of the git-syncing.git repository, which installs 
>> a /tmp/git-sync/install.pl PERL script. I then run the following:
>>
>> - name: Install git-sync services
>>   shell: |
>>  cd /tmp/git-sync
>>  /usr/local/perl ./install.pl --no-prompt
>>   environment:
>>  ENV_VAR1: env_value1
>>  ENV_VAR2: env_value2
>>   register: install_rc
>> - debug: var=install_rc
>>
>> install_rc shows nothing. Using -vv option to run my playbook shows 
>> nothing either.
>>
>> I expect the gitsyncd and gitmirrord services to be installed, but 
>> they're not so I'm trying to debug why. I can run the Perl script manually 
>> and it works.
>>
>> Any ideas?
>>
>>
>>
>> -- 
>> 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/bbe1771e-cb60-4297-ae81-0cdfe8b07ddd%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Matt Martz
> @sivel
> sivel.net
>

-- 
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/3944e68c-83e9-4d14-8f90-43aa9a6de562%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] YAML code to list yum repositories and yum history using yum module.?

2018-02-08 Thread Mohan Ganesan
I would like to explore yum module in my yaml code.
I am looking for a YAML code to list yum repositories and yum history using 
yum module.
Are the commands yum repolist & yum history built on the yum module?
Please let me know.
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/5f6796a4-23b3-4d79-9bbe-537d1c0ff51f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible process email

2018-02-08 Thread timothy.n.mcgibbon via Ansible Project
Has anyone have done email reading using Ansible.
I am working on a project that is sending out email with a link to the task 
that the Ansible Tower would schedule a job to run.  The email could be the 
trigger or the Ansible process could check its email queue at an interval 
or any other process could be used to get the email read.  At this time 
reading the email would be the simplest way, as it would not require any 
change in the process we are currently using.

-- 
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/d5bf9d68-cba1-464a-a34d-8ddfaceb51ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] How to log what a perl script does,called from an Ansible shell module?

2018-02-08 Thread Matt Martz
It is likely because you need to add a `;` after your `cd`.  Otherwise I'm
guessing it's being interpreted wrong.

I'd expect `install_rc` to show something though, likely indicating what
the problem is.

Also, instead of using `cd`, look at using `chdir` instead:

shell: /usr/local/perl ./install.pl --no-prompt
args:
chdir: /tmp/git-sync



On Thu, Feb 8, 2018 at 11:02 AM, ZillaYT  wrote:

> I'm trying to automate installation of gitsyncd and gitmirrord
> applications via download of the git-syncing.git repository, which installs
> a /tmp/git-sync/install.pl PERL script. I then run the following:
>
> - name: Install git-sync services
>   shell: |
>  cd /tmp/git-sync
>  /usr/local/perl ./install.pl --no-prompt
>   environment:
>  ENV_VAR1: env_value1
>  ENV_VAR2: env_value2
>   register: install_rc
> - debug: var=install_rc
>
> install_rc shows nothing. Using -vv option to run my playbook shows
> nothing either.
>
> I expect the gitsyncd and gitmirrord services to be installed, but they're
> not so I'm trying to debug why. I can run the Perl script manually and it
> works.
>
> Any ideas?
>
>
>
> --
> 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/bbe1771e-cb60-4297-ae81-0cdfe8b07ddd%40googlegroups.
> com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Matt Martz
@sivel
sivel.net

-- 
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/CAD8N0v--_nNfgx0RmbqxyRpBNS%3DexRnV-acX3xe70L7AL0_Cjw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Ansible on CENTOS VM SSH failing

2018-02-08 Thread ZillaYT
Have you set up your ssh keys between the two hosts, i.e., the user running 
Ansible and the target host? What happens if you just try to ssh to the 
target host?

On Wednesday, February 7, 2018 at 6:27:39 AM UTC-5, Alfredo Bosca Bataller 
wrote:
>
> Hi gents,
>
> After installing ansible and check that my version is 2.4.2.0 I have 
> created a inventory file like this:
>
>
>
> 
> Afterward, I have tried to access one of them throught ssh but I can't.
>
> The fail message is the next:
>
>
>
> 
>
>
> 
>
>
> 
>
>
>
> 
>
>
>
> 
>
>
>
> 
> The username of the network devices is "ccie".
>
> Do you know i fI need to change something in inventory file or ansible.cfg 
> file?
> 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/4462dfad-13eb-4387-a32f-1100dd447508%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] How to log what a perl script does,called from an Ansible shell module?

2018-02-08 Thread ZillaYT
I'm trying to automate installation of gitsyncd and gitmirrord applications 
via download of the git-syncing.git repository, which installs a 
/tmp/git-sync/install.pl PERL script. I then run the following:

- name: Install git-sync services
  shell: |
 cd /tmp/git-sync
 /usr/local/perl ./install.pl --no-prompt
  environment:
 ENV_VAR1: env_value1
 ENV_VAR2: env_value2
  register: install_rc
- debug: var=install_rc

install_rc shows nothing. Using -vv option to run my playbook shows nothing 
either.

I expect the gitsyncd and gitmirrord services to be installed, but they're 
not so I'm trying to debug why. I can run the Perl script manually and it 
works.

Any ideas?



-- 
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/bbe1771e-cb60-4297-ae81-0cdfe8b07ddd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Ansible reporting wrong service status

2018-02-08 Thread Kai Stian Olstad
On Thursday, 8 February 2018 16.26.07 CET Sidh wrote:
> Ansible - 2.4
> 
> With below snippet, service failed to start at remote host but ansible 
> reports that lighttpd service has been restarted and ok. 
>  
> 
> 
> - name: lighttpd config file
>   template:
> src: lighttpd.conf.j2
> dest: /etc/lighttpd/lighttpd.conf
> owner: root
> group: root
> mode: 0644
>   notify: Restart lighttpd
> 
>  handlers:
> - name: Restart lighttpd
>   become: true
>   service: name=lighttpd state=restarted
> 
> 
> 
> 
> Note: It's happening with lighttpd only.
> 
> RUNNING HANDLER [Restart lighttpd] 
> ***
> changed: [HOSTNAME]
> 

The init system on the host is reporting OK(return code 0) so Ansible says 
everything is OK.
If that's not correct then you need to fix the init file/configuration.


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


[ansible-project] Ansible reporting wrong service status

2018-02-08 Thread Sidh
Ansible - 2.4

With below snippet, service failed to start at remote host but ansible 
reports that lighttpd service has been restarted and ok. 
 


- name: lighttpd config file
  template:
src: lighttpd.conf.j2
dest: /etc/lighttpd/lighttpd.conf
owner: root
group: root
mode: 0644
  notify: Restart lighttpd

 handlers:
- name: Restart lighttpd
  become: true
  service: name=lighttpd state=restarted




Note: It's happening with lighttpd only.

RUNNING HANDLER [Restart lighttpd] 
***
changed: [HOSTNAME]


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/f8026166-d603-4e5a-94d5-5974fde337cf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] How to loop over result and retry in the same task?

2018-02-08 Thread Eric Chong
But I want to retry the first task until expected result.  I don't see a 
way for Ansible to retry a bock of tasks.

On Tuesday, February 6, 2018 at 12:31:16 PM UTC-5, Brian Coca wrote:
>
> you cannot loop over the results of your task that is generating those 
> results, you CAN loop over the results of one task in a second task. 
>
>
>
>
>
> -- 
> -- 
> 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/9701d9b4-3c86-4521-9baa-4fd6b078e17e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible vmware_guest creates vmware vm, but hostname does not changes. Also creates a additional junk folder

2018-02-08 Thread Ajay Sharma



HI Everyone. this Ansible yaml script creates vmware vm from previous 
template, but does not changes its host name.  also creates a additional 
folder named 

here is the screen shot attached. The vmware_guest module creates 
Testmachine, but the hostname of the machine remains same when i login to 
centos machine. 

also creates a junk folder named as  
"replica-e040a406-2f24-4c53-b719-67f42c1b9115"

Thanks in Advance. please give some solution. here is my yaml script 
attached. 


cat us_vm.yaml
---
- name: Deploy VM on 172.XX.X.XXX
  hosts: localhost
  gather_facts: no
  vars_prompt:
  - name: templatename
prompt: Supply template name
default: "CENTOS7-ENT-WWW-APACHE-DEFAULT"
private: no

  - name: vm_name
prompt: Supply VM Name to Be Created
default: "TestMachine"
private: no
  tasks:
- name: Create a VM from USA template
  vmware_guest:
hostname: 172.17.X.XXX
username: \X
password: d1
datacenter: OSC-US-Datacenter-Other
validate_certs: no
folder: /VMwareViewComposerReplicaFolder
name: "{{vm_name}}"
state: poweredon
template: "{{templatename}}"
disk:
  - size_gb: 50
type: thin
datastore: 3PAR_Datastore01
hardware:
  memory_mb: 512
  num_cpus: 1
  scsi: paravirtual
networks:
  - name: "OSC VLAN 4 172.16.9.0"
type: dhcp
customization:
# dns_servers:
# - 172.16.XX.XX
# - 172.16.XX.XX
 dns_suffix: .Xield.com
 hostname: "{{vm_name}}"
wait_for_ip_address: no
  delegate_to: localhost
  register: deploy
[root@OSIANSIBLEIND instance]#

-- 
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/9ca23f49-fde5-4394-8056-abf62d733e51%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] How Ansible Works?

2018-02-08 Thread lucie lina


There are many similar automation tools available like Puppet, Capistrano, 
Chef, Salt, Space Walk etc, but Ansible 
 categorize into two types of 
server: controlling machines and nodes.
The controlling machine, where Ansible is installed and Nodes are managed 
by this controlling machine over SSH. The location of nodes are specified 
by controlling machine through its inventory.
The controlling machine (Ansible) deploys modules to nodes using SSH 
protocol and these modules are stored temporarily on remote nodes and 
communicate with the Ansible machine through a JSON connection over the 
standard output.

Ansible is agent-less, that means no need of any agent installation on 
remote nodes, so it means there are no any background daemons or programs 
are executing for Ansible, when it’s not managing any nodes.

Ansible can handle 100’s of nodes from a single system over SSH connection 
and the entire operation can be handled and executed by one single command 
‘ansible’. But, in some cases, where you required to execute multiple 
commands for a deployment, here we can build playbooks.
Playbooks are bunch of commands which can perform multiple tasks and each 
playbooks are in YAML file format.

-- 
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/6c6dd076-ce21-49d2-9f33-1fd71a610c66%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: errors in backing up a config from a juniper device

2018-02-08 Thread 'Daley Okuwa' via Ansible Project

another error message 
ansible@ansible-new:/etc/ansible$ tail -f ansible.log
2018-02-08 09:21:54,543 p=26612 u=ansible |  socket operation completed 
with rc 0
2018-02-08 09:21:54,543 p=26612 u=ansible |  socket operation is RUN
2018-02-08 09:21:54,543 p=26612 u=ansible |  socket operation completed 
with rc 0
2018-02-08 09:21:54,758 p=26604 u=ansible |  fatal: [10.101.250.41]: 
FAILED! => {"changed": false, "msg": "Unsupported parameters for 
(junos_config) module: dest Supported parameters include: 
backup,comment,confirm,confirm_commit,host,lines,password,port,provider,replace,rollback,src,src_format,ssh_keyfile,timeout,transport,update,username,zeroize"}
2018-02-08 09:21:54,760 p=26604 u=ansible |   [WARNING]: Could not create 
retry file '/etc/ansible/backup_config-
junos.retry'. [Errno 13] Permission denied: u'/etc/ansible
/backup_config-junos.retry'
2018-02-08 09:21:54,760 p=26604 u=ansible |  PLAY RECAP 
*
2018-02-08 09:21:54,760 p=26604 u=ansible |  10.101.250.41  : 
ok=0changed=0unreachable=0failed=1
2018-02-08 09:22:24,543 p=26612 u=ansible |  persistent connection idle 
timeout triggered, timeout value is 30 secs
2018-02-08 09:22:24,543 p=26612 u=ansible |  shutdown persistent connection 
requested
2018-02-08 09:22:24,543 p=26612 u=ansible |  closing local listener
2018-02-08 09:22:24,543 p=26612 u=ansible |  closing the connection
2018-02-08 09:22:24,544 ncclient.operations.rpc Requesting 'CloseSession'
2018-02-08 09:22:24,608 p=26612 u=ansible |  removing the local control 
socket
2018-02-08 09:22:24,608 p=26612 u=ansible |  shutdown complete
2018-02-08 09:22:24,608 p=26612 u=ansible |  shutdown persistent connection 
requested
2018-02-08 09:22:24,608 p=26612 u=ansible |  persistent connection is not 
active
2018-02-08 09:22:24,608 p=26612 u=ansible |  shutdown local socket, 
connection was active for 0:00:39.071942 secs

Thanks 

On Wednesday, February 7, 2018 at 9:45:58 AM UTC, Daley Okuwa wrote:

> still getting the error messages
>
>  tail -f ansible.log
>   self._cipher = factory.new(key, *args, **kwargs)
> 2018-02-07 09:37:38,933 p=24501 u=ansible |  connecting to host 
> 10.101.250.41 returned an error
> 2018-02-07 09:37:38,933 p=24501 u=ansible |  Unknown host key 
> [b4:5c:23:06:c0:6e:3f:b3:f0:2e:de:30:6d:75:a1:dd] for [10.101.250.41]
> 2018-02-07 09:37:47,827 p=24493 u=ansible |  fatal: [10.101.250.41]: 
> FAILED! => {"changed": false, "msg": "unable to open shell. Please see: 
> https://docs.ansible.com/ansible/network_debug_troubleshooting.html#unable-to-open-shell
> "}
> 2018-02-07 09:37:47,828 p=24493 u=ansible |   [WARNING]: Could not create 
> retry file '/etc/ansible/backup_config-
> junos.retry'. [Errno 13] Permission denied: u'/etc/ansible
> /backup_config-junos.retry'
>
>
> On Monday, February 5, 2018 at 4:36:57 PM UTC, Daley Okuwa wrote:
>
>>
>>
>> On Friday, February 2, 2018 at 11:52:16 AM UTC, Daley Okuwa wrote:
>>>
>>> hello all
>>> I have this in my backup_config_yaml
>>>
>>> ---
>>> - name: BACKUP CONFIGS OF JUNOS DEVICES
>>>   hosts:  all
>>>   connection: local
>>>   gather_facts: no
>>>   tasks:
>>>   - name: GET  CONFIG
>>> junos_get_config:
>>>   user=
>>>   passwd=x
>>>   host={{inventory_hostname}}
>>>   dest=backups/{{inventory_hostname}}.conf
>>>   port=22
>>>
>>>  also have installed Junos PyEZ on my ansible server
>>>
>>> my etc/ansible/ hosts
>>> [junos]
>>> x.x.x.x
>>>
>>> I run the playbook
>>>  
>>> ansible@ansible-new:/etc/ansible$ ansible-playbook -i hosts 
>>> backup_config-junos.yml
>>> I get this error message 
>>>
>>> ERROR! no action detected in task. This often indicates a misspelled 
>>> module name, or incorrect module path.
>>> The error appears to have been in 
>>> '/etc/ansible/backup_config-junos.yml': line 10, column 5, but may
>>> be elsewhere in the file depending on the exact syntax problem.
>>> The offending line appears to be:
>>>
>>>   - name: GET  CONFIG
>>> ^ here
>>>
>>> The error appears to have been in 
>>> '/etc/ansible/backup_config-junos.yml': line 10, column 5, but may
>>> be elsewhere in the file depending on the exact syntax problem.
>>> The offending line appears to be:
>>>
>>>   - name: GET  CONFIG
>>> ^ here
>>> exception type: 
>>> exception: no action detected in task. This often indicates a misspelled 
>>> module name, or incorrect module path.
>>> The error appears to have been in 
>>> '/etc/ansible/backup_config-junos.yml': line 10, column 5, but may
>>> be elsewhere in the file depending on the exact syntax problem.
>>> The offending line appears to be:
>>>
>>>   - name: GET  CONFIG
>>> ^ here
>>>
>>>

-- 
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 

[ansible-project] Unable to use specified private key when connecting as a different user

2018-02-08 Thread 0lai . m . mariano
Scenario - I am logged in to my Ansible server as “0lai” but would like to run 
my testPlay.yml as a different user (“ansible”) so I used the —user option. 
However, I don’t know user ansible’s password and would like to make it a 
passwordless run. I used thee —key-file option and provided the private key 
file of user ansible. This fails because user 0lai does not have read 
permission on user ansible’s private key. When i tried to give group read 
permission to ansible, it worked as expected. However, the private key 
shouldn’t be readable to anyone but the owner right?

Is there any way I can, as “0lai”, use “ansible” to connect to my managed nodes 
passwordlessly?

-- 
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/e4216e7e-b381-4c12-b57c-036116aa0e9f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.