Re: [ansible-project] Issue ---- Module Failure\nSee stdout/stderr

2021-10-14 Thread Dick Visser
The advice given should work.
Please share your exact playbook once again.


On Fri, 15 Oct 2021 at 01:22, Abhijot Singh Kathuria 
wrote:

> Hey Jorge,
>
> Thanks for your reply.
>
> I tried making the inventory to all and adding delegate_to: localhost. No
> luck here.
>
> Still getting the same error message.
>
>
> *Regards,*
> *Abhijot Singh*
>
> *Graduate Student, CIS*
> *Talent Ambassador, Talent Gateway*
> *Community Organizer, Civic Leadership Board*
>
> *  *
>
>
> On Thu, Oct 14, 2021 at 4:11 PM Jorge Rúa  wrote:
>
>> Obviously, you would need to run the join domain task against the newly
>> created VM. To do that you should use delegate_to.
>>
>> I would change your inventory to all, and then on the vmware related
>> tasks use delegate_to: localhost since what is happening behind the scenes
>> are just soap/rest api calls against vcenter.
>>
>> You should also pay attention to the conection plugin.
>>
>> Hope that helps
>>
>> On Fri, Oct 15, 2021, 00:01 Abhijot Singh Kathuria 
>> wrote:
>>
>>> Hey Guys,
>>>
>>> I need some assistance on the below error. I've tried everything but I'm
>>> not able to resolve the same.
>>>
>>> TASK [Join to Domain]
>>> **
>>> task path: /etc/ansible/playbooks/DeployVM/Server2019_Vsphere.yml:46
>>>  ESTABLISH LOCAL CONNECTION FOR USER: administrator
>>>  EXEC /bin/sh -c 'echo ~administrator && sleep 0'
>>>  EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo
>>> /home/administrator/.ansible/tmp `"&& mkdir "` echo
>>> /home/administrator/.ansible/tmp/ansible-tmp-1634251564.5118623-32501-66747911642149
>>> `" && echo ansible-tmp-1634251564.5118623-32501-66747911642149="` echo
>>> /home/administrator/.ansible/tmp/ansible-tmp-1634251564.5118623-32501-66747911642149
>>> `" ) && sleep 0'
>>> Using module file
>>> /home/administrator/.ansible/collections/ansible_collections/ansible/windows/plugins/modules/win_domain_membership.ps1
>>>  PUT
>>> /home/administrator/.ansible/tmp/ansible-local-324573ec1oxrx/tmp_rkwbrs9 TO
>>> /home/administrator/.ansible/tmp/ansible-tmp-1634251564.5118623-32501-66747911642149/AnsiballZ_win_domain_membership.ps1
>>>  EXEC /bin/sh -c 'chmod u+x
>>> /home/administrator/.ansible/tmp/ansible-tmp-1634251564.5118623-32501-66747911642149/
>>> /home/administrator/.ansible/tmp/ansible-tmp-1634251564.5118623-32501-66747911642149/AnsiballZ_win_domain_membership.ps1
>>> && sleep 0'
>>>  EXEC /bin/sh -c 'powershell
>>> /home/administrator/.ansible/tmp/ansible-tmp-1634251564.5118623-32501-66747911642149/AnsiballZ_win_domain_membership.ps1
>>> && sleep 0'
>>>  EXEC /bin/sh -c 'rm -f -r
>>> /home/administrator/.ansible/tmp/ansible-tmp-1634251564.5118623-32501-66747911642149/
>>> > /dev/null 2>&1 && sleep 0'
>>> fatal: [localhost]: FAILED! => {
>>> "changed": false,
>>> "module_stderr": "\u001b[91mParserError:
>>> \u001b[0m/home/administrator/.ansible/tmp/ansible-tmp-1634251564.5118623-32501-66747911642149/AnsiballZ_win_domain_membership.ps1:151\n\u001b[96mLine
>>> |\n\u001b[96m 151 | \u001b[0m
>>> \u001b[96m\u\u001b[0m\u\u\u{\"module_entry\":
>>> \"IyFwb3dlcnNoZWxsCgojIENvcHlyaWdodDogKGMpIDIwMTc …\n\u001b[96m |
>>> \u001b[91m ~\n\u001b[91m\u001b[96m | \u001b[91munexpected token
>>> '\u', expected 'begin', 'process', 'end', or\n\u001b[96m |
>>> \u001b[91m'dynamicparam'.\n\u001b[0m\n",
>>> "module_stdout": "",
>>> "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
>>> "rc": 1
>>> }
>>>
>>> PLAY RECAP
>>> *
>>> localhost  : ok=1changed=1unreachable=0
>>> failed=1skipped=0rescued=0ignored=0
>>>
>>>
>>>
>>> So technically I'm trying to spin a VM in vSphere and connect that Vm to
>>> domain using Ansible and below is what my playbook looks like:
>>>
>>> ---
>>> - hosts: localhost
>>>   gather_facts: False
>>>   connection: local
>>>   user: remote
>>>
>>> ##Variables
>>>
>>>
>>>   vars_files:
>>> - /etc/ansible/vars/hosts_vars.yml
>>>
>>>
>>> ##TASKS
>>>
>>>   tasks:
>>>   - name: Clone the template
>>> vmware_guest:
>>>   hostname: "{{ vcenter_server }}"
>>>   username: "{{ vcenter_user }}"
>>>   password: "{{ vcenter_pass }}"
>>>   validate_certs: False
>>>   name: ans-dv4-test1
>>>   state: powered-on
>>>   notes: "{{ vars_notes }}"
>>>   template: WinServer2019-Golden-Oct21
>>>   datacenter: "{{ datacenter_name }}"
>>>   folder: New-Deployments
>>>   cluster: "{{ cluster_name }}"
>>>   disk:
>>> - size_gb: "{{ disk_size | default(60) }}"
>>>   type: thin
>>>   datastore: "HQ_Unity1_Datastore-06"
>>>   networks:
>>> - name: VM Network
>>>   type: dhcp
>>>   allow_guest_control: True
>>>   

[ansible-project] the task includes an option with an undefined variable. The error was: 'dict object' has no attribute

2021-10-14 Thread barioua...@gmail.com
Hello Team,

I have spent a lot of time trying troubleshoot this issue.
I have a roles with defined variable
 This is inside defaults/main.yml
nessus_agent_package:
  - redhat7:
  - al2: ./files/NessusAgent-8.3.1-amzn.x86_64.rpm
  - al1:
 and my tasks main.yml has an include which will identify the server and 
include an appropriate files inside
- name: include distribution specific install YAML files
  include: "{{ ansible_distribution }}.yml"

Those files are present on tasks level
-rw-r--r--. 1 root root  740 Oct  5 20:49 Amazon.yml
-rw-r--r--. 1 root root  260 Oct  5 08:41 Debian.yml
-rw-r--r--. 1 root root 1024 Oct  5 07:39 main.yml
-rw-r--r--. 1 root root 1040 Oct  5 08:55 RedHat.yml
-rw-r--r--. 1 root root 1031 Oct  5 08:57 SUSE.yml
-rw-r--r--. 1 root root  260 Oct  5 08:02 Ubuntu.yml


Now I'm deploying the code inside an Amazon EC2 Linux 2 system which after 
gather the facts was routed to select Amazon.yml file. 

---
# ./roles/tenableagent/tasks/amazon.yml
- name: Install Nessus Agent for Amzon 2 from repo
  package:
name: "{{ item.al2 }}"
update_cache: yes
cache_valid_time: "{{apt_cache_valid_time | default (omit)}}"
  loop: "{{ nessus_agent_package }}"
  when: ansible_facts['distribution'] == "Amazon" and 
ansible_facts['distribution_major_version'] == "2")"


.Now when running the playbooks. I'm getting bellow error. Please can you 
help me out

PLAY [all] 
***

TASK [Gathering Facts] 
***
[WARNING]: Platform linux on host ec2-52-91-173-242.compute-1.amazonaws.com 
is using the discovered Python interpreter at /usr/bin/python, but future 
installation of another Python interpreter could change
this. See 
https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html
 
for more information.
ok: [ec2-52-91-173-242.compute-1.amazonaws.com]

TASK [tenableagent : include distribution specific install YAML files] 
***
included: /root/nessus-agent/roles/tenableagent/tasks/Amazon.yml for 
ec2-52-91-173-242.compute-1.amazonaws.com

TASK [tenableagent : Install Nessus Agent for Amzon 2 from repo] 
*
fatal: [ec2-52-91-173-242.compute-1.amazonaws.com]: FAILED! => {"msg": "The 
task includes an option with an undefined variable. The error was: 'dict 
object' has no attribute 'al2'\n\nThe error appears to be in 
'/root/nessus-agent/roles/tenableagent/tasks/Amazon.yml': line 3, column 3, 
but may\nbe elsewhere in the file depending on the exact syntax 
problem.\n\nThe offending line appears to be:\n\n# 
./roles/tenableagent/tasks/amazon.yml\n- name: Install Nessus Agent for 
Amzon 2 from repo\n  ^ here\n"}

PLAY RECAP 
***
ec2-52-91-173-242.compute-1.amazonaws.com : ok=2changed=0
unreachable=0failed=1skipped=0rescued=0ignored=0

-- 
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/5eafe96b-beb2-4b61-b735-058e9e43128cn%40googlegroups.com.


Re: [ansible-project] Issue ---- Module Failure\nSee stdout/stderr

2021-10-14 Thread Abhijot Singh Kathuria
Hey Jorge,

Thanks for your reply.

I tried making the inventory to all and adding delegate_to: localhost. No
luck here.

Still getting the same error message.


*Regards,*
*Abhijot Singh*

*Graduate Student, CIS*
*Talent Ambassador, Talent Gateway*
*Community Organizer, Civic Leadership Board*

*  *


On Thu, Oct 14, 2021 at 4:11 PM Jorge Rúa  wrote:

> Obviously, you would need to run the join domain task against the newly
> created VM. To do that you should use delegate_to.
>
> I would change your inventory to all, and then on the vmware related tasks
> use delegate_to: localhost since what is happening behind the scenes are
> just soap/rest api calls against vcenter.
>
> You should also pay attention to the conection plugin.
>
> Hope that helps
>
> On Fri, Oct 15, 2021, 00:01 Abhijot Singh Kathuria 
> wrote:
>
>> Hey Guys,
>>
>> I need some assistance on the below error. I've tried everything but I'm
>> not able to resolve the same.
>>
>> TASK [Join to Domain]
>> **
>> task path: /etc/ansible/playbooks/DeployVM/Server2019_Vsphere.yml:46
>>  ESTABLISH LOCAL CONNECTION FOR USER: administrator
>>  EXEC /bin/sh -c 'echo ~administrator && sleep 0'
>>  EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo
>> /home/administrator/.ansible/tmp `"&& mkdir "` echo
>> /home/administrator/.ansible/tmp/ansible-tmp-1634251564.5118623-32501-66747911642149
>> `" && echo ansible-tmp-1634251564.5118623-32501-66747911642149="` echo
>> /home/administrator/.ansible/tmp/ansible-tmp-1634251564.5118623-32501-66747911642149
>> `" ) && sleep 0'
>> Using module file
>> /home/administrator/.ansible/collections/ansible_collections/ansible/windows/plugins/modules/win_domain_membership.ps1
>>  PUT
>> /home/administrator/.ansible/tmp/ansible-local-324573ec1oxrx/tmp_rkwbrs9 TO
>> /home/administrator/.ansible/tmp/ansible-tmp-1634251564.5118623-32501-66747911642149/AnsiballZ_win_domain_membership.ps1
>>  EXEC /bin/sh -c 'chmod u+x
>> /home/administrator/.ansible/tmp/ansible-tmp-1634251564.5118623-32501-66747911642149/
>> /home/administrator/.ansible/tmp/ansible-tmp-1634251564.5118623-32501-66747911642149/AnsiballZ_win_domain_membership.ps1
>> && sleep 0'
>>  EXEC /bin/sh -c 'powershell
>> /home/administrator/.ansible/tmp/ansible-tmp-1634251564.5118623-32501-66747911642149/AnsiballZ_win_domain_membership.ps1
>> && sleep 0'
>>  EXEC /bin/sh -c 'rm -f -r
>> /home/administrator/.ansible/tmp/ansible-tmp-1634251564.5118623-32501-66747911642149/
>> > /dev/null 2>&1 && sleep 0'
>> fatal: [localhost]: FAILED! => {
>> "changed": false,
>> "module_stderr": "\u001b[91mParserError:
>> \u001b[0m/home/administrator/.ansible/tmp/ansible-tmp-1634251564.5118623-32501-66747911642149/AnsiballZ_win_domain_membership.ps1:151\n\u001b[96mLine
>> |\n\u001b[96m 151 | \u001b[0m
>> \u001b[96m\u\u001b[0m\u\u\u{\"module_entry\":
>> \"IyFwb3dlcnNoZWxsCgojIENvcHlyaWdodDogKGMpIDIwMTc …\n\u001b[96m |
>> \u001b[91m ~\n\u001b[91m\u001b[96m | \u001b[91munexpected token
>> '\u', expected 'begin', 'process', 'end', or\n\u001b[96m |
>> \u001b[91m'dynamicparam'.\n\u001b[0m\n",
>> "module_stdout": "",
>> "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
>> "rc": 1
>> }
>>
>> PLAY RECAP
>> *
>> localhost  : ok=1changed=1unreachable=0
>> failed=1skipped=0rescued=0ignored=0
>>
>>
>>
>> So technically I'm trying to spin a VM in vSphere and connect that Vm to
>> domain using Ansible and below is what my playbook looks like:
>>
>> ---
>> - hosts: localhost
>>   gather_facts: False
>>   connection: local
>>   user: remote
>>
>> ##Variables
>>
>>
>>   vars_files:
>> - /etc/ansible/vars/hosts_vars.yml
>>
>>
>> ##TASKS
>>
>>   tasks:
>>   - name: Clone the template
>> vmware_guest:
>>   hostname: "{{ vcenter_server }}"
>>   username: "{{ vcenter_user }}"
>>   password: "{{ vcenter_pass }}"
>>   validate_certs: False
>>   name: ans-dv4-test1
>>   state: powered-on
>>   notes: "{{ vars_notes }}"
>>   template: WinServer2019-Golden-Oct21
>>   datacenter: "{{ datacenter_name }}"
>>   folder: New-Deployments
>>   cluster: "{{ cluster_name }}"
>>   disk:
>> - size_gb: "{{ disk_size | default(60) }}"
>>   type: thin
>>   datastore: "HQ_Unity1_Datastore-06"
>>   networks:
>> - name: VM Network
>>   type: dhcp
>>   allow_guest_control: True
>>   wait_for_ip_address: True
>>
>>   hardware:
>>   memory_mb: "{{ vm_memory | default(4096) }}"
>>   num_cpus: "2"
>>
>> ##Conncecting to Domain
>>
>>   - name: Join to Domain
>> ansible.windows.win_domain_membership:
>>   dns_domain_name: "{{ dxu_domain 

Re: [ansible-project] Issue ---- Module Failure\nSee stdout/stderr

2021-10-14 Thread Jorge Rúa
Obviously, you would need to run the join domain task against the newly
created VM. To do that you should use delegate_to.

I would change your inventory to all, and then on the vmware related tasks
use delegate_to: localhost since what is happening behind the scenes are
just soap/rest api calls against vcenter.

You should also pay attention to the conection plugin.

Hope that helps

On Fri, Oct 15, 2021, 00:01 Abhijot Singh Kathuria 
wrote:

> Hey Guys,
>
> I need some assistance on the below error. I've tried everything but I'm
> not able to resolve the same.
>
> TASK [Join to Domain]
> **
> task path: /etc/ansible/playbooks/DeployVM/Server2019_Vsphere.yml:46
>  ESTABLISH LOCAL CONNECTION FOR USER: administrator
>  EXEC /bin/sh -c 'echo ~administrator && sleep 0'
>  EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo
> /home/administrator/.ansible/tmp `"&& mkdir "` echo
> /home/administrator/.ansible/tmp/ansible-tmp-1634251564.5118623-32501-66747911642149
> `" && echo ansible-tmp-1634251564.5118623-32501-66747911642149="` echo
> /home/administrator/.ansible/tmp/ansible-tmp-1634251564.5118623-32501-66747911642149
> `" ) && sleep 0'
> Using module file
> /home/administrator/.ansible/collections/ansible_collections/ansible/windows/plugins/modules/win_domain_membership.ps1
>  PUT
> /home/administrator/.ansible/tmp/ansible-local-324573ec1oxrx/tmp_rkwbrs9 TO
> /home/administrator/.ansible/tmp/ansible-tmp-1634251564.5118623-32501-66747911642149/AnsiballZ_win_domain_membership.ps1
>  EXEC /bin/sh -c 'chmod u+x
> /home/administrator/.ansible/tmp/ansible-tmp-1634251564.5118623-32501-66747911642149/
> /home/administrator/.ansible/tmp/ansible-tmp-1634251564.5118623-32501-66747911642149/AnsiballZ_win_domain_membership.ps1
> && sleep 0'
>  EXEC /bin/sh -c 'powershell
> /home/administrator/.ansible/tmp/ansible-tmp-1634251564.5118623-32501-66747911642149/AnsiballZ_win_domain_membership.ps1
> && sleep 0'
>  EXEC /bin/sh -c 'rm -f -r
> /home/administrator/.ansible/tmp/ansible-tmp-1634251564.5118623-32501-66747911642149/
> > /dev/null 2>&1 && sleep 0'
> fatal: [localhost]: FAILED! => {
> "changed": false,
> "module_stderr": "\u001b[91mParserError:
> \u001b[0m/home/administrator/.ansible/tmp/ansible-tmp-1634251564.5118623-32501-66747911642149/AnsiballZ_win_domain_membership.ps1:151\n\u001b[96mLine
> |\n\u001b[96m 151 | \u001b[0m
> \u001b[96m\u\u001b[0m\u\u\u{\"module_entry\":
> \"IyFwb3dlcnNoZWxsCgojIENvcHlyaWdodDogKGMpIDIwMTc …\n\u001b[96m |
> \u001b[91m ~\n\u001b[91m\u001b[96m | \u001b[91munexpected token
> '\u', expected 'begin', 'process', 'end', or\n\u001b[96m |
> \u001b[91m'dynamicparam'.\n\u001b[0m\n",
> "module_stdout": "",
> "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
> "rc": 1
> }
>
> PLAY RECAP
> *
> localhost  : ok=1changed=1unreachable=0
> failed=1skipped=0rescued=0ignored=0
>
>
>
> So technically I'm trying to spin a VM in vSphere and connect that Vm to
> domain using Ansible and below is what my playbook looks like:
>
> ---
> - hosts: localhost
>   gather_facts: False
>   connection: local
>   user: remote
>
> ##Variables
>
>
>   vars_files:
> - /etc/ansible/vars/hosts_vars.yml
>
>
> ##TASKS
>
>   tasks:
>   - name: Clone the template
> vmware_guest:
>   hostname: "{{ vcenter_server }}"
>   username: "{{ vcenter_user }}"
>   password: "{{ vcenter_pass }}"
>   validate_certs: False
>   name: ans-dv4-test1
>   state: powered-on
>   notes: "{{ vars_notes }}"
>   template: WinServer2019-Golden-Oct21
>   datacenter: "{{ datacenter_name }}"
>   folder: New-Deployments
>   cluster: "{{ cluster_name }}"
>   disk:
> - size_gb: "{{ disk_size | default(60) }}"
>   type: thin
>   datastore: "HQ_Unity1_Datastore-06"
>   networks:
> - name: VM Network
>   type: dhcp
>   allow_guest_control: True
>   wait_for_ip_address: True
>
>   hardware:
>   memory_mb: "{{ vm_memory | default(4096) }}"
>   num_cpus: "2"
>
> ##Conncecting to Domain
>
>   - name: Join to Domain
> ansible.windows.win_domain_membership:
>   dns_domain_name: "{{ dxu_domain }}"
>   hostname: ans-dv4-test1
>   domain_admin_user: "{{ vcenter_user }}"
>   domain_admin_password: "{{vcenter_pass }}"
>   domain_ou_path: "{{ ou_path }}"
>   state: domain
> register: domain_state
>
> ##Reboot the machine after joining to Domain
>
>   - name: Reboot after Domain Join
> ansible.windows.win_reboot:
> when: domain_state.reboot_required
>
>
>
>
>
> The inventory file just has "localhost" defined in it.
>
> Can someone please advise!
>
>
>
>
> --
> You received this 

[ansible-project] Issue ---- Module Failure\nSee stdout/stderr

2021-10-14 Thread Abhijot Singh Kathuria
Hey Guys,

I need some assistance on the below error. I've tried everything but I'm 
not able to resolve the same.

TASK [Join to Domain] 
**
task path: /etc/ansible/playbooks/DeployVM/Server2019_Vsphere.yml:46
 ESTABLISH LOCAL CONNECTION FOR USER: administrator
 EXEC /bin/sh -c 'echo ~administrator && sleep 0'
 EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo 
/home/administrator/.ansible/tmp `"&& mkdir "` echo 
/home/administrator/.ansible/tmp/ansible-tmp-1634251564.5118623-32501-66747911642149
 
`" && echo ansible-tmp-1634251564.5118623-32501-66747911642149="` echo 
/home/administrator/.ansible/tmp/ansible-tmp-1634251564.5118623-32501-66747911642149
 
`" ) && sleep 0'
Using module file 
/home/administrator/.ansible/collections/ansible_collections/ansible/windows/plugins/modules/win_domain_membership.ps1
 PUT 
/home/administrator/.ansible/tmp/ansible-local-324573ec1oxrx/tmp_rkwbrs9 TO 
/home/administrator/.ansible/tmp/ansible-tmp-1634251564.5118623-32501-66747911642149/AnsiballZ_win_domain_membership.ps1
 EXEC /bin/sh -c 'chmod u+x 
/home/administrator/.ansible/tmp/ansible-tmp-1634251564.5118623-32501-66747911642149/
 
/home/administrator/.ansible/tmp/ansible-tmp-1634251564.5118623-32501-66747911642149/AnsiballZ_win_domain_membership.ps1
 
&& sleep 0'
 EXEC /bin/sh -c 'powershell 
/home/administrator/.ansible/tmp/ansible-tmp-1634251564.5118623-32501-66747911642149/AnsiballZ_win_domain_membership.ps1
 
&& sleep 0'
 EXEC /bin/sh -c 'rm -f -r 
/home/administrator/.ansible/tmp/ansible-tmp-1634251564.5118623-32501-66747911642149/
 
> /dev/null 2>&1 && sleep 0'
fatal: [localhost]: FAILED! => {
"changed": false,
"module_stderr": "\u001b[91mParserError: 
\u001b[0m/home/administrator/.ansible/tmp/ansible-tmp-1634251564.5118623-32501-66747911642149/AnsiballZ_win_domain_membership.ps1:151\n\u001b[96mLine
 
|\n\u001b[96m 151 | \u001b[0m 
\u001b[96m\u\u001b[0m\u\u\u{\"module_entry\": 
\"IyFwb3dlcnNoZWxsCgojIENvcHlyaWdodDogKGMpIDIwMTc …\n\u001b[96m | 
\u001b[91m ~\n\u001b[91m\u001b[96m | \u001b[91munexpected token 
'\u', expected 'begin', 'process', 'end', or\n\u001b[96m | 
\u001b[91m'dynamicparam'.\n\u001b[0m\n",
"module_stdout": "",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
}

PLAY RECAP 
*
localhost  : ok=1changed=1unreachable=0
failed=1skipped=0rescued=0ignored=0



So technically I'm trying to spin a VM in vSphere and connect that Vm to 
domain using Ansible and below is what my playbook looks like:

---
- hosts: localhost
  gather_facts: False
  connection: local
  user: remote

##Variables


  vars_files:
- /etc/ansible/vars/hosts_vars.yml


##TASKS

  tasks:
  - name: Clone the template
vmware_guest:
  hostname: "{{ vcenter_server }}"
  username: "{{ vcenter_user }}"
  password: "{{ vcenter_pass }}"
  validate_certs: False
  name: ans-dv4-test1
  state: powered-on
  notes: "{{ vars_notes }}"
  template: WinServer2019-Golden-Oct21
  datacenter: "{{ datacenter_name }}"
  folder: New-Deployments
  cluster: "{{ cluster_name }}"
  disk:
- size_gb: "{{ disk_size | default(60) }}"
  type: thin
  datastore: "HQ_Unity1_Datastore-06"
  networks:
- name: VM Network
  type: dhcp
  allow_guest_control: True
  wait_for_ip_address: True

  hardware:
  memory_mb: "{{ vm_memory | default(4096) }}"
  num_cpus: "2"

##Conncecting to Domain

  - name: Join to Domain
ansible.windows.win_domain_membership:
  dns_domain_name: "{{ dxu_domain }}"
  hostname: ans-dv4-test1
  domain_admin_user: "{{ vcenter_user }}"
  domain_admin_password: "{{vcenter_pass }}"
  domain_ou_path: "{{ ou_path }}"
  state: domain
register: domain_state

##Reboot the machine after joining to Domain

  - name: Reboot after Domain Join
ansible.windows.win_reboot:
when: domain_state.reboot_required





The inventory file just has "localhost" defined in it.

Can someone please advise!


 

-- 
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/b85f424e-9808-482e-853f-40e95b6d687cn%40googlegroups.com.


[ansible-project] New releases: ansible-core 2.11.6, ansible-base 2.10.15, ansible 2.9.27

2021-10-14 Thread Matt Martz
Hi all- we're happy to announce the general release of:

- ansible-core 2.11.6
- ansible-base 2.10.15
- ansible 2.9.27


How to get it
-

$ pip install ansible-core==2.11.6 --user
or
$ pip install ansible-base==2.10.15 --user
or
$ pip install ansible==2.9.27 --user

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

* ansible-core 2.11.6

https://pypi.python.org/packages/source/a/ansible-core/ansible-core-2.11.6.tar.gz
  SHA256: 93d50283c7c5b476debf83dc089b3f679b939a8b9a7b5d628d28daafbb3d303a

* ansible-base 2.10.15

https://pypi.python.org/packages/source/a/ansible-base/ansible-base-2.10.15.tar.gz
  SHA256: 4478818ba821dba143e123568ec5d317dc8fa4ac6e1513f7a501734e52976bff

* ansible 2.9.27
  https://pypi.python.org/packages/source/a/ansible/ansible-2.9.27.tar.gz
  SHA256: 479159e50b3bd90920d06bc59410c3a51d3f9be9b4e1029e11d1e4a2d0705736


What's new
--

This release is a maintenance release containing numerous bugfixes.
 The full changelog is at:

* ansible-core 2.11.6

https://github.com/ansible/ansible/blob/v2.11.6/changelogs/CHANGELOG-v2.11.rst

* ansible-base 2.10.15

https://github.com/ansible/ansible/blob/v2.10.15/changelogs/CHANGELOG-v2.10.rst

* ansible 2.9.27

https://github.com/ansible/ansible/blob/v2.9.27/changelogs/CHANGELOG-v2.9.rst


What's the schedule for future maintenance releases?


The next batch of release candidates is planned to be released on 1
November 2021. The next general availability release will be one week after.


Porting Help


If you discover any errors or if any of your working playbooks break when
you
upgrade, please use the following link to report the regression:

  https://github.com/ansible/ansible/issues/new/choose

In your issue, be sure to mention the version that works and the one that
doesn't.

Thanks!

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


Re: [ansible-project] Listing installed packages

2021-10-14 Thread Dick Visser
This very question was asked (and answered) a few weeks ago:

https://groups.google.com/g/ansible-project/c/FsrlY_57hfo/m/x8jt7LMuBQAJ



On Thu, 14 Oct 2021 at 19:21, lift...@gmail.com  wrote:

> I know I can use the package_facts module to retrieve a list of installed
> packages, but I'm having trouble formatting these.  I'd like to format it
> similar to the following:
>
> Package:   Version: 
>
> Currently I'm doing the following (I'm showing only httpd but ultimately
> I'd like to list out ALL installed packages:
>
> ---
> - hosts: localhost
>   become: true
>   become_method: sudo
>   gather_facts: no
>
>   tasks:
>
>   - name: Get installed packages
> package_facts:
> register: packages
>
>   - name: Debug output
> debug:
>   msg: "{{ packages.ansible_facts.packages['httpd'] }}"
>
> The debug print is giving me the following:
>
> TASK [Debug output]
> **
> ok: [localhost] => {
> "msg": [
> {
> "arch": "x86_64",
> "epoch": null,
> "name": "httpd",
> "release": "97.el7_9",
> "source": "rpm",
> "version": "2.4.6"
> }
> ]
> }
>
> Any ideas?
>
> Thanks,
> Harry
>
>
> --
> 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/3908f91f-2a4d-493d-9bf7-a3f3edde4309n%40googlegroups.com
> 
> .
>


-- 
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

-- 
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/CAL8fbwO-O8oZu%2B55%3DBq8s9gco1FfcBxT2Owp2iuNQXM1dSaQrQ%40mail.gmail.com.


Re: [ansible-project] Listing installed packages

2021-10-14 Thread 'Jean-Yves LENHOF' via Ansible Project

Le 2021-10-14 19:21, lift...@gmail.com a écrit :

I know I can use the package_facts module to retrieve a list of
installed packages, but I'm having trouble formatting these.  I'd like
to format it similar to the following:

Package:   Version: 

Currently I'm doing the following (I'm showing only httpd but
ultimately I'd like to list out ALL installed packages:

---
- hosts: localhost
  become: true
  become_method: sudo
  gather_facts: no

  tasks:

  - name: Get installed packages
package_facts:
register: packages

  - name: Debug output

debug:
  msg: "{{ packages.ansible_facts.packages['httpd'] }}"

The debug print is giving me the following:

TASK [Debug output]
**
ok: [localhost] => {
"msg": [
{
"arch": "x86_64",
"epoch": null,
"name": "httpd",
"release": "97.el7_9",
"source": "rpm",
"version": "2.4.6"
}
]
}

Any ideas?

Thanks,
Harry


You can use templating to have it on one line...

But be careful :
- you can have more than one version of a package installed. Example: 
kernel
- you can have one x86_64 and one i686 or i386 version of a package 
installed


Regards,


--
Jean-Yves LENHOF

--
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/c35818c74a992704b45ffa2bc82c755e%40lenhof.eu.org.


[ansible-project] Listing installed packages

2021-10-14 Thread lift...@gmail.com
I know I can use the package_facts module to retrieve a list of installed 
packages, but I'm having trouble formatting these.  I'd like to format it 
similar to the following:

Package:   Version: 

Currently I'm doing the following (I'm showing only httpd but ultimately 
I'd like to list out ALL installed packages:

---
- hosts: localhost
  become: true
  become_method: sudo
  gather_facts: no

  tasks:

  - name: Get installed packages
package_facts:
register: packages

  - name: Debug output
debug:
  msg: "{{ packages.ansible_facts.packages['httpd'] }}"

The debug print is giving me the following:

TASK [Debug output] 
**
ok: [localhost] => {
"msg": [
{
"arch": "x86_64",
"epoch": null,
"name": "httpd",
"release": "97.el7_9",
"source": "rpm",
"version": "2.4.6"
}
]
}

Any ideas?

Thanks,
Harry


-- 
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/3908f91f-2a4d-493d-9bf7-a3f3edde4309n%40googlegroups.com.


Re: [ansible-project] one email for multiple hosts

2021-10-14 Thread Stefan Hornburg (Racke)

On 14/10/2021 15:12, Raj wrote:


Hi Racke,

This is my code

- name: Sending email to about SSL scan
  mail:
    host: x
    port: 25
    subject: 
    body:  
    from: xxx
    to:
   # - 
    - 
  delegate_to: localhost
  run_once: true


The mail module apparently doesn't check its parameters. For example "from" is going to be ignored, 
as the correct parameter is "sender". Please double check your indentation. "run_once" 
should be working.

Regards

     Racke




On Thursday, October 14, 2021 at 1:28:05 AM UTC-4 ra...@linuxia.de wrote:

On 13/10/2021 22:13, Raj wrote:
> Hi All,
>
> I am trying to send one email to team after job is successfully 
completed.  Issue is playbook sending (if inventory have 100 servers ). It is 
sending 100 emails.
>
> I tried in my code:  delegate_to: localhost and run_once: true it doesn't 
help please provide your inputs it really helpful .

That should work. Please provide your code.

Regards

   Racke

>
> TIA
> Raja
> --
> 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b69b5eb1-7de3-4bce-80fd-2ca824fd07a0n%40googlegroups.com 

 
>.


-- 
Ecommerce and Linux consulting + Perl and web application programming.

Debian and Sympa administration.

--
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/f662886f-2a63-4988-a2b7-e15a4dfbfd16n%40googlegroups.com
 
.



--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration.

--
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/859efc4a-8a62-dfa5-67d8-1c4c49191be5%40linuxia.de.


OpenPGP_0x5B93015BFA2720F8.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


Re: [ansible-project] one email for multiple hosts

2021-10-14 Thread Dick Visser
So, post that playbook

On Thu, 14 Oct 2021 at 17:03, Raja Natte  wrote:

> Hi..
>
>
> Yes it is running in same playbook.
>
> On Thu, Oct 14, 2021, 10:21 AM Dick Visser  wrote:
>
>> This is just the one mail task.
>> It must be part of a playbook, where other things happen as well, and
>> which will reveal the cause.
>>
>> Also, you say "I am trying to send one email to team after job is
>> successfully completed".
>> I guess this "job" is the running of the playbook?
>>
>>
>>
>>
>> On Thu, 14 Oct 2021 at 15:12, Raj  wrote:
>>
>>>
>>> Hi Racke,
>>>
>>> This is my code
>>>
>>> - name: Sending email to about SSL scan
>>>   mail:
>>> host: x
>>> port: 25
>>> subject: 
>>> body:  
>>> from: xxx
>>> to:
>>># - 
>>> - 
>>>   delegate_to: localhost
>>>   run_once: true
>>> On Thursday, October 14, 2021 at 1:28:05 AM UTC-4 ra...@linuxia.de
>>> wrote:
>>>
 On 13/10/2021 22:13, Raj wrote:
 > Hi All,
 >
 > I am trying to send one email to team after job is successfully
 completed.  Issue is playbook sending (if inventory have 100 servers ). It
 is sending 100 emails.
 >
 > I tried in my code:  delegate_to: localhost and run_once: true it
 doesn't help please provide your inputs it really helpful .

 That should work. Please provide your code.

 Regards

Racke

 >
 > TIA
 > Raja
 > --
 > 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 >>> ansible-proje...@googlegroups.com>.
 > To view this discussion on the web visit
 https://groups.google.com/d/msgid/ansible-project/b69b5eb1-7de3-4bce-80fd-2ca824fd07a0n%40googlegroups.com
 <
 https://groups.google.com/d/msgid/ansible-project/b69b5eb1-7de3-4bce-80fd-2ca824fd07a0n%40googlegroups.com?utm_medium=email_source=footer>.



 --
 Ecommerce and Linux consulting + Perl and web application programming.
 Debian and Sympa administration.

 --
>>> 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/f662886f-2a63-4988-a2b7-e15a4dfbfd16n%40googlegroups.com
>>> 
>>> .
>>>
>>
>>
>> --
>> Dick Visser
>> Trust & Identity Service Operations Manager
>> GÉANT
>>
>> --
>> 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/CAL8fbwNz4ToNKCBngPbHOtB4%3D%3DHbFvx%3DTCJ6%3D4CL-kSrgvrDUA%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/CA%2BuTAOgXB1y_ATqNWBtRXxNyVuysaVA8gBp3Scx8cJKFAR-nBA%40mail.gmail.com
> 
> .
>


-- 
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

-- 
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/CAL8fbwOoUGhOKLuUfHS-FSON6sRXAojU249hurczJoH79o2USg%40mail.gmail.com.


Re: [ansible-project] one email for multiple hosts

2021-10-14 Thread Raja Natte
Hi..


Yes it is running in same playbook.

On Thu, Oct 14, 2021, 10:21 AM Dick Visser  wrote:

> This is just the one mail task.
> It must be part of a playbook, where other things happen as well, and
> which will reveal the cause.
>
> Also, you say "I am trying to send one email to team after job is
> successfully completed".
> I guess this "job" is the running of the playbook?
>
>
>
>
> On Thu, 14 Oct 2021 at 15:12, Raj  wrote:
>
>>
>> Hi Racke,
>>
>> This is my code
>>
>> - name: Sending email to about SSL scan
>>   mail:
>> host: x
>> port: 25
>> subject: 
>> body:  
>> from: xxx
>> to:
>># - 
>> - 
>>   delegate_to: localhost
>>   run_once: true
>> On Thursday, October 14, 2021 at 1:28:05 AM UTC-4 ra...@linuxia.de wrote:
>>
>>> On 13/10/2021 22:13, Raj wrote:
>>> > Hi All,
>>> >
>>> > I am trying to send one email to team after job is successfully
>>> completed.  Issue is playbook sending (if inventory have 100 servers ). It
>>> is sending 100 emails.
>>> >
>>> > I tried in my code:  delegate_to: localhost and run_once: true it
>>> doesn't help please provide your inputs it really helpful .
>>>
>>> That should work. Please provide your code.
>>>
>>> Regards
>>>
>>>Racke
>>>
>>> >
>>> > TIA
>>> > Raja
>>> > --
>>> > 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 >> ansible-proje...@googlegroups.com>.
>>> > To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ansible-project/b69b5eb1-7de3-4bce-80fd-2ca824fd07a0n%40googlegroups.com
>>> <
>>> https://groups.google.com/d/msgid/ansible-project/b69b5eb1-7de3-4bce-80fd-2ca824fd07a0n%40googlegroups.com?utm_medium=email_source=footer>.
>>>
>>>
>>>
>>> --
>>> Ecommerce and Linux consulting + Perl and web application programming.
>>> Debian and Sympa administration.
>>>
>>> --
>> 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/f662886f-2a63-4988-a2b7-e15a4dfbfd16n%40googlegroups.com
>> 
>> .
>>
>
>
> --
> Dick Visser
> Trust & Identity Service Operations Manager
> GÉANT
>
> --
> 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/CAL8fbwNz4ToNKCBngPbHOtB4%3D%3DHbFvx%3DTCJ6%3D4CL-kSrgvrDUA%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/CA%2BuTAOgXB1y_ATqNWBtRXxNyVuysaVA8gBp3Scx8cJKFAR-nBA%40mail.gmail.com.


Re: [ansible-project] one email for multiple hosts

2021-10-14 Thread Dick Visser
This is just the one mail task.
It must be part of a playbook, where other things happen as well, and which
will reveal the cause.

Also, you say "I am trying to send one email to team after job is
successfully completed".
I guess this "job" is the running of the playbook?




On Thu, 14 Oct 2021 at 15:12, Raj  wrote:

>
> Hi Racke,
>
> This is my code
>
> - name: Sending email to about SSL scan
>   mail:
> host: x
> port: 25
> subject: 
> body:  
> from: xxx
> to:
># - 
> - 
>   delegate_to: localhost
>   run_once: true
> On Thursday, October 14, 2021 at 1:28:05 AM UTC-4 ra...@linuxia.de wrote:
>
>> On 13/10/2021 22:13, Raj wrote:
>> > Hi All,
>> >
>> > I am trying to send one email to team after job is successfully
>> completed.  Issue is playbook sending (if inventory have 100 servers ). It
>> is sending 100 emails.
>> >
>> > I tried in my code:  delegate_to: localhost and run_once: true it
>> doesn't help please provide your inputs it really helpful .
>>
>> That should work. Please provide your code.
>>
>> Regards
>>
>>Racke
>>
>> >
>> > TIA
>> > Raja
>> > --
>> > 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 > ansible-proje...@googlegroups.com>.
>> > To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/b69b5eb1-7de3-4bce-80fd-2ca824fd07a0n%40googlegroups.com
>> <
>> https://groups.google.com/d/msgid/ansible-project/b69b5eb1-7de3-4bce-80fd-2ca824fd07a0n%40googlegroups.com?utm_medium=email_source=footer>.
>>
>>
>>
>> --
>> Ecommerce and Linux consulting + Perl and web application programming.
>> Debian and Sympa administration.
>>
>> --
> 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/f662886f-2a63-4988-a2b7-e15a4dfbfd16n%40googlegroups.com
> 
> .
>


-- 
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

-- 
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/CAL8fbwNz4ToNKCBngPbHOtB4%3D%3DHbFvx%3DTCJ6%3D4CL-kSrgvrDUA%40mail.gmail.com.


Re: [ansible-project] centos7 target - sudden python interpreter trouble

2021-10-14 Thread dulhaver via Ansible Project


> On 10/14/2021 3:05 PM Sandip Bhattacharya  wrote:
>
> Can you do:
> ansible [hostname] -m setup

yes, that works

> On 10/14/2021 Jean-Yves LENHOF wrote:
> 
> Did you surcharge the python interpreter variable in a config file ? 
(/etc/ansible.cfg, ~/.ansible.cfg, etc...)

I had a similar idea nad see an 'interpreter_ansible=auto_silent' in my 
effective ansible.cfg- Turning that off does not change anything though


> On 10/14/2021 Racke wrote:
> 
> Somewhere the value /usr/bin/python3 must come from ... try to grep for this 
> string through all relevant directories.

tadaaa! there was a interpreter_python=/usr/bin/python3 in a vars_file 
effective for that playbook which I wasn't aware off. changing that and this 
particular problem goes away.

thank you everybody for your input

... I am hanging on the next task now, but that's a different story

-- 
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/1414320242.100674.1634218256024%40office.mailbox.org.


Re: [ansible-project] one email for multiple hosts

2021-10-14 Thread Raj

Hi Racke,

This is my code

- name: Sending email to about SSL scan
  mail:
host: x
port: 25
subject: 
body:  
from: xxx
to:
   # - 
- 
  delegate_to: localhost
  run_once: true
On Thursday, October 14, 2021 at 1:28:05 AM UTC-4 ra...@linuxia.de wrote:

> On 13/10/2021 22:13, Raj wrote:
> > Hi All,
> >
> > I am trying to send one email to team after job is successfully 
> completed.  Issue is playbook sending (if inventory have 100 servers ). It 
> is sending 100 emails.
> >
> > I tried in my code:  delegate_to: localhost and run_once: true it 
> doesn't help please provide your inputs it really helpful .
>
> That should work. Please provide your code.
>
> Regards
>
>Racke
>
> >
> > TIA
> > Raja
> > -- 
> > 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  ansible-proje...@googlegroups.com>.
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/b69b5eb1-7de3-4bce-80fd-2ca824fd07a0n%40googlegroups.com
>  
> <
> https://groups.google.com/d/msgid/ansible-project/b69b5eb1-7de3-4bce-80fd-2ca824fd07a0n%40googlegroups.com?utm_medium=email_source=footer
> >.
>
>
> -- 
> Ecommerce and Linux consulting + Perl and web application programming.
> Debian and Sympa administration.
>
>

-- 
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/f662886f-2a63-4988-a2b7-e15a4dfbfd16n%40googlegroups.com.


Re: [ansible-project] centos7 target - sudden python interpreter trouble

2021-10-14 Thread Sandip Bhattacharya




On 14.10.21 14:03, dulhaver via Ansible Project wrote:

On 10/14/2021 1:41 PM dulhaver via Ansible Project 
 wrote:

  
also I can run ad-hoc commands (like ping) on that target successfully (which should proove to some extend that python can be addressed on target, shouldn't it?)


this i.e. also works

ansible [hostname] -m shell -a 'yum install @postgresql -y' --become



Can you do:
   ansible [hostname] -m setup

--
https://blog.sandipb.net
https://twitter.com/sandipb

--
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/7ca43bae-7ca4-89aa-c1ec-a08e7ed0846f%40showmethesource.org.


Re: [ansible-project] centos7 target - sudden python interpreter trouble

2021-10-14 Thread 'Jean-Yves LENHOF' via Ansible Project

Le 2021-10-14 14:14, dulhaver via Ansible Project a écrit :
On 10/14/2021 1:44 PM Sandip Bhattacharya 
 wrote:



On 14.10.21 11:49, dulhaver via Ansible Project wrote:
> I am running a playbook to install postgresql  
against a centos7 (python 2.75) target and am getting this error about a bad python 
interpreter .
>
> I try to solve this via the inventory.yml
>
> all:
>    hosts:
>      [hostname]: # centos7

Is this literally what is in your inventory.yaml file? Is that even 
valid yaml?

Shouldn't it be:

all:
   hosts:
 hostname: # centos7


this is my literal inventory file: https://paste.debian.net/1215386/
it works for other playbooks, it works for ad-hoc commands (where I
addresse a particular host from that group)


Did you surcharge the python interpreter variable in a config file ? 
(/etc/ansible.cfg, ~/.ansible.cfg, etc...)


See:
https://docs.ansible.com/ansible/latest/reference_appendices/config.html

Regards,

--
Jean-Yves LENHOF

--
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/1a5189ff5c956aa7b82a6352ee28cc1a%40lenhof.eu.org.


Re: [ansible-project] centos7 target - sudden python interpreter trouble

2021-10-14 Thread Stefan Hornburg (Racke)

On 14/10/2021 14:23, dulhaver via Ansible Project wrote:

the '# centos7' comment on 2 targets is legal I believe.
To rule this out I have removed it for a test run. Still the error was present


Somewhere the value /usr/bin/python3 must come from ... try to grep for this 
string through all relevant directories.

Regards

   Racke


On 10/14/2021 2:14 PM dulha...@mailbox.org wrote:

  

On 10/14/2021 1:44 PM Sandip Bhattacharya  wrote:

  
On 14.10.21 11:49, dulhaver via Ansible Project wrote:

I am running a playbook to install postgresql  
against a centos7 (python 2.75) target and am getting this error about a bad python 
interpreter .

I try to solve this via the inventory.yml

all:
    hosts:
      [hostname]: # centos7

Is this literally what is in your inventory.yaml file? Is that even valid yaml?
Shouldn't it be:

all:
hosts:
  hostname: # centos7


this is my literal inventory file: https://paste.debian.net/1215386/
it works for other playbooks, it works for ad-hoc commands (where I addresse a 
particular host from that group)



--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration.

--
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/198061a5-4f5f-e241-45ef-293283b6ac1a%40linuxia.de.


OpenPGP_0x5B93015BFA2720F8.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


Re: [ansible-project] centos7 target - sudden python interpreter trouble

2021-10-14 Thread dulhaver via Ansible Project


the '# centos7' comment on 2 targets is legal I believe. 
To rule this out I have removed it for a test run. Still the error was present



> On 10/14/2021 2:14 PM dulha...@mailbox.org wrote:
> 
>  
> > On 10/14/2021 1:44 PM Sandip Bhattacharya  
> > wrote:
> > 
> >  
> > On 14.10.21 11:49, dulhaver via Ansible Project wrote:
> > > I am running a playbook to install postgresql 
> > >  against a centos7 (python 2.75) 
> > > target and am getting this error about a bad python interpreter 
> > > .
> > > 
> > > I try to solve this via the inventory.yml
> > > 
> > > all:
> > >    hosts:
> > >      [hostname]: # centos7
> > 
> > Is this literally what is in your inventory.yaml file? Is that even valid 
> > yaml?
> > Shouldn't it be:
> > 
> > all:
> >hosts:
> >  hostname: # centos7
> > 
> this is my literal inventory file: https://paste.debian.net/1215386/
> it works for other playbooks, it works for ad-hoc commands (where I addresse 
> a particular host from that group)

-- 
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/1090834351.99768.1634214235164%40office.mailbox.org.


Re: [ansible-project] Variable is not recognized

2021-10-14 Thread dulhaver via Ansible Project
hm, if it wasn't too good to be true I'd simply say variable {{ webroot }} 
exists, variable {{ root }} doesn't


> On 10/14/2021 2:13 PM Stefan Malte  
> wrote:
> 
> 
> Hi,
> 
> I have a rather trivial problem, nonetheless I am unable to solve it on 
> my own.
> In the host_var vm116.***.** (Domain Names replaces by *) the variable 
> "root: /var/www/test" is set.
> This creates the right webroot in the vhost_configuration. Now I also 
> want to create the directory itself
> 
> - name: Create webroot
>   ansible.builtin.file:
> path: "{{ root }}"
> state: directory
> mode: '0755'
> owner: www-data
> group: www-data
> 
> Error message:
> fatal: [vm116.info]: FAILED! => {"msg": "The task includes an option with 
> an undefined variable. The error was: 'root' is undefined\n\nThe error 
> appears to be in 
> '/home/stefan/Git/ansible/roles/ansible-role-nginx/tasks/custom_tasks.yml': 
> line 62, column 3, but may\nbe elsewhere in the file depending on the exact 
> syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Create 
> webroot\n  ^ here\n"}
> 
> I dont understand how this can be after all the variable has just been 
> used to create the webroot in the vhosts - I double-checked on this.
> 
> Interestingly if I replace the variable root with the variable "webroot" 
> or any other name:
> 
> vm116.info hostvar webroot: temp
> 
> - name: Create webroot
>   ansible.builtin.file:
> path: "/var/www{{ webroot }}"
> state: directory
> mode: '0755'
> owner: www-data
> group: www-data
> 
> everything works like a charm. How can I fix this?  Why cant I reuse the 
> variable?
> 
> Yours 
> Stefan Malte
> 
> 
> 
> --
> 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 
> mailto:ansible-project+unsubscr...@googlegroups.com .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/18a4a76b-a8ab-4cf4-9635-84e79ac4087an%40googlegroups.com
>  
> https://groups.google.com/d/msgid/ansible-project/18a4a76b-a8ab-4cf4-9635-84e79ac4087an%40googlegroups.com?utm_medium=email_source=footer
>  .
> 

-- 
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/1480200180.99712.1634214008345%40office.mailbox.org.


Re: [ansible-project] centos7 target - sudden python interpreter trouble

2021-10-14 Thread dulhaver via Ansible Project
> On 10/14/2021 1:44 PM Sandip Bhattacharya  wrote:
> 
>  
> On 14.10.21 11:49, dulhaver via Ansible Project wrote:
> > I am running a playbook to install postgresql 
> >  against a centos7 (python 2.75) target 
> > and am getting this error about a bad python interpreter 
> > .
> > 
> > I try to solve this via the inventory.yml
> > 
> > all:
> >    hosts:
> >      [hostname]: # centos7
> 
> Is this literally what is in your inventory.yaml file? Is that even valid 
> yaml?
> Shouldn't it be:
> 
> all:
>hosts:
>  hostname: # centos7
> 
this is my literal inventory file: https://paste.debian.net/1215386/
it works for other playbooks, it works for ad-hoc commands (where I addresse a 
particular host from that group)

-- 
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/1329595744.99649.1634213698934%40office.mailbox.org.


[ansible-project] Variable is not recognized

2021-10-14 Thread Stefan Malte
Hi,

I have a rather trivial problem, nonetheless I am unable to solve it on my 
own.
In the host_var vm116.***.** (Domain Names replaces by *) the variable 
"root: /var/www/test" is set.
This creates the right webroot in the vhost_configuration. Now I also want 
to create the directory itself

- name: Create webroot
  ansible.builtin.file:
path: "{{ root }}"
state: directory
mode: '0755'
owner: www-data
group: www-data

Error message:
fatal: [vm116.info]: FAILED! => {"msg": "The task includes an option with 
an undefined variable. The error was: 'root' is undefined\n\nThe error 
appears to be in 
'/home/stefan/Git/ansible/roles/ansible-role-nginx/tasks/custom_tasks.yml': 
line 62, column 3, but may\nbe elsewhere in the file depending on the exact 
syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Create 
webroot\n  ^ here\n"}

I dont understand how this can be after all the variable has just been used 
to create the webroot in the vhosts - I double-checked on this.

Interestingly if I replace the variable root with the variable "webroot" or 
any other name:

vm116.info hostvar webroot: temp

- name: Create webroot
  ansible.builtin.file:
path: "/var/www{{ webroot }}"
state: directory
mode: '0755'
owner: www-data
group: www-data

everything works like a charm. How can I fix this?  Why cant I reuse the 
variable?

Yours 
Stefan Malte

-- 
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/18a4a76b-a8ab-4cf4-9635-84e79ac4087an%40googlegroups.com.


Re: [ansible-project] centos7 target - sudden python interpreter trouble

2021-10-14 Thread dulhaver via Ansible Project
> On 10/14/2021 1:41 PM dulhaver via Ansible Project 
>  wrote:
> 
>  
> also I can run ad-hoc commands (like ping) on that target successfully (which 
> should proove to some extend that python can be addressed on target, 
> shouldn't it?)

this i.e. also works

ansible [hostname] -m shell -a 'yum install @postgresql -y' --become

-- 
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/693359009.99490.1634213006616%40office.mailbox.org.


Re: [ansible-project] centos7 target - sudden python interpreter trouble

2021-10-14 Thread Sandip Bhattacharya




On 14.10.21 11:49, dulhaver via Ansible Project wrote:

I am running a playbook to install postgresql  
against a centos7 (python 2.75) target and am getting this error about a bad python 
interpreter .

I try to solve this via the inventory.yml

all:
   hosts:
     [hostname]: # centos7


Is this literally what is in your inventory.yaml file? Is that even valid yaml?
Shouldn't it be:

all:
  hosts:
hostname: # centos7


--
https://blog.sandipb.net
https://twitter.com/sandipb

--
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/c52cc763-db49-ede0-1663-c0f81318a5a4%40showmethesource.org.


Fwd: Re: [ansible-project] centos7 target - sudden python interpreter trouble

2021-10-14 Thread dulhaver via Ansible Project
also I can run ad-hoc commands (like ping) on that target successfully (which 
should proove to some extend that python can be addressed on target, shouldn't 
it?)



> On 10/14/2021 1:37 PM dulhaver via Ansible Project 
>  wrote:
> 
>  
> > On 10/14/2021 1:15 PM 'Jean-Yves LENHOF' via Ansible Project 
> >  wrote:
> > 
> >  
> > Le 2021-10-14 13:05, dulhaver via Ansible Project a écrit :
> > >> On 10/14/2021 12:59 PM 'Jean-Yves LENHOF' via Ansible Project 
> > >>  wrote:
> > >> 
> > >> 
> > >> Le 2021-10-14 12:56, dulhaver via Ansible Project a écrit :
> > >> > thx for the hint
> > >> >
> > >> >> On 10/14/2021 12:16 PM 'Jean-Yves LENHOF' via Ansible Project
> > >> >>  wrote:
> > >> >>
> > >> >> Maybe something wrong with alternatives ?
> > >> >> > alternatives --list | grep -i python
> > >> >
> > >> > turns out empty.
> > >> >
> > >> > have tried to get something working with
> > >> >> alternatives --install /usr/bin/python python /usr/bin/python2.7
> > >> >
> > >> > (where /usr/bin/python is already a symlink to /usr/bin/python2 which
> > >> > is a symlink to /usr/bin/python2.7). It did not change anything
> > >> > though.
> > >> >
> > >> > probably it's my incompetence. I never heard about alternatives before
> > >> > (and don't really get it, as I thought the symlinks /usr/bin/python >
> > >> > /usr/bin/python2 > /usr/bin/python2.7) should be sufficient to guide
> > >> > anybody looking for python to the right executable. Neither do I get
> > >> > why all of a sudden a playbook requires this where opther playbooks
> > >> > running against the exact same host haven't.
> > >> 
> > >> 
> > >> Running from the same controller server with the same ansible version 
> > >> ?
> > > 
> > > no, I ran all that on the target. doing that on the Ansible controller
> > > server I get:
> > > 
> > > alternatives --list | grep python
> > > python  manual  /usr/bin/python3
> > > python3 auto/usr/bin/python3.6
> > 
> > That's not what I was asking... But you answer indirectly to one of my 
> > questions.
> > You have only one ansible controller as I understand.
> yes, one single controller
>  
> > You seems to say that there were some playbooks which works OK and some 
> > don't on the same targets.
> > Do you use the same ansible version for the the one which are OK and not 
> > OK ? There were some changes between versions of ansible for the python 
> > default interpreter search
> yes same ansible version, no changes in either ansible version, not python
> 
> > Do you use the same inventory ? If not did you force the ansible python
> > interpreter on one and not the other ?
> same inventory, no forcing
> 
> -- 
> 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/1806530675.99139.1634211429674%40office.mailbox.org.

-- 
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/1170018749.99174.1634211660788%40office.mailbox.org.


Re: [ansible-project] centos7 target - sudden python interpreter trouble

2021-10-14 Thread dulhaver via Ansible Project


> On 10/14/2021 1:15 PM 'Jean-Yves LENHOF' via Ansible Project 
>  wrote:
> 
>  
> Le 2021-10-14 13:05, dulhaver via Ansible Project a écrit :
> >> On 10/14/2021 12:59 PM 'Jean-Yves LENHOF' via Ansible Project 
> >>  wrote:
> >> 
> >> 
> >> Le 2021-10-14 12:56, dulhaver via Ansible Project a écrit :
> >> > thx for the hint
> >> >
> >> >> On 10/14/2021 12:16 PM 'Jean-Yves LENHOF' via Ansible Project
> >> >>  wrote:
> >> >>
> >> >> Maybe something wrong with alternatives ?
> >> >> > alternatives --list | grep -i python
> >> >
> >> > turns out empty.
> >> >
> >> > have tried to get something working with
> >> >> alternatives --install /usr/bin/python python /usr/bin/python2.7
> >> >
> >> > (where /usr/bin/python is already a symlink to /usr/bin/python2 which
> >> > is a symlink to /usr/bin/python2.7). It did not change anything
> >> > though.
> >> >
> >> > probably it's my incompetence. I never heard about alternatives before
> >> > (and don't really get it, as I thought the symlinks /usr/bin/python >
> >> > /usr/bin/python2 > /usr/bin/python2.7) should be sufficient to guide
> >> > anybody looking for python to the right executable. Neither do I get
> >> > why all of a sudden a playbook requires this where opther playbooks
> >> > running against the exact same host haven't.
> >> 
> >> 
> >> Running from the same controller server with the same ansible version 
> >> ?
> > 
> > no, I ran all that on the target. doing that on the Ansible controller
> > server I get:
> > 
> > alternatives --list | grep python
> > python  manual  /usr/bin/python3
> > python3 auto/usr/bin/python3.6
> 
> That's not what I was asking... But you answer indirectly to one of my 
> questions.
> You have only one ansible controller as I understand.
yes, one single controller
 
> You seems to say that there were some playbooks which works OK and some 
> don't on the same targets.
> Do you use the same ansible version for the the one which are OK and not 
> OK ? There were some changes between versions of ansible for the python 
> default interpreter search
yes same ansible version, no changes in either ansible version, not python

> Do you use the same inventory ? If not did you force the ansible python
> interpreter on one and not the other ?
same inventory, no forcing

-- 
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/1806530675.99139.1634211429674%40office.mailbox.org.


Re: [ansible-project] centos7 target - sudden python interpreter trouble

2021-10-14 Thread 'Jean-Yves LENHOF' via Ansible Project

Le 2021-10-14 13:05, dulhaver via Ansible Project a écrit :
On 10/14/2021 12:59 PM 'Jean-Yves LENHOF' via Ansible Project 
 wrote:



Le 2021-10-14 12:56, dulhaver via Ansible Project a écrit :
> thx for the hint
>
>> On 10/14/2021 12:16 PM 'Jean-Yves LENHOF' via Ansible Project
>>  wrote:
>>
>> Maybe something wrong with alternatives ?
>> > alternatives --list | grep -i python
>
> turns out empty.
>
> have tried to get something working with
>> alternatives --install /usr/bin/python python /usr/bin/python2.7
>
> (where /usr/bin/python is already a symlink to /usr/bin/python2 which
> is a symlink to /usr/bin/python2.7). It did not change anything
> though.
>
> probably it's my incompetence. I never heard about alternatives before
> (and don't really get it, as I thought the symlinks /usr/bin/python >
> /usr/bin/python2 > /usr/bin/python2.7) should be sufficient to guide
> anybody looking for python to the right executable. Neither do I get
> why all of a sudden a playbook requires this where opther playbooks
> running against the exact same host haven't.


Running from the same controller server with the same ansible version 
?


no, I ran all that on the target. doing that on the Ansible controller
server I get:

alternatives --list | grep python
python  manual  /usr/bin/python3
python3 auto/usr/bin/python3.6


That's not what I was asking... But you answer indirectly to one of my 
questions.

You have only one ansible controller as I understand.

You seems to say that there were some playbooks which works OK and some 
don't on the same targets.
Do you use the same ansible version for the the one which are OK and not 
OK ? There were some changes between versions of ansible for the python 
default interpreter search
Do you use the same inventory ? If not did you force the ansible python 
interpreter on one and not the other ?




Regards,

--
Jean-Yves LENHOF

--
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/2a183e1d76dca48acb64c88e5695ecf9%40lenhof.eu.org.


Re: [ansible-project] centos7 target - sudden python interpreter trouble

2021-10-14 Thread dulhaver via Ansible Project


> On 10/14/2021 12:59 PM 'Jean-Yves LENHOF' via Ansible Project 
>  wrote:
> 
>  
> Le 2021-10-14 12:56, dulhaver via Ansible Project a écrit :
> > thx for the hint
> > 
> >> On 10/14/2021 12:16 PM 'Jean-Yves LENHOF' via Ansible Project 
> >>  wrote:
> >> 
> >> Maybe something wrong with alternatives ?
> >> > alternatives --list | grep -i python
> > 
> > turns out empty.
> > 
> > have tried to get something working with
> >> alternatives --install /usr/bin/python python /usr/bin/python2.7
> > 
> > (where /usr/bin/python is already a symlink to /usr/bin/python2 which
> > is a symlink to /usr/bin/python2.7). It did not change anything
> > though.
> > 
> > probably it's my incompetence. I never heard about alternatives before
> > (and don't really get it, as I thought the symlinks /usr/bin/python >
> > /usr/bin/python2 > /usr/bin/python2.7) should be sufficient to guide
> > anybody looking for python to the right executable. Neither do I get
> > why all of a sudden a playbook requires this where opther playbooks
> > running against the exact same host haven't.
> 
> 
> Running from the same controller server with the same ansible version ?

no, I ran all that on the target. doing that on the Ansible controller server I 
get:

alternatives --list | grep python
python  manual  /usr/bin/python3
python3 auto/usr/bin/python3.6

-- 
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/1693914497.98705.1634209548180%40office.mailbox.org.


Re: [ansible-project] centos7 target - sudden python interpreter trouble

2021-10-14 Thread 'Jean-Yves LENHOF' via Ansible Project

Le 2021-10-14 12:56, dulhaver via Ansible Project a écrit :

thx for the hint

On 10/14/2021 12:16 PM 'Jean-Yves LENHOF' via Ansible Project 
 wrote:


Maybe something wrong with alternatives ?
> alternatives --list | grep -i python


turns out empty.

have tried to get something working with

alternatives --install /usr/bin/python python /usr/bin/python2.7


(where /usr/bin/python is already a symlink to /usr/bin/python2 which
is a symlink to /usr/bin/python2.7). It did not change anything
though.

probably it's my incompetence. I never heard about alternatives before
(and don't really get it, as I thought the symlinks /usr/bin/python >
/usr/bin/python2 > /usr/bin/python2.7) should be sufficient to guide
anybody looking for python to the right executable. Neither do I get
why all of a sudden a playbook requires this where opther playbooks
running against the exact same host haven't.



Running from the same controller server with the same ansible version ?

Regards,

--
Jean-Yves LENHOF

--
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/1f0e8552caa6b1ddc9383ecc654a307f%40lenhof.eu.org.


Re: [ansible-project] centos7 target - sudden python interpreter trouble

2021-10-14 Thread dulhaver via Ansible Project
thx for the hint

> On 10/14/2021 12:16 PM 'Jean-Yves LENHOF' via Ansible Project 
>  wrote:
> 
> Maybe something wrong with alternatives ?
> > alternatives --list | grep -i python

turns out empty. 

have tried to get something working with 
> alternatives --install /usr/bin/python python /usr/bin/python2.7 

(where /usr/bin/python is already a symlink to /usr/bin/python2 which is a 
symlink to /usr/bin/python2.7). It did not change anything though.

probably it's my incompetence. I never heard about alternatives before (and 
don't really get it, as I thought the symlinks /usr/bin/python > 
/usr/bin/python2 > /usr/bin/python2.7) should be sufficient to guide anybody 
looking for python to the right executable. Neither do I get why all of a 
sudden a playbook requires this where opther playbooks running against the 
exact same host haven't.

-- 
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/1580110447.98592.1634208972831%40office.mailbox.org.


Re: [ansible-project] centos7 target - sudden python interpreter trouble

2021-10-14 Thread 'Jean-Yves LENHOF' via Ansible Project

Le 2021-10-14 11:49, dulhaver via Ansible Project a écrit :

I am running a playbook to install postgresql [1] against a centos7
(python 2.75) target and am getting this error about a bad python
interpreter [2].

 I try to solve this via the inventory.yml

 all:
  hosts:
 [hostname]: # centos7
  ansible_host: my.domain.org
  ansible_user: username
  ansible_python_interpreter: /usr/bin/python

 (also tried interpreter_python: /usr/bin/python). the error remains
though

 funny fact ... I ran other playbooks successfully against the same
host before even without having specified any python interpreter.

 any ideas what may be going wrong here?





Hi,

Maybe something wrong with alternatives ?

alternatives --list | grep -i python


Regards,

--
Jean-Yves LENHOF

--
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/bb6de9cb59fd3403fcedc2bf37eb7bdd%40lenhof.eu.org.


[ansible-project] Need info on the commands used by ios_facts module

2021-10-14 Thread Vikram S


We plan to do ios upgrade and I am using ios_facts module to 
compare/manipulate info.

There is a team to which we have given limited access to network devices 
and need to know what command does ios_facts module execute on cisco 
devices to gather the info that it does? So we will give access to these 
commands to that team so that the script would work when this team runs the 
script using their id.


I went through several ansible documentation for network modules but the 
exact commands executed by ios_facts is not mentioned anywhere. Some 
documentation give an idea on what type of info is gathered but the exact 
command is not given. Since same info can be gathered using multiple 
commands in cisco devices sometimes, so it is difficult to make a guess.


Thanks,

Vikram

-- 
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/17615e8e-6c4c-41d1-8bcc-255028620f4fn%40googlegroups.com.


[ansible-project] centos7 target - sudden python interpreter trouble

2021-10-14 Thread dulhaver via Ansible Project
I am running a playbook to install postgresql https://paste.debian.net/1215359/ 
against a centos7 (python 2.75) target and am getting this error about a bad 
python interpreter https://paste.debian.net/1215357/ .

I try to solve this via the inventory.yml

all:
hosts:
[hostname]: # centos7
ansible_host: my.domain.org
ansible_user: username
ansible_python_interpreter: /usr/bin/python

(also tried interpreter_python: /usr/bin/python). the error remains though

funny fact ... I ran other playbooks successfully against the same host before 
even without having specified any python interpreter.

any ideas what may be going wrong 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1298110667.97464.1634204971804%40office.mailbox.org.


Re: [ansible-project] Help me to achive this task

2021-10-14 Thread Stefan Hornburg (Racke)

On 14/10/2021 09:22, Dineshbabu Shankar wrote:

Can any one help me on this


Please define "not working".

Regards

 Racke




On Tue, 12 Oct, 2021, 8:58 pm Dineshbabu Shankar, mailto:shankardineshb...@gmail.com>> wrote:

My requiremnt ,

i need to add the disk to vms in vcenter   by passing
vm name, datastorename , and  disk_size   via csv file ,
with the following condition.
1. datastore which i am providing the csv should be in facts collected from 
vms
2.datastore  free volume is greater than what we requested (disk_size)
3.after taking the required disk_size the datastore should be  greater than 
equal to 20% of the total size of the datastore .

i can achieve this for the single server  but for more than one server i am 
struggling , can any one help me ,

Working one (for one server )
 cat test/diskadditionpre.yaml
---
  - hosts: localhost
    vars_prompt:
      - name: vcentername
        prompt: "Enter the vcenter name"
        private: no
      - name: vcenter_user
        prompt: "Enter the username"
        private: no
      - name: vcenter_password
        prompt: "Enter your password"
      - name: datastore_name
        prompt: "Enter the datastore name "
        private: no
      - name: disk_size
        prompt: "Enter the disksize in GB"


    tasks:
    - name: collecting the vminformation
      vmware_guest_facts:
        validate_certs: no
        hostname: "{{ vcentername }}"
        username: "{{ vcenter_user }}"
        password: "{{ vcenter_password }}"
        datacenter: DFW
        folder: /DFW/vm/Servers/Linux
        name: vmtest1
      delegate_to: localhost
      register: vm_info

    - name: Get the datastores associated with the VM
      set_fact:
         datastorelist: "{{vm_info.instance.hw_files | join (' ')}}"  # 
#converting list into the srting for easy  when condition use#

    - name: checking wheather enter correct datastore
      assert:
       that:
         - "datastore_name in datastorelist"
       success_msg: 'VM has correct Datastore.'
       fail_msg: 'Pls Enter the correct Datastore name '

    - name: Collecting the datastore information
      vmware_datastore_info:
        validate_certs: no
        hostname: '{{ vcentername }}'
        username: '{{ vcenter_user }}'
        password: '{{ vcenter_password }}'
        datacenter_name: DFW
        name: '{{datastore_name}}'
      delegate_to: localhost
      register: datastore_info
      when: " datastore_name in datastorelist " # if the datastorelist 
contains the name datastore_name procees furthur#

    - set_fact: datastore_cap="{{datastore_info.datastores[0].capacity |float / 
1073741824|float }}" # byte to GB converstion
    - set_fact: datastore_free="{{datastore_info.datastores[0].freeSpace |float 
/ 1073741824|float}}"
    - set_fact: 
datastore_used="{{datastore_info.datastores[0].provisioned|filesizeformat(true)}}"
    - set_fact: datastore_buffer="{{datastore_free|float - 
disk_size|float}}"
    - set_fact: datastore_buffer_s="{{(datastore_buffer)|float / ( 
datastore_cap)|float }}"
    - set_fact: datastore_buffer_percentage="{{100*(datastore_buffer_s) 
|float}}"
      when: " datastore_name in datastorelist "

    - name: Checking wheather datastore having enough disk
      assert:
        that:
          - "(datastore_free|float ) > (disk_size|float)"
          - "(datastore_buffer_percentage |float) > (20.0|float)"
        fail_msg: 'Free Disk is lesser than the required disksize'
        success_msg: 'Free Disk is greater than require disksize'

    - name: disk addition should be with either scsi controller with type  
no or controllernumber with type
      vmware_guest_disk:
       validate_certs: no
       hostname: "{{ vcentername }}"
       username: "{{ vcenter_user }}"
       password: "{{ vcenter_password }}"
       datacenter: DFW
       folder: /DFW/vm/Servers/Linux
       name: vmtest1
       disk:
       - size_gb: "{{disk_size}}"
         type: thick
         state: present
         scsi_controller: 2   #required paramater
         scsi_type: 'paravirtual' #required paramater
         datastore: "{{datastore_name}}"
         unit_number: 3 #required paramater
         destroy: no
      when:
        - "(datastore_free|float ) > (disk_size|float)"
        - "( datastore_name) in (datastorelist) "
        - "(datastore_buffer_percentage |float) > (20.0|float)"



NOT working (multiple servers)

---
  - hosts: localhost
    vars_prompt:
      - name: vcentername
        prompt: "Enter the vcenter name"
        private: no
      - name: vcenter_user
        

Re: [ansible-project] Getting Permission Denied Error

2021-10-14 Thread Sandip Bhattacharya




On 13.10.21 13:51, Anirban Das wrote:

I have created aws ec2 instances through Terraform, so that time I have 
mentioned key name for ec2 launching. But yes didn't mention ansible private 
key in terraform script. So in the provisioner bock I put ansible playbook 
command with private-key path. What else do I need to do??

you can check below terraform script and please guide me.
=

# Creating 3 EC2 Instances:

resource "aws_instance" "instance" {
   count           = length(aws_subnet.public_subnet.*.id)
   ami             = var.ami_id
   instance_type   = var.instance_type
   subnet_id       = element(aws_subnet.public_subnet.*.id, count.index)
   security_groups = [aws_security_group.sg.id, ]
   key_name        = "Keypair-01"


1. Confirm that the ssh key mentioned in "Keypair-01" is the one in your 
ssh-agent locally.
2. Confirm that your local user exists on the remote host, and has the ssh-key 
in the authorized_keys file.
3. Confirm that you can do "ssh -i /path/to/private/key AWS_HOST" and can log 
in without any problems.
4. See if you can run 'ansible AWS_HOST -m ping' and get a response.

These can provide clues to what is wrong.

--
https://blog.sandipb.net
https://twitter.com/sandipb

--
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/292b4912-97d4-d016-740c-cd39114f3356%40showmethesource.org.


[ansible-project] centos7 target - trouble with python interpreter

2021-10-14 Thread dulhaver via Ansible Project
I am running a playbook to install postgresql https://paste.debian.net/1215359/ 
against a centos7 (python 2.75) target and am getting this error about a bad 
python interpreter https://paste.debian.net/1215357/ .

I try to solve this via the inventory.yml

all:
hosts:
[hostname]: # centos7
ansible_host: VM-51150-0179.step.zrz.dvz.cn-mv.de
ansible_user: username
ansible_python_interpreter: /usr/bin/python

(also tried interpreter_python: /usr/bin/python). the error remains though

funny fact ... I ran opther playbooks successfully against the same host even 
without have specified any python interpreter.

any ideas what may be going wrong 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/890517810.97014.1634202934051%40office.mailbox.org.


Re: [ansible-project] Help me to achive this task

2021-10-14 Thread Dineshbabu Shankar
Can any one help me on this


On Tue, 12 Oct, 2021, 8:58 pm Dineshbabu Shankar, <
shankardineshb...@gmail.com> wrote:

> My requiremnt ,
>
> i need to add the disk to vms in vcenter   by passing
> vm name, datastorename , and  disk_size   via csv file ,
>
> with the following condition.
> 1. datastore which i am providing the csv should be in facts collected
> from vms
> 2.datastore  free volume is greater than what we requested (disk_size)
> 3.after taking the required disk_size the datastore should be  greater
> than equal to 20% of the total size of the datastore .
>
> i can achieve this for the single server  but for more than one server i
> am struggling , can any one help me ,
>
> Working one (for one server )
>  cat test/diskadditionpre.yaml
> ---
>   - hosts: localhost
> vars_prompt:
>   - name: vcentername
> prompt: "Enter the vcenter name"
> private: no
>   - name: vcenter_user
> prompt: "Enter the username"
> private: no
>   - name: vcenter_password
> prompt: "Enter your password"
>   - name: datastore_name
> prompt: "Enter the datastore name "
> private: no
>   - name: disk_size
> prompt: "Enter the disksize in GB"
>
>
> tasks:
> - name: collecting the vminformation
>   vmware_guest_facts:
> validate_certs: no
> hostname: "{{ vcentername }}"
> username: "{{ vcenter_user }}"
> password: "{{ vcenter_password }}"
> datacenter: DFW
> folder: /DFW/vm/Servers/Linux
> name: vmtest1
>   delegate_to: localhost
>   register: vm_info
>
> - name: Get the datastores associated with the VM
>   set_fact:
>  datastorelist: "{{vm_info.instance.hw_files | join (' ')}}"  #
> #converting list into the srting for easy  when condition use#
>
> - name: checking wheather enter correct datastore
>   assert:
>that:
>  - "datastore_name in datastorelist"
>success_msg: 'VM has correct Datastore.'
>fail_msg: 'Pls Enter the correct Datastore name '
>
> - name: Collecting the datastore information
>   vmware_datastore_info:
> validate_certs: no
> hostname: '{{ vcentername }}'
> username: '{{ vcenter_user }}'
> password: '{{ vcenter_password }}'
> datacenter_name: DFW
> name: '{{datastore_name}}'
>   delegate_to: localhost
>   register: datastore_info
>   when: " datastore_name in datastorelist " # if the datastorelist
> contains the name datastore_name procees furthur#
>
> - set_fact:  datastore_cap="{{datastore_info.datastores[0].capacity
> |float / 1073741824|float }}" # byte to GB converstion
> - set_fact: datastore_free="{{datastore_info.datastores[0].freeSpace
> |float / 1073741824|float}}"
> - set_fact:
> datastore_used="{{datastore_info.datastores[0].provisioned|filesizeformat(true)}}"
> - set_fact: datastore_buffer="{{datastore_free|float -
> disk_size|float}}"
> - set_fact: datastore_buffer_s="{{(datastore_buffer)|float / (
> datastore_cap)|float }}"
> - set_fact: datastore_buffer_percentage="{{100*(datastore_buffer_s)
> |float}}"
>   when: " datastore_name in datastorelist "
>
> - name: Checking wheather datastore having enough disk
>   assert:
> that:
>   - "(datastore_free|float ) > (disk_size|float)"
>   - "(datastore_buffer_percentage |float) > (20.0|float)"
> fail_msg: 'Free Disk is lesser than the required disksize'
> success_msg: 'Free Disk is greater than require disksize'
>
> - name: disk addition should be with either scsi controller with type
> no or controllernumber with type
>   vmware_guest_disk:
>validate_certs: no
>hostname: "{{ vcentername }}"
>username: "{{ vcenter_user }}"
>password: "{{ vcenter_password }}"
>datacenter: DFW
>folder: /DFW/vm/Servers/Linux
>name: vmtest1
>disk:
>- size_gb: "{{disk_size}}"
>  type: thick
>  state: present
>  scsi_controller: 2   #required paramater
>  scsi_type: 'paravirtual' #required paramater
>  datastore: "{{datastore_name}}"
>  unit_number: 3 #required paramater
>  destroy: no
>   when:
> - "(datastore_free|float ) > (disk_size|float)"
> - "( datastore_name) in (datastorelist) "
> - "(datastore_buffer_percentage |float) > (20.0|float)"
>
>
>
> NOT working (multiple servers)
>
> ---
>   - hosts: localhost
> vars_prompt:
>   - name: vcentername
> prompt: "Enter the vcenter name"
> private: no
>   - name: vcenter_user
> prompt: "Enter the username"
> private: no
>   - name: vcenter_password
> prompt: "Enter your password"
> #  - name: disk_size
> #prompt: "Enter the disksize in GB"
> tasks:
> - name: read csv
>   read_csv:
>path: