Re: [ansible-project] Reboot servers strategy.

2020-06-30 Thread John Petro
Are you using ansible to apply updates and reboot now?  If so, what does
your current process look like?

--john

On Mon, Jun 29, 2020 at 3:26 PM Rafael Tomelin 
wrote:

>
> Hi Guys,
> I have periodic updates on all RedHat servers at the same time, I need to
> create a strategy to restart my clusters because I can't stop my
> application and services.
>
> How to create the reboot strategy server-per-server in clusters?
>
>
> --
> Atenciosamente,
>
> Rafael Tomelin
> Tel.: 51-984104084
> Skype: rafael.tomelin
>
> LPI ID: LPI000191271
> Red Hat Certified Engineer
> Puppet Professional 2017 Certification
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAGEUqbAwBVcpuWsULocMZ2ts4-298wqjmkkEvhRhRSDaFdnHPQ%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAPAjob-WzDS9BXVnGCvhS%3DXS%2B179f7mf-nJEbMQA-5-4_kZtmA%40mail.gmail.com.


Re: [ansible-project] Unable to unarchive the openshift client

2020-06-30 Thread Dick Visser
What do your playbook and inventory look like?
Which version of ansible are you using?
How do you invoke things?


On Mon, 29 Jun 2020 at 19:56, Vinay Kumar Rudiya  wrote:

> If I'm trying to unarchive only the file out of the role I can do it, but
> when I'm trying to do in role with the proxy its causing error
> fatal: [localhost]: FAILED! => {"changed": false, "msg": "Failed to find
> handler for
> \"/home/.ansible/tmp/ansible-tmp-1593453017.73-12268-16009161025458/openshift-client-linux.tar1fwzbnm7.gz\".
> Make sure the required command to extract the file is installed. Command
> \"/usr/bin/gtar\" could not handle archive. Command \"/usr/bin/unzip\"
> could not handle archive."}
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/9b31ef79-2284-4419-a1ac-1898431d9d3en%40googlegroups.com
> 
> .
>
-- 
Sent from a mobile device - please excuse the brevity, spelling and
punctuation.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAL8fbwMaWYm-A%2BStjpHUs_fjov8a7_5nxoMxYztNefLLwNw%3DdQ%40mail.gmail.com.


Re: [ansible-project] Ansible unable to create $HOME/.ansible/tmp directory due to shell syntax error in RHEL 6.7

2020-06-30 Thread Dick Visser
What do your playbook and inventory look like?
Which version of ansible are you using?
How do you invoke things?
What are you trying to automate?


On Mon, 29 Jun 2020 at 15:45, Rishabh Kumar  wrote:

> Hi,
>
> When I am trying to run ansible job from my host computer to remote server
> it fails with the following error logs -
>
>
> <127.0.0.12> ESTABLISH SSH CONNECTION FOR USER: ansibleuser
>
>
>
> <127.0.0.12> SSH: EXEC sshpass -d47 ssh -vvv -C -o ControlMaster=auto -o
> ControlPersist=60s -o 'User="ansibleuser"' -o ConnectTimeout=10 -o
> ControlPath=/Users/hostuser/.ansible/cp/0ac5f07217 127.0.0.12 '/bin/sh -c
> '"'"'( umask 77 && mkdir -p "` echo /home/ansibleuser/.ansible/tmp `"&&
> mkdir
> /home/ansibleuser/.ansible/tmp/ansible-tmp-1593435394.159632-95806-14486735064275
> && echo ansible-tmp-1593435394.159632-95806-14486735064275="` echo
> /home/ansibleuser/.ansible/tmp/ansible-tmp-1593435394.159632-95806-14486735064275
> `" ) && sleep 0'"'"''
>
> <127.0.0.12> (1, b'\x1b(B\x1b[m', b'OpenSSH_7.9p1, LibreSSL
> 2.7.3\r\ndebug1: Reading configuration data
> /Users/hostuser/.ssh/config\r\ndebug1: /Users/hostuser/.ssh/config line 1:
> Applying options for *\r\ndebug1: Reading configuration data
> /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 48: Applying
> options for *\r\ndebug2: resolve_canonicalize: hostname 127.0.0.12 is
> address\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting
> O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version
> 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0
> remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3:
> mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive:
> done pid = 95817\r\ndebug3: mux_client_request_session: session request
> sent\r\n/bin/sh: -c: line 0: syntax error near unexpected token
> `(\'\n/bin/sh: -c: line 0: `( umask 77 && mkdir -p "` echo
> \x1b(B\x1b[m/home/ansibleuser/.ansible/tmp `"&& mkdir
> \x1b(B\x1b[m/home/ansibleuser/.ansible/tmp/ansible-tmp-1593435394.159632-95806-14486735064275
> && echo ansible-tmp-1593435394.159632-95806-14486735064275="` echo
> \x1b(B\x1b[m/home/ansibleuser/.ansible/tmp/ansible-tmp-1593435394.159632-95806-14486735064275
> `" ) && sleep 0\'\ndebug3: mux_client_read_packet: read header failed:
> Broken pipe\r\ndebug2: Received exit status from master 1\r\n')
>
> <127.0.0.12> Failed to connect to the host via ssh: OpenSSH_7.9p1,
> LibreSSL 2.7.3
>
> debug1: Reading configuration data /Users/hostuser/.ssh/config
>
> debug1: /Users/hostuser/.ssh/config line 1: Applying options for *
>
> debug1: Reading configuration data /etc/ssh/ssh_config
>
> debug1: /etc/ssh/ssh_config line 48: Applying options for *
>
> debug2: resolve_canonicalize: hostname 127.0.0.12 is address
>
> debug1: auto-mux: Trying existing master
>
> debug2: fd 3 setting O_NONBLOCK
>
> debug2: mux_client_hello_exchange: master version 4
>
> debug3: mux_client_forwards: request forwardings: 0 local, 0 remote
>
> debug3: mux_client_request_session: entering
>
> debug3: mux_client_request_alive: entering
>
> debug3: mux_client_request_alive: done pid = 95817
>
> debug3: mux_client_request_session: session request sent
>
> /bin/sh: -c: line 0: syntax error near unexpected token `('
>
> /bin/sh: -c: line 0: `( umask 77 && mkdir -p "` echo
> /home/ansibleuser/.ansible/tmp `"&& mkdir
> /home/ansibleuser/.ansible/tmp/ansible-tmp-1593435394.159632-95806-14486735064275
> && echo ansible-tmp-1593435394.159632-95806-14486735064275="` echo
> /home/ansibleuser/.ansible/tmp/ansible-tmp-1593435394.159632-95806-14486735064275
> `" ) && sleep 0'
>
> debug3: mux_client_read_packet: read header failed: Broken pipe
>
> debug2: Received exit status from master 1
>
> fatal: [127.0.0.12]: UNREACHABLE! => {
>
> "changed": false,
>
> "msg": "Failed to create temporary directory.In some cases, you may
> have been able to authenticate and did not have permissions on the target
> directory. Consider changing the remote tmp path in ansible.cfg to a path
> rooted in \"/tmp\", for more error information use -vvv. Failed command
> was: ( umask 77 && mkdir -p \"` echo
> \u001b(B\u001b[m/home/ansibleuser/.ansible/tmp `\"&& mkdir
> \u001b(B\u001b[m/home/ansibleuser/.ansible/tmp/ansible-tmp-1593435394.159632-95806-14486735064275
> && echo ansible-tmp-1593435394.159632-95806-14486735064275=\"` echo
> \u001b(B\u001b[m/home/ansibleuser/.ansible/tmp/ansible-tmp-1593435394.159632-95806-14486735064275
> `\" ), exited with result 1, stdout output: \u001b(B\u001b[m, stderr
> output: OpenSSH_7.9p1, LibreSSL 2.7.3\r\ndebug1: Reading configuration data
> /Users/hostuser/.ssh/config\r\ndebug1: /Users/hostuser/.ssh/config line 1:
> Applying options for *\r\ndebug1: Reading configuration data
> /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 48: Applying
> options for *\r\ndebug2: resolve_canonicalize: hostname 127.0.0.12 is
> address\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting
> 

Re: [ansible-project] Run Command On Each Host

2020-06-30 Thread Luca 'remix_tj' Lorenzetto
Hello,

try this for printing command output. I don't know if you can hide the
other parts of output:

https://stackoverflow.com/a/24834231

On Tue, Jun 30, 2020 at 4:18 PM 'Jitender J' via Ansible Project
 wrote:
>
> Thanks for the update, i''ll try using multiple shell tasks, also can you 
> please let me know how to make ansible not to print commands only print 
> output of command
>
>
> On Tue, Jun 30, 2020 at 7:44 PM Luca 'remix_tj' Lorenzetto 
>  wrote:
>>
>> Hello,
>>
>> ansible by default runs a task on all hosts and then waits for result
>> from everyone before going to the next step. If your task has a loop,
>> there's no way to run the loop synchronously between all nodes,
>> because is a single task with multiple options.
>>
>> You can split the commands in several shell tasks, instead one with a loop.
>>
>> Luca
>>
>> On Tue, Jun 30, 2020 at 4:04 PM 'Jitender J' via Ansible Project
>>  wrote:
>> >
>> > Hi Team,
>> >
>> > I want to run multiple commands in shell module, but i want to run 1st 
>> > command on each hosts than move to next command on each host than third 
>> > and so on, so that i can get output of same command together from all host 
>> > at single place, tried with loop (with_item)
>> > but no luck, need help
>> >
>> > Thanks
>> > jitender
>> >
>> > --
>> > 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 view this discussion on the web visit 
>> > https://groups.google.com/d/msgid/ansible-project/efe49a15-80e6-4d37-aab6-44793d1d4c58n%40googlegroups.com.
>>
>>
>>
>> --
>> "E' assurdo impiegare gli uomini di intelligenza eccellente per fare
>> calcoli che potrebbero essere affidati a chiunque se si usassero delle
>> macchine"
>> Gottfried Wilhelm von Leibnitz, Filosofo e Matematico (1646-1716)
>>
>> "Internet è la più grande biblioteca del mondo.
>> Ma il problema è che i libri sono tutti sparsi sul pavimento"
>> John Allen Paulos, Matematico (1945-vivente)
>>
>> Luca 'remix_tj' Lorenzetto, http://www.remixtj.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 view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/CAKuX69pb9XuqTd%2Bieoit-GVQOF0BGvPjFVrioRvawut6Uc%3DDrw%40mail.gmail.com.
>
>
>
> --
> Regards,
> Jitender
>
> --
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/CAMO4JZtPxnaoGxJ6NTTr-EuLpQV9jwWt7ME75t-0Z%3DcjXq%2BKkA%40mail.gmail.com.



-- 
"E' assurdo impiegare gli uomini di intelligenza eccellente per fare
calcoli che potrebbero essere affidati a chiunque se si usassero delle
macchine"
Gottfried Wilhelm von Leibnitz, Filosofo e Matematico (1646-1716)

"Internet è la più grande biblioteca del mondo.
Ma il problema è che i libri sono tutti sparsi sul pavimento"
John Allen Paulos, Matematico (1945-vivente)

Luca 'remix_tj' Lorenzetto, http://www.remixtj.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAKuX69pe5QnS6X7eH-qT%3Dhv1DYt0nwVagw-fiK8atx6DRjUmuw%40mail.gmail.com.


Re: [ansible-project] Run Command On Each Host

2020-06-30 Thread 'Jitender J' via Ansible Project
Thanks for the update, i''ll try using multiple shell tasks, also can you
please let me know how to make ansible not to print commands only print
output of command


On Tue, Jun 30, 2020 at 7:44 PM Luca 'remix_tj' Lorenzetto <
lorenzetto.l...@gmail.com> wrote:

> Hello,
>
> ansible by default runs a task on all hosts and then waits for result
> from everyone before going to the next step. If your task has a loop,
> there's no way to run the loop synchronously between all nodes,
> because is a single task with multiple options.
>
> You can split the commands in several shell tasks, instead one with a loop.
>
> Luca
>
> On Tue, Jun 30, 2020 at 4:04 PM 'Jitender J' via Ansible Project
>  wrote:
> >
> > Hi Team,
> >
> > I want to run multiple commands in shell module, but i want to run 1st
> command on each hosts than move to next command on each host than third and
> so on, so that i can get output of same command together from all host at
> single place, tried with loop (with_item)
> > but no luck, need help
> >
> > Thanks
> > jitender
> >
> > --
> > 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/efe49a15-80e6-4d37-aab6-44793d1d4c58n%40googlegroups.com
> .
>
>
>
> --
> "E' assurdo impiegare gli uomini di intelligenza eccellente per fare
> calcoli che potrebbero essere affidati a chiunque se si usassero delle
> macchine"
> Gottfried Wilhelm von Leibnitz, Filosofo e Matematico (1646-1716)
>
> "Internet è la più grande biblioteca del mondo.
> Ma il problema è che i libri sono tutti sparsi sul pavimento"
> John Allen Paulos, Matematico (1945-vivente)
>
> Luca 'remix_tj' Lorenzetto, http://www.remixtj.net , <
> lorenzetto.l...@gmail.com>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAKuX69pb9XuqTd%2Bieoit-GVQOF0BGvPjFVrioRvawut6Uc%3DDrw%40mail.gmail.com
> .
>


-- 

*Regards,*
*Jitender*

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAMO4JZtPxnaoGxJ6NTTr-EuLpQV9jwWt7ME75t-0Z%3DcjXq%2BKkA%40mail.gmail.com.


Re: [ansible-project] Run Command On Each Host

2020-06-30 Thread Luca 'remix_tj' Lorenzetto
Hello,

ansible by default runs a task on all hosts and then waits for result
from everyone before going to the next step. If your task has a loop,
there's no way to run the loop synchronously between all nodes,
because is a single task with multiple options.

You can split the commands in several shell tasks, instead one with a loop.

Luca

On Tue, Jun 30, 2020 at 4:04 PM 'Jitender J' via Ansible Project
 wrote:
>
> Hi Team,
>
> I want to run multiple commands in shell module, but i want to run 1st 
> command on each hosts than move to next command on each host than third and 
> so on, so that i can get output of same command together from all host at 
> single place, tried with loop (with_item)
> but no luck, need help
>
> Thanks
> jitender
>
> --
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/efe49a15-80e6-4d37-aab6-44793d1d4c58n%40googlegroups.com.



-- 
"E' assurdo impiegare gli uomini di intelligenza eccellente per fare
calcoli che potrebbero essere affidati a chiunque se si usassero delle
macchine"
Gottfried Wilhelm von Leibnitz, Filosofo e Matematico (1646-1716)

"Internet è la più grande biblioteca del mondo.
Ma il problema è che i libri sono tutti sparsi sul pavimento"
John Allen Paulos, Matematico (1945-vivente)

Luca 'remix_tj' Lorenzetto, http://www.remixtj.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAKuX69pb9XuqTd%2Bieoit-GVQOF0BGvPjFVrioRvawut6Uc%3DDrw%40mail.gmail.com.


[ansible-project] Run Command On Each Host

2020-06-30 Thread 'Jitender J' via Ansible Project
Hi Team,

I want to run multiple commands in shell module, but i want to run 1st 
command on each hosts than move to next command on each host than third and 
so on, so that i can get output of same command together from all host at 
single place, tried with loop (with_item)
but no luck, need help 

Thanks
jitender

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/efe49a15-80e6-4d37-aab6-44793d1d4c58n%40googlegroups.com.


Re: [ansible-project] Re: string not recognised in groups_vars/all

2020-06-30 Thread Srinivas Naram
Check out the syntax of 'all' file. I feel the indentation is not right.

On Tue, Jun 30, 2020 at 5:29 PM Johana Galarza Monta 
wrote:

> but that doesnt't respond to my answer on why this works when it is in the
> playbook... and not when it is in groups-vars
>
> On Tuesday, 30 June 2020 12:28:56 UTC+2, Johana Galarza Monta wrote:
>>
>> I have a the below in my groups vars, and in a role I am trying to add a
>> conditional on `module-a` such as when: " 'module-a' in module" but keeps
>> throwing me this error
>>
>> {"msg": "The conditional check ' 'module-a' in modules' failed. The error
>> was: error while evaluating conditional ( 'module-a' in modules): Unable to
>> look up a name or access an attribute in template string ({% if  'module-a
>> in modules %} True {% else %} False {% endif %}).\nMake sure your variable
>> name does not contain invalid characters like '-': argument of type
>> 'AnsibleUndefined' is not iterable.
>>
>>  but somehow it works when I put this in the playbook itself...
>>
>> Did anyone had such an issue? Or any idea why this works on the
>> playbook but not under gorup_vars/all...??
>>
>>  vars:
>>  module:
>> - module-a
>>
>>
>>
>> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/e22740d1-18cb-4918-ae95-2f3df3ed0f21o%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAG-N3P6RF-aU7wo5UP_JnSt1toJuc3uAJ9B194aQxs%2B5x6i56A%40mail.gmail.com.


[ansible-project] Re: string not recognised in groups_vars/all

2020-06-30 Thread Johana Galarza Monta
but that doesnt't respond to my answer on why this works when it is in the 
playbook... and not when it is in groups-vars

On Tuesday, 30 June 2020 12:28:56 UTC+2, Johana Galarza Monta wrote:
>
> I have a the below in my groups vars, and in a role I am trying to add a 
> conditional on `module-a` such as when: " 'module-a' in module" but keeps 
> throwing me this error
>
> {"msg": "The conditional check ' 'module-a' in modules' failed. The error 
> was: error while evaluating conditional ( 'module-a' in modules): Unable to 
> look up a name or access an attribute in template string ({% if  'module-a 
> in modules %} True {% else %} False {% endif %}).\nMake sure your variable 
> name does not contain invalid characters like '-': argument of type 
> 'AnsibleUndefined' is not iterable.
>
>  but somehow it works when I put this in the playbook itself...
>
> Did anyone had such an issue? Or any idea why this works on the 
> playbook but not under gorup_vars/all...??
>
>  vars:
>  module:
> - module-a
>  
>
>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e22740d1-18cb-4918-ae95-2f3df3ed0f21o%40googlegroups.com.


[ansible-project] How to break "until" loop when some conditions meet?

2020-06-30 Thread xiang chen


### SUMMARY
I need to call one api to get async result, the api result is like

{ "resultCode": 0, "resultInfo": "cutover is running", "taskStatus": "21" }

when taskStatus is 21 means the tasks is running, I should wait and contnue 
to get the result until the taskStatus becomes 20 that means success, but 
when the taskStatus is 22 means the api fails, and I should break the loop 
call. But I found that I cann't use fail_when with uri module at the same 
time. So how can I do to continue checking the result for 30min when the 
result is running and quit when the result is fail?

Here is my task:

- uri:
url: "http://10.xx.xx.xx/api/task/verify/;
follow_redirects: all
method: GET
return_content: yes
status_code: 200
timeout: 300
body: '{"hostname": "{{check_box.hostname}}"}' #my variable , but doesn't 
matter
body_format: json
headers:
  Content-Type: "application/json"
  register: current_status
  until:
- current_status.json.taskStatus == 20
  retries: 180 # try 30 min
  delay: 10

ISSUE TYPE
   
   - Documentation Report

COMPONENT NAMEANSIBLE VERSION

ansible 2.9.10

CONFIGURATION

OS / ENVIRONMENT

CentOS Linux release 7.6.1810 (Core)

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/372c-9e72-4483-9ae0-af40f19293bao%40googlegroups.com.


[ansible-project] Add Additional Ip Addresses to an interface.

2020-06-30 Thread Paul Robinson
Firstly just to say I'm new to ansible and learning as I go along.

I have configure a playbook that clones 3 virtual machines using the 
following inventory file which has a few custom variables added for my needs

ansible-playbook -i vms-to-deploy deploy_sap_vm.yml

vms-to-deploy
[netweaver]
prcsapnwd01 deploy_vsphere_datastore='datastore2' 
guest_custom_ip='10.0.14.20' sap_sid='NWD' 
virtual_alias_ip='10.0.14.21,10.0.14.22,10.0.14.23'
prcsapnwq01 deploy_vsphere_datastore='datastore2' 
guest_custom_ip='10.0.14.30' sap_sid='NWQ' 
virtual_alias_ip='10.0.14.31,10.0.14.32,10.0.14.33'
prcsapnwp01 deploy_vsphere_datastore='datastore2' 
guest_custom_ip='10.0.14.40' sap_sid='NWP' 
virtual_alias_ip='10.0.14.41,10.0.14.32,10.0.14.43'

I have successfully managed to clone the vm's using vmware_guest role which 
then customizes the virtual machines and assigns the guest_custom_ip to be 
the ip of the physical interface eth0

The next task I want to perform is to add additional ip addresses to that 
adapter eth0 so for example in the case of host prcsapnwd01 eth0 has

eth0:
10.0.14.20 (Phsyical Host)
10.0.14.21 (Virtual Alias IP)
10.0.14.22 (Virtual Alias IP)
10.0.14.23 (Virtual Alias IP)

The linux-system-roles.network looks like it can do the job for me.

I am just not sure how i go about reading the additional ip addresses from 
my inventory file and passing them to the task variables.

Any help would be appreciated. 

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b73d8815-791b-43d2-9a6a-bcefc313a80eo%40googlegroups.com.


Re: [ansible-project] string not recognised in groups_vars/all

2020-06-30 Thread Jean-Yves LENHOF

Dot, dash are operators in python on which ansible is based...

It is not a good idea to use them, but if you use them, there is some 
notices about it here :


https://docs.ansible.com/ansible/latest/reference_appendices/faq.html

And there are issue :

https://github.com/ansible/ansible/issues/56930

So please, do not used them in variables... It should save you times

Regards,


Le 30/06/2020 à 12:28, Johana Galarza Monta a écrit :
I have a the below in my groups vars, and in a role I am trying to add 
a conditional on `module-a` such as when: " 'module-a' in module" but 
keeps throwing me this error


{"msg": "The conditional check ' 'module-a' in modules' failed. The 
error was: error while evaluating conditional ( 'module-a' in 
modules): Unable to look up a name or access an attribute in template 
string ({% if  'module-a in modules %} True {% else %} False {% endif 
%}).\nMake sure your variable name does not contain invalid characters 
like '-': argument of type 'AnsibleUndefined' is not iterable.


 but somehow it works when I put this in the playbook itself...

Did anyone had such an issue? Or any idea why this works on the 
playbook but not under gorup_vars/all...??


vars:
module:
- module-a
--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a094e83f-bd27-402a-9b73-ccbc9f6d5058o%40googlegroups.com 
.


--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/edb4a672-926e-bf53-b2bf-8fb844919002%40lenhof.eu.org.


[ansible-project] string not recognised in groups_vars/all

2020-06-30 Thread Johana Galarza Monta
I have a the below in my groups vars, and in a role I am trying to add a 
conditional on `module-a` such as when: " 'module-a' in module" but keeps 
throwing me this error

{"msg": "The conditional check ' 'module-a' in modules' failed. The error 
was: error while evaluating conditional ( 'module-a' in modules): Unable to 
look up a name or access an attribute in template string ({% if  'module-a 
in modules %} True {% else %} False {% endif %}).\nMake sure your variable 
name does not contain invalid characters like '-': argument of type 
'AnsibleUndefined' is not iterable.

 but somehow it works when I put this in the playbook itself...

Did anyone had such an issue? Or any idea why this works on the 
playbook but not under gorup_vars/all...??

 vars:
 module:
- module-a
 


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a094e83f-bd27-402a-9b73-ccbc9f6d5058o%40googlegroups.com.


Re: [ansible-project] Combine dictionaries based on a dictionary key value.

2020-06-30 Thread 'Felix Fontein' via Ansible Project
Hi,

a new lookup plugin was proposed for community.general which would help
with this:
https://github.com/ansible-collections/community.general/pull/263

We're currently trying to evaluate whether this plugin would be useful
to the community. Feel free to comment there (or try it out!).

Cheers,
Felix




On Mon, 29 Jun 2020 13:22:05 -0700 (PDT)
Adam McGill  wrote:

> Hello,
> Basically want to add the items of net_interface into aggregate_info
> or create new dictionary based on key value of node_name.  Looking
> for assistance on how i can achieve this please and thank you.
> 
> *Dictionary called: aggregate_info*
> {
>   "name": "agg_Data1_Cluster01",
>"node_name": "TEST_NA_CLUSTER_01-01",
>"percent_used_capacity": "46",
>"size_available": 8141263818752,
>"size_avaliable_80%": 5122753242726,
>"size_total": 15092552880128,
>"size_total_80%": 12074042304102,
>"size_used": 6951289061376
> },
> {
>"name": "agg_Data1_Cluster02",
>"node_name": "TEST_NA_CLUSTER_01-02",
>"percent_used_capacity": "34",
>"size_available": 5116275568640,
>"size_avaliable_80%": 3561215869747,
>"size_total": 7775298494464,
>"size_total_80%": 6220238795571,
>"size_used": 2659022925824
> }
> 
> *Dictionary called: net_interface*
> {
> "address": "XX.XXX.X.XXX",
> "address4oct": "224",
> "data_protcol": "none",
> "failover_group": "Management",
> "node_name": "TEST_NA_CLUSTER_01-01",
> "role": "node_mgmt",
> "vserver": "TEST_NA_CLUSTER_01"
> },
> {
> "address": "XX.XXX.X.XXX",
> "address4oct": "226",
> "data_protcol": "none",
> "failover_group": "Management",
> "node_name": "IQ-REG_NA_CLUSTER_01-02",
> "role": "node_mgmt",
> "vserver": "TEST_NA_CLUSTER_01"
> }
> 
> 
> *Out Come want:*
> Dictionary called: aggregate_info (original) or new name
> {
>   "name": "agg_Data1_Cluster01",
>"node_name": "TEST_NA_CLUSTER_01-01",
>"percent_used_capacity": "46",
>"size_available": 8141263818752,
>"size_avaliable_80%": 5122753242726,
>"size_total": 15092552880128,
>"size_total_80%": 12074042304102,
>"size_used": 6951289061376
>"address": "XX.XXX.X.XXX",
>"address4oct": "224",
>"data_protcol": "none",
>"failover_group": "Management",
>"role": "node_mgmt",
>"vserver": "TEST_NA_CLUSTER_01"
> },
> {
>"name": "agg_Data1_Cluster02",
>"node_name": "TEST_NA_CLUSTER_01-02",
>"percent_used_capacity": "34",
>"size_available": 5116275568640,
>"size_avaliable_80%": 3561215869747,
>"size_total": 7775298494464,
>"size_total_80%": 6220238795571,
>"size_used": 2659022925824
>"address": "XX.XXX.X.XXX",
>"address4oct": "226",
>"data_protcol": "none",
>"failover_group": "Management",
>"role": "node_mgmt",
>"vserver": "TEST_NA_CLUSTER_01"
> }
> 

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/20200630100014.1eb0deb4%40utsjoki.


Re: [ansible-project] Combine dictionaries based on a dictionary key value.

2020-06-30 Thread Vladimir Botka
On Mon, 29 Jun 2020 13:22:05 -0700 (PDT)
Adam McGill  wrote:

> add the items of net_interface into aggregate_info or 
> create new dictionary based on key value of node_name.

Create dictionaries from the lists

- set_fact:
agg: "{{ agg|default({})|combine({item.node_name: item}) }}"
  loop: "{{ aggregate_info }}"
- set_fact:
net: "{{ net|default({})|combine({item.node_name: item}) }}"
  loop: "{{ net_interface }}"

Then combine the corresponding dictionaries and concatenate the results into
a new list

- set_fact:
aggregate_info2: "{{ aggregate_info2|default([]) +
 [agg[item]|combine(net[item])] }}"
  loop: "{{ agg.keys()|list }}"

HTH,

-vlado

-- 
Vladimir Botka

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/20200630091727.77246fa6%40gmail.com.


pgpRSYG5kbvFs.pgp
Description: OpenPGP digital signature


Re: [ansible-project] Combine dictionaries based on a dictionary key value.

2020-06-30 Thread Vladimir Botka
On Mon, 29 Jun 2020 13:22:05 -0700 (PDT)
Adam McGill  wrote:

> ... add the items ... based on key value of node_name.
> 
> aggregate_info: [
> {
>...
>"node_name": "TEST_NA_CLUSTER_01-01",
>...
> },
> {
>...
>"node_name": "TEST_NA_CLUSTER_01-02",
>...
> }]
> 
> net_interface: [
> {
> ...
> "node_name": "TEST_NA_CLUSTER_01-01",
> ...
> },
> {
> ...
> "node_name": "IQ-REG_NA_CLUSTER_01-02",
> ...
> }]

The values of "node_name" does not correspond. It would be good to test it.
For example

- fail:
msg: Values of node_name(s) do not fit
  when: aggregate_info|map(attribute='node_name')|list|
difference(net_interface|map(attribute='node_name')|list)

-- 
Vladimir Botka

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/20200630084700.2732aa9e%40gmail.com.


pgp5dHi5xonw9.pgp
Description: OpenPGP digital signature