Re: [EXTERNAL] Re: [ansible-project] rsync failure

2022-08-01 Thread Ashok Reddy
both are in the different hostnames.

On Mon, Aug 1, 2022 at 6:43 PM 'Hearn, Stan J.' via Ansible Project <
ansible-project@googlegroups.com> wrote:

> Isn't src and dest the same place?
>
>
>
>   ansible.posix.synchronize:
>
> src: /root
>
> dest: /root
>
>
>
>
>
> *From:* ansible-project@googlegroups.com 
> *On Behalf Of *John Petro
> *Sent:* Monday, August 1, 2022 8:47 AM
> *To:* ansible-project@googlegroups.com
> *Subject:* [EXTERNAL] Re: [ansible-project] rsync failure
>
>
>
> Have you run the playbook in verbose mode to get more detail?  Maybe
> there's a mis-spelling in the inventory hostname you used or something in
> the inventory.
>
>
>
> The only other idea I have is to copy/paste the msg section that starts
> with "Could" into your search engine of choice and see what comes up
> there.
>
>
>
> --John
>
>
>
> On Mon, Aug 1, 2022, 7:07 AM Ashok Reddy  wrote:
>
> Hi Team,
>
>
>
> whatever i've mentioned the inventory hostname just ref i.e not the actual
> one.
>
>
>
> On Mon, Aug 1, 2022 at 4:18 PM Dick Visser  wrote:
>
>
>
>
>
> On Mon, 1 Aug 2022 at 12:23, Ashok Reddy  wrote:
>
> ---
>
> - hosts: all
>
>   become: true
>
>   become_method: sudo
>
>   gather_facts: true
>
>   tasks:
>
> - name: block
>
>   block:
>
> - name: rsync
>
>   command: "cat /proc/meminfo"
>
>   rescue:
>
> - debug:
>
> msg: proceed to install
>
> - name: install rsync
>
>   dnf:
>
> name: rsync
>
> state: present
>
>   delegate_to: localhost
>
> - name: sync
>
>   ansible.posix.synchronize:
>
> src: /root
>
> dest: /root
>
>   delegate_to: inventory hostname
>
>
>
> Error:
>
>
>
>  FAILED! => {"changed": false, "msg": "Could not determine controller
> hostname for rsync to send to"}
>
>
>
>
>
> The listeral string "inventory hostname" is not a valid hostname. Fix that.
>
> Also, "become_method: sudo" and "gather_facts: true" are both the same as
> the defaults, so you can leave that out.
>
> --
> 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/CAF8BbLa4-JSaG5%2BB2yQ0%2BRm_S-t4JgayH6TJKfxS97%2Bz0Kwinw%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/CAKRLcHg2Sbjz7Ysgkvb5NsFjn9xdm%3DwmVzn4ja4iSTz9BKUpTQ%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/CAPAjob8hCdxBzPhP2CwhbEg6bq%3D9m-Gic4Cor2X%2BL50dHXdfyw%40mail.gmail.com
> 
> .
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/ansible-project/7dszRgDhwxY/unsubscribe.
> To unsubscribe from this group and all its topics, 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/PH0PR10MB5593EC179DC1113880752658F09A9%40PH0PR10MB5593.namprd10.prod.outlook.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and 

Re: [ansible-project] I need to save fact into variable and use it afterwards

2022-08-01 Thread boncalo mihai
I actually worked, Thanks! :)

On Mon, Aug 1, 2022 at 3:18 PM 'Walter Rowe' via Ansible Project <
ansible-project@googlegroups.com> wrote:

> Are all the tasks inside one playbook, or are different tasks in different
> jobs in an ansible tower workflow?
>
> Use set_fact for within-playbook, and set_stats for creating artifacts
> sent back to ansible tower to be presented as extra_vars to downstream jobs
> in a workflow.
>
> For within-playbook:
> - set_fact:
> admin_host: "{{ ansible_nodename }}"
>
> For downstream jobs in a workflow:
> - set_stats:
> data:
>   admin_host: "{{ ansible_nodename }}"
>
> If you need both you can do both. An artifact created with set_stats in a
> playbook cannot be used later in that same playbook as a variable. You have
> to use set_fact for that.
>
> For loading your file within the playbook or downstream
> - name: Set authorized key took from file
>   become: yes
>   authorized_key:
> user: root
> state: present
> key: "{{ lookup('file', '/git/cephprep/files/*' + admin_host + 
> '*/root/.ssh/id_rsa.pub')
> }}"
>
> NOTE that I broke up the file path and inserted the admin_host with "+"
> which in Python (ansible runs on Python) will concatenate strings.
>
> --
> Walter Rowe, Chief
> Infrastructure Service
> Office of Information Systems Management
> National Institute of Standards and Technology
> US Dept of Commerce
> On Thursday, July 28, 2022 at 12:58:11 PM UTC-4 dnmv...@gmail.com wrote:
>
>> Just copy paste with the computer clipboard and not with eyeballs and
>> fingers
>>
>>
>>
>> On Thu, 28 Jul 2022 at 18:53, boncalo mihai  wrote:
>>
>>> Not working unfortunately..:
>>>
>>> TASK [cephprep : Print facts]
>>> 
>>> task path: /git/cephprep/tasks/keyprep.yml:19
>>> ok: [ha01] => {
>>> "ansible_facts[\"nodename\"]": "ha01"
>>> }
>>>
>>> TASK [cephprep : Set authorized key took from file]
>>> **
>>> task path: /git/cephprep/tasks/keyprep.yml:24
>>> fatal: [ha01]: FAILED! => {"msg": "template error while templating
>>> string: unexpected '~'. String: {{ lookup('file', '/git/cephprep/files/' ~
>>>  ~ '/root/.ssh/id_rsa.pub') }}"}
>>> fatal: [ha02]: FAILED! => {"msg": "template error while templating
>>> string: unexpected '~'. String: {{ lookup('file', '/git/cephprep/files/' ~
>>>  ~ '/root/.ssh/id_rsa.pub') }}"}
>>> fatal: [ha03]: FAILED! => {"msg": "template error while templating
>>> string: unexpected '~'. String: {{ lookup('file', '/git/cephprep/files/' ~
>>>  ~ '/root/.ssh/id_rsa.pub') }}"}
>>>
>>> On Thu, Jul 28, 2022 at 7:39 PM Dick Visser  wrote:
>>>
 You can't stack moustaches

 On Thu, 28 Jul 2022 at 17:43, boncalo mihai  wrote:

> I have a task with run_once:true , which must run only on the first
> host and I need to use that hostname into a lookup file , something like
> this:
>
> -
>
>
> * name: Print facts  debug:var: ansible_nodename  register:
> admin_host*
>
>
>
>
>
>
>
> *- name: Set authorized key took from file  become: yes
> authorized_key:user: rootstate: presentkey: "{{ lookup('file',
> '/git/cephprep/files/{{ admin_host }}/root/.ssh/id_rsa.pub') }}"*
>

 Try:

 * key: "{{ lookup('file', '/git/cephprep/files/' ~ admin_host ~
 '/root/.ssh/id_rsa.pub') }}"*



 --
 Sent from Gmail Mobile

 --
 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/CAF8BbLaxe7Le-2Be1waxmzt%2BkSG38aMaduC1_5VAEU%2BPhRXVsA%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-proje...@googlegroups.com.
>>>
>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ansible-project/CAOK917QcWPq1GiNpCtVzFx1Vd7zX_rhjTCqLmoSmfkYDr7ZXfA%40mail.gmail.com
>>> 
>>> .
>>>
>> --
>> Sent from Gmail Mobile
>>
> --
> You received this message because you are subscribed to the Google 

Re: [ansible-project] rsync failure

2022-08-01 Thread John Petro
Have you run the playbook in verbose mode to get more detail?  Maybe
there's a mis-spelling in the inventory hostname you used or something in
the inventory.

The only other idea I have is to copy/paste the msg section that starts
with "Could" into your search engine of choice and see what comes up
there.

--John


On Mon, Aug 1, 2022, 7:07 AM Ashok Reddy  wrote:

> Hi Team,
>
> whatever i've mentioned the inventory hostname just ref i.e not the actual
> one.
>
> On Mon, Aug 1, 2022 at 4:18 PM Dick Visser  wrote:
>
>>
>>
>> On Mon, 1 Aug 2022 at 12:23, Ashok Reddy  wrote:
>>
>>> ---
>>>
>>> - hosts: all
>>>
>>>   become: true
>>>
>>>   become_method: sudo
>>>
>>>   gather_facts: true
>>>
>>>   tasks:
>>>
>>> - name: block
>>>
>>>   block:
>>>
>>> - name: rsync
>>>
>>>   command: "cat /proc/meminfo"
>>>
>>>   rescue:
>>>
>>> - debug:
>>>
>>> msg: proceed to install
>>>
>>> - name: install rsync
>>>
>>>   dnf:
>>>
>>> name: rsync
>>>
>>> state: present
>>>
>>>   delegate_to: localhost
>>>
>>> - name: sync
>>>
>>>   ansible.posix.synchronize:
>>>
>>> src: /root
>>>
>>> dest: /root
>>>
>>>   delegate_to: inventory hostname
>>>
>>>
>>> Error:
>>>
>>>
>>>  FAILED! => {"changed": false, "msg": "Could not determine controller
>>> hostname for rsync to send to"}
>>>
>>
>>
>> The listeral string "inventory hostname" is not a valid hostname. Fix
>> that.
>> Also, "become_method: sudo" and "gather_facts: true" are both the same as
>> the defaults, so you can leave that out.
>>
>> --
>> 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/CAF8BbLa4-JSaG5%2BB2yQ0%2BRm_S-t4JgayH6TJKfxS97%2Bz0Kwinw%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/CAKRLcHg2Sbjz7Ysgkvb5NsFjn9xdm%3DwmVzn4ja4iSTz9BKUpTQ%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/CAPAjob8hCdxBzPhP2CwhbEg6bq%3D9m-Gic4Cor2X%2BL50dHXdfyw%40mail.gmail.com.


Re: [ansible-project] rsync failure

2022-08-01 Thread Dick Visser
Well in that case you will have to find out for yourself why it doesn't
work.

On Mon, 1 Aug 2022 at 13:07, Ashok Reddy  wrote:

> Hi Team,
>
> whatever i've mentioned the inventory hostname just ref i.e not the actual
> one.
>
> On Mon, Aug 1, 2022 at 4:18 PM Dick Visser  wrote:
>
>>
>>
>> On Mon, 1 Aug 2022 at 12:23, Ashok Reddy  wrote:
>>
>>> ---
>>>
>>> - hosts: all
>>>
>>>   become: true
>>>
>>>   become_method: sudo
>>>
>>>   gather_facts: true
>>>
>>>   tasks:
>>>
>>> - name: block
>>>
>>>   block:
>>>
>>> - name: rsync
>>>
>>>   command: "cat /proc/meminfo"
>>>
>>>   rescue:
>>>
>>> - debug:
>>>
>>> msg: proceed to install
>>>
>>> - name: install rsync
>>>
>>>   dnf:
>>>
>>> name: rsync
>>>
>>> state: present
>>>
>>>   delegate_to: localhost
>>>
>>> - name: sync
>>>
>>>   ansible.posix.synchronize:
>>>
>>> src: /root
>>>
>>> dest: /root
>>>
>>>   delegate_to: inventory hostname
>>>
>>>
>>> Error:
>>>
>>>
>>>  FAILED! => {"changed": false, "msg": "Could not determine controller
>>> hostname for rsync to send to"}
>>>
>>
>>
>> The listeral string "inventory hostname" is not a valid hostname. Fix
>> that.
>> Also, "become_method: sudo" and "gather_facts: true" are both the same as
>> the defaults, so you can leave that out.
>>
>> --
>> 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/CAF8BbLa4-JSaG5%2BB2yQ0%2BRm_S-t4JgayH6TJKfxS97%2Bz0Kwinw%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/CAKRLcHg2Sbjz7Ysgkvb5NsFjn9xdm%3DwmVzn4ja4iSTz9BKUpTQ%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/CAF8BbLZ-%2BBe1aDpKKv5%2BWY8mS7GoK7%2BTsWebbWOj0QR%2BqQSNHg%40mail.gmail.com.


[ansible-project] Re: sucessfully ran single play but not when the play is part of a task in the pb

2022-08-01 Thread 'Walter Rowe' via Ansible Project
Only this would need to be part of a larger playbook unless you want a 
playbook to have multiple PLAYS.

  - name: run rke installer 
shell: 'rke up'
args:
  chdir: "/home/rke"  
become: yes
become_user: "rke"
delegate_to: localhost
register: result
  - debug:
  msg: "{{ result }} "


On Monday, July 25, 2022 at 8:23:26 PM UTC-4 tdub...@gmail.com wrote:

> I sucessully ran this play as a single play
>
> ---
> - hosts: localhost
>   name: test
>   tasks:
>   - name: run rke installer 
> shell: 'rke up'
> args:
>   chdir: "/home/rke"  
> become: yes
> become_user: "rke"
> delegate_to: localhost
> register: result
>   - debug:
>   msg: "{{ result }} "
>
>
> however this did not work as part of a playbook task
>
>
>

-- 
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/2d71f7f0-86ba-4be8-8788-d335398d34edn%40googlegroups.com.


Re: [ansible-project] Deploying Windows Server using Ansible Tower

2022-08-01 Thread Wei-Yen Tan
Ahh yes. So as I suggested. You are using what I suggested to the op before

Get Outlook for iOS

From: 'Walter Rowe' via Ansible Project 
Sent: Tuesday, August 2, 2022 12:25:30 AM
To: Ansible Project 
Subject: Re: [ansible-project] Deploying Windows Server using Ansible Tower

Yes. We use TWO plays in a playbook. The first play uses an extra_var of the 
hostname to create a new host group. The second play scopes its inventory to 
that host group.

In our workflow the new machines' name comes in as an extra var called 
vm_guest_name.

##
## play 1: add new machine to inventory
##
- name: Add new host to playbook inventory
  hosts: localhost
  gather_facts: no
  tasks:

# add our new host to the inventory for this play
- name: add {{ vm_guest_name | lower }}
  add_host:
name: "{{ vm_guest_name | lower }}"
group: newvm

##
## play 2: customize new machine
##
- name: "Customize Server - Linux - Set Time Zone, Hostname, Join AD"
  gather_facts: no
  hosts: newvm
  become: yes

--
Walter Rowe, Chief
Infrastructure Services
Office of Information Systems Management
National Institute of Standards and Technology
United States Department of Commerce
On Monday, August 1, 2022 at 8:05:01 AM UTC-4 weiye...@gmail.com wrote:
It's that the add_host directive?

Get Outlook for iOS

From: 'Walter Rowe' via Ansible Project 
Sent: Monday, August 1, 2022 11:58:48 PM
To: Ansible Project 
Subject: Re: [ansible-project] Deploying Windows Server using Ansible Tower

One more item I will add .. in our Customize step of our workflow we do create 
an in-memory inventory with the new machine name so the steps in that lengthy 
process have an inventory to work on.

--
Walter Rowe, Chief
Infrastructure Services
walte...@nist.gov

Office of Information Systems Mgmt
National Institute of Standards and Technology
US Department of Commerce
On Monday, August 1, 2022 at 7:43:24 AM UTC-4 Walter Rowe wrote:
The "secret" to any good provisioning workflow is to parameterize EVERYTHING. 
We feed user specifications from a ServiceNow request into our Ansible Tower 
workflow. These specifications include what network, what AD OU to deposit the 
new computer object we create, what function the server will provide, what OS 
and version (windows 2016, windows 2019, ubuntu 20, ubuntu22, redhat8, rocky8, 
debian10, debian11, etc), AWS or VMware, etc. Our playbooks in ansible tower 
use most of these parameters from the ServiceNow request as keys into 
dictionaries or as indicators of specific vars files to import that have 
detailed specifications in YAML format we can use to do all our work for 
provisioning. We can add new operating system versions, new cloud service 
providers, new machine purposes and describe all of these in our vars files and 
parameters from ServiceNow. We have to make few if any changes to the actual 
playbooks. Even attached storage is described in a JSON list that cleverly has 
all the disks associated with each machine type for both Windows and Linux. A 
json_query lets us pull out the records we need from the JSON list.
--
Walter Rowe, Chief
Infrastructure Services
walte...@nist.gov

Office of Information Systems Mgmt
National Institute of Standards and Technology
US Department of Commerce

On Monday, August 1, 2022 at 7:30:28 AM UTC-4 Walter Rowe wrote:
You don't need the machine added to an inventory and you don't need ansible 
tower callbacks. The vmware_guest module doesn't require either one. You do 
need to know the name of the new machine in a variable.

We have a very elaborate ServiceNow -> Ansible Tower request and deliver 
workflow. We create the VMs (or EC2s in AWS), then create the DNS record, then 
do OS level machine customization.

Email be directly and I can set up a TEAMS call to show you our playbook for 
creating a machine in VMware.

[ASP-Workflow-Concept.png]

On Friday, July 29, 2022 at 3:28:03 PM UTC-4 ehi...@gmail.com wrote:
Sounds like good use of Tower callback function. That way Tower does not have 
to know anything about the new host. Just be sure the windows image is 
configure for ansible, and then use either a cloud_init or or a first run 
script to execute the callback.

On Fri, Jul 29, 2022, 12:18 PM Wei-Yen Tan  wrote:
You can use add_host to the playbook that generates In memory hosts during the 
execution run

Get Outlook for iOS

From: 'Nicholas Branson' via Ansible Project 
Sent: Friday, July 29, 2022 10:31:11 PM
To: Ansible Project 
Subject: [ansible-project] Deploying Windows Server using Ansible Tower

Ansible Newbie Calling...

We have Ansible Tower and Satellite.

I've been asked to look at Deploying Windows Server using Ansible Tower.

I've created a win2019-tmp (template) in VMware

Now I need to look at creating a Role playbook to deploy a Windows system in 
VMware.

I've made a start on 

[ansible-project] Re: Ansible Tower Survey

2022-08-01 Thread 'Walter Rowe' via Ansible Project
Look at the ansible tower API. You can query job and workflow surveys. You 
can even set them!

--
Walter Rowe, Chief
Infrastructure Services
Office of Information Systems Management
National Institute of Standards and Technology
United States Department of Commerce

On Tuesday, July 26, 2022 at 10:28:27 AM UTC-4 chris.b...@gmail.com wrote:

> Morning, community, 
>
> Does anyone know if it is possible to store a Survey in a code repo like 
> Git or somehow back Surveys up more generally?  I'm just not able to find a 
> lot of info on this.
>
> Thanks! 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c3855371-aba3-4efc-a857-a40a5812c436n%40googlegroups.com.


Re: [ansible-project] Deploying Windows Server using Ansible Tower

2022-08-01 Thread 'Walter Rowe' via Ansible Project
Yes. We use TWO plays in a playbook. The first play uses an extra_var of 
the hostname to create a new host group. The second play scopes its 
inventory to that host group.

In our workflow the new machines' name comes in as an extra var called 
vm_guest_name.

##

*## play 1: add new machine to inventory*##
- name: Add new host to playbook inventory
  hosts: localhost
  gather_facts: no
  tasks:

# add our new host to the inventory for this play




*- name: add {{ vm_guest_name | lower }}  add_host:name: 
"{{ vm_guest_name | lower }}"group: newvm*
##

*## play 2: customize new machine*##
- name: "Customize Server - Linux - Set Time Zone, Hostname, Join AD"
  gather_facts: no

*  hosts: newvm*  become: yes

--
Walter Rowe, Chief
Infrastructure Services
Office of Information Systems Management
National Institute of Standards and Technology
United States Department of Commerce
On Monday, August 1, 2022 at 8:05:01 AM UTC-4 weiye...@gmail.com wrote:

> It's that the add_host directive? 
>
> Get Outlook for iOS 
> --
> *From:* 'Walter Rowe' via Ansible Project 
> *Sent:* Monday, August 1, 2022 11:58:48 PM
> *To:* Ansible Project 
> *Subject:* Re: [ansible-project] Deploying Windows Server using Ansible 
> Tower 
>  
> One more item I will add .. in our Customize step of our workflow we do 
> create an in-memory inventory with the new machine name so the steps in 
> that lengthy process have an inventory to work on.
>
> --
> Walter Rowe, Chief
> Infrastructure Services
> walte...@nist.gov
>
> Office of Information Systems Mgmt
> National Institute of Standards and Technology
> US Department of Commerce
> On Monday, August 1, 2022 at 7:43:24 AM UTC-4 Walter Rowe wrote:
>
> The "secret" to any good provisioning workflow is to parameterize 
> EVERYTHING. We feed user specifications from a ServiceNow request into our 
> Ansible Tower workflow. These specifications include what network, what AD 
> OU to deposit the new computer object we create, what function the server 
> will provide, what OS and version (windows 2016, windows 2019, ubuntu 20, 
> ubuntu22, redhat8, rocky8, debian10, debian11, etc), AWS or VMware, etc. 
> Our playbooks in ansible tower use most of these parameters from the 
> ServiceNow request as keys into dictionaries or as indicators of specific 
> vars files to import that have detailed specifications in YAML format we 
> can use to do all our work for provisioning. We can add new operating 
> system versions, new cloud service providers, new machine purposes and 
> describe all of these in our vars files and parameters from ServiceNow. We 
> have to make few if any changes to the actual playbooks. Even attached 
> storage is described in a JSON list that cleverly has all the disks 
> associated with each machine type for both Windows and Linux. A json_query 
> lets us pull out the records we need from the JSON list. 
> --
> Walter Rowe, Chief
> Infrastructure Services
> walte...@nist.gov
>
> Office of Information Systems Mgmt
> National Institute of Standards and Technology
> US Department of Commerce
>
> On Monday, August 1, 2022 at 7:30:28 AM UTC-4 Walter Rowe wrote:
>
> You don't need the machine added to an inventory and you don't need 
> ansible tower callbacks. The vmware_guest module doesn't require either 
> one. You do need to know the name of the new machine in a variable.
>
> We have a very elaborate ServiceNow -> Ansible Tower request and deliver 
> workflow. We create the VMs (or EC2s in AWS), then create the DNS record, 
> then do OS level machine customization.
>
> Email be directly and I can set up a TEAMS call to show you our playbook 
> for creating a machine in VMware.
>
> [image: ASP-Workflow-Concept.png]
>
> On Friday, July 29, 2022 at 3:28:03 PM UTC-4 ehi...@gmail.com wrote:
>
> Sounds like good use of Tower callback function. That way Tower does not 
> have to know anything about the new host. Just be sure the windows image is 
> configure for ansible, and then use either a cloud_init or or a first run 
> script to execute the callback.
>
> On Fri, Jul 29, 2022, 12:18 PM Wei-Yen Tan  wrote:
>
> You can use add_host to the playbook that generates In memory hosts during 
> the execution run 
>
> Get Outlook for iOS 
> --
> *From:* 'Nicholas Branson' via Ansible Project <
> ansible...@googlegroups.com>
> *Sent:* Friday, July 29, 2022 10:31:11 PM
> *To:* Ansible Project 
> *Subject:* [ansible-project] Deploying Windows Server using Ansible Tower 
>  
> Ansible Newbie Calling... 
>
> We have Ansible Tower and Satellite. 
>
> I've been asked to look at Deploying Windows Server using Ansible Tower.
>
> I've created a win2019-tmp (template) in VMware
>
> Now I need to look at creating a Role playbook to deploy a Windows system 
> in VMware.
>
> I've made a start on the main.yml and vars.yml files but I am not sure 
> they will run on my new pipeline 

Re: [ansible-project] I need to save fact into variable and use it afterwards

2022-08-01 Thread 'Walter Rowe' via Ansible Project
Are all the tasks inside one playbook, or are different tasks in different 
jobs in an ansible tower workflow?

Use set_fact for within-playbook, and set_stats for creating artifacts sent 
back to ansible tower to be presented as extra_vars to downstream jobs in a 
workflow.

For within-playbook:
- set_fact:
admin_host: "{{ ansible_nodename }}"

For downstream jobs in a workflow:
- set_stats:
data:
  admin_host: "{{ ansible_nodename }}"

If you need both you can do both. An artifact created with set_stats in a 
playbook cannot be used later in that same playbook as a variable. You have 
to use set_fact for that.

For loading your file within the playbook or downstream
- name: Set authorized key took from file
  become: yes
  authorized_key:
user: root
state: present
key: "{{ lookup('file', '/git/cephprep/files/*' + admin_host + 
'*/root/.ssh/id_rsa.pub') 
}}"

NOTE that I broke up the file path and inserted the admin_host with "+" 
which in Python (ansible runs on Python) will concatenate strings.

--
Walter Rowe, Chief
Infrastructure Service
Office of Information Systems Management
National Institute of Standards and Technology
US Dept of Commerce
On Thursday, July 28, 2022 at 12:58:11 PM UTC-4 dnmv...@gmail.com wrote:

> Just copy paste with the computer clipboard and not with eyeballs and 
> fingers 
>
>
>
> On Thu, 28 Jul 2022 at 18:53, boncalo mihai  wrote:
>
>> Not working unfortunately..:
>>
>> TASK [cephprep : Print facts] 
>> 
>> task path: /git/cephprep/tasks/keyprep.yml:19
>> ok: [ha01] => {
>> "ansible_facts[\"nodename\"]": "ha01"
>> }
>>
>> TASK [cephprep : Set authorized key took from file] 
>> **
>> task path: /git/cephprep/tasks/keyprep.yml:24
>> fatal: [ha01]: FAILED! => {"msg": "template error while templating 
>> string: unexpected '~'. String: {{ lookup('file', '/git/cephprep/files/' ~ 
>>  ~ '/root/.ssh/id_rsa.pub') }}"}
>> fatal: [ha02]: FAILED! => {"msg": "template error while templating 
>> string: unexpected '~'. String: {{ lookup('file', '/git/cephprep/files/' ~ 
>>  ~ '/root/.ssh/id_rsa.pub') }}"}
>> fatal: [ha03]: FAILED! => {"msg": "template error while templating 
>> string: unexpected '~'. String: {{ lookup('file', '/git/cephprep/files/' ~ 
>>  ~ '/root/.ssh/id_rsa.pub') }}"}
>>
>> On Thu, Jul 28, 2022 at 7:39 PM Dick Visser  wrote:
>>
>>> You can't stack moustaches 
>>>
>>> On Thu, 28 Jul 2022 at 17:43, boncalo mihai  wrote:
>>>
 I have a task with run_once:true , which must run only on the first 
 host and I need to use that hostname into a lookup file , something like 
 this:

 -


 * name: Print facts  debug:var: ansible_nodename  register: 
 admin_host*







 *- name: Set authorized key took from file  become: yes  
 authorized_key:user: rootstate: presentkey: "{{ lookup('file', 
 '/git/cephprep/files/{{ admin_host }}/root/.ssh/id_rsa.pub') }}"*

>>>
>>> Try:
>>>
>>> * key: "{{ lookup('file', '/git/cephprep/files/' ~ admin_host ~ 
>>> '/root/.ssh/id_rsa.pub') }}"*
>>>
>>>
>>>
>>> -- 
>>> Sent from Gmail Mobile
>>>
>>> -- 
>>> 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/CAF8BbLaxe7Le-2Be1waxmzt%2BkSG38aMaduC1_5VAEU%2BPhRXVsA%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-proje...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/CAOK917QcWPq1GiNpCtVzFx1Vd7zX_rhjTCqLmoSmfkYDr7ZXfA%40mail.gmail.com
>>  
>> 
>> .
>>
> -- 
> Sent from Gmail Mobile
>

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

Re: [ansible-project] Deploying Windows Server using Ansible Tower

2022-08-01 Thread Wei-Yen Tan
It's that the add_host directive?

Get Outlook for iOS

From: 'Walter Rowe' via Ansible Project 
Sent: Monday, August 1, 2022 11:58:48 PM
To: Ansible Project 
Subject: Re: [ansible-project] Deploying Windows Server using Ansible Tower

One more item I will add .. in our Customize step of our workflow we do create 
an in-memory inventory with the new machine name so the steps in that lengthy 
process have an inventory to work on.

--
Walter Rowe, Chief
Infrastructure Services
walter.r...@nist.gov

Office of Information Systems Mgmt
National Institute of Standards and Technology
US Department of Commerce
On Monday, August 1, 2022 at 7:43:24 AM UTC-4 Walter Rowe wrote:
The "secret" to any good provisioning workflow is to parameterize EVERYTHING. 
We feed user specifications from a ServiceNow request into our Ansible Tower 
workflow. These specifications include what network, what AD OU to deposit the 
new computer object we create, what function the server will provide, what OS 
and version (windows 2016, windows 2019, ubuntu 20, ubuntu22, redhat8, rocky8, 
debian10, debian11, etc), AWS or VMware, etc. Our playbooks in ansible tower 
use most of these parameters from the ServiceNow request as keys into 
dictionaries or as indicators of specific vars files to import that have 
detailed specifications in YAML format we can use to do all our work for 
provisioning. We can add new operating system versions, new cloud service 
providers, new machine purposes and describe all of these in our vars files and 
parameters from ServiceNow. We have to make few if any changes to the actual 
playbooks. Even attached storage is described in a JSON list that cleverly has 
all the disks associated with each machine type for both Windows and Linux. A 
json_query lets us pull out the records we need from the JSON list.
--
Walter Rowe, Chief
Infrastructure Services
walte...@nist.gov

Office of Information Systems Mgmt
National Institute of Standards and Technology
US Department of Commerce

On Monday, August 1, 2022 at 7:30:28 AM UTC-4 Walter Rowe wrote:
You don't need the machine added to an inventory and you don't need ansible 
tower callbacks. The vmware_guest module doesn't require either one. You do 
need to know the name of the new machine in a variable.

We have a very elaborate ServiceNow -> Ansible Tower request and deliver 
workflow. We create the VMs (or EC2s in AWS), then create the DNS record, then 
do OS level machine customization.

Email be directly and I can set up a TEAMS call to show you our playbook for 
creating a machine in VMware.

[ASP-Workflow-Concept.png]

On Friday, July 29, 2022 at 3:28:03 PM UTC-4 ehi...@gmail.com wrote:
Sounds like good use of Tower callback function. That way Tower does not have 
to know anything about the new host. Just be sure the windows image is 
configure for ansible, and then use either a cloud_init or or a first run 
script to execute the callback.

On Fri, Jul 29, 2022, 12:18 PM Wei-Yen Tan  wrote:
You can use add_host to the playbook that generates In memory hosts during the 
execution run

Get Outlook for iOS

From: 'Nicholas Branson' via Ansible Project 
Sent: Friday, July 29, 2022 10:31:11 PM
To: Ansible Project 
Subject: [ansible-project] Deploying Windows Server using Ansible Tower

Ansible Newbie Calling...

We have Ansible Tower and Satellite.

I've been asked to look at Deploying Windows Server using Ansible Tower.

I've created a win2019-tmp (template) in VMware

Now I need to look at creating a Role playbook to deploy a Windows system in 
VMware.

I've made a start on the main.yml and vars.yml files but I am not sure they 
will run on my new pipeline yet.

Is there a way to check if the pipeline is ready to test playbooks on ?

Also, since I will be deploying a Windows Server that has not been created yet, 
how can I put any info in the Ansible Tower Template Inventory area if it does 
not exist?

I hope someone can help me with Windows deployements using Ansible. I couldn't 
find a suitable Red Hat course for this.

Thanks
Nick






DISCLAIMER

This email is confidential and subject to important disclaimers and conditions 
in relation to monitoring, viruses, confidentiality and legal privilege full 
details of which can be viewed on our Email Policy at the following link: 
http://www.next.co.uk/Policy/

Next Holdings Ltd registered in England 35161.  Registered Office Desford Road 
Enderby Leicester LE19 4AT.  Authorised and regulated by the Financial Conduct 
Authority

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

Re: [ansible-project] Deploying Windows Server using Ansible Tower

2022-08-01 Thread 'Walter Rowe' via Ansible Project
One more item I will add .. in our Customize step of our workflow we do 
create an in-memory inventory with the new machine name so the steps in 
that lengthy process have an inventory to work on.

--
Walter Rowe, Chief
Infrastructure Services
walter.r...@nist.gov

Office of Information Systems Mgmt
National Institute of Standards and Technology
US Department of Commerce
On Monday, August 1, 2022 at 7:43:24 AM UTC-4 Walter Rowe wrote:

> The "secret" to any good provisioning workflow is to parameterize 
> EVERYTHING. We feed user specifications from a ServiceNow request into our 
> Ansible Tower workflow. These specifications include what network, what AD 
> OU to deposit the new computer object we create, what function the server 
> will provide, what OS and version (windows 2016, windows 2019, ubuntu 20, 
> ubuntu22, redhat8, rocky8, debian10, debian11, etc), AWS or VMware, etc. 
> Our playbooks in ansible tower use most of these parameters from the 
> ServiceNow request as keys into dictionaries or as indicators of specific 
> vars files to import that have detailed specifications in YAML format we 
> can use to do all our work for provisioning. We can add new operating 
> system versions, new cloud service providers, new machine purposes and 
> describe all of these in our vars files and parameters from ServiceNow. We 
> have to make few if any changes to the actual playbooks. Even attached 
> storage is described in a JSON list that cleverly has all the disks 
> associated with each machine type for both Windows and Linux. A json_query 
> lets us pull out the records we need from the JSON list.
> --
> Walter Rowe, Chief
> Infrastructure Services
> walte...@nist.gov
>
> Office of Information Systems Mgmt
> National Institute of Standards and Technology
> US Department of Commerce
>
> On Monday, August 1, 2022 at 7:30:28 AM UTC-4 Walter Rowe wrote:
>
>> You don't need the machine added to an inventory and you don't need 
>> ansible tower callbacks. The vmware_guest module doesn't require either 
>> one. You do need to know the name of the new machine in a variable.
>>
>> We have a very elaborate ServiceNow -> Ansible Tower request and deliver 
>> workflow. We create the VMs (or EC2s in AWS), then create the DNS record, 
>> then do OS level machine customization.
>>
>> Email be directly and I can set up a TEAMS call to show you our playbook 
>> for creating a machine in VMware.
>>
>> [image: ASP-Workflow-Concept.png]
>>
>> On Friday, July 29, 2022 at 3:28:03 PM UTC-4 ehi...@gmail.com wrote:
>>
>>> Sounds like good use of Tower callback function. That way Tower does not 
>>> have to know anything about the new host. Just be sure the windows image is 
>>> configure for ansible, and then use either a cloud_init or or a first run 
>>> script to execute the callback.
>>>
>>> On Fri, Jul 29, 2022, 12:18 PM Wei-Yen Tan  wrote:
>>>
 You can use add_host to the playbook that generates In memory hosts 
 during the execution run 

 Get Outlook for iOS 
 --
 *From:* 'Nicholas Branson' via Ansible Project <
 ansible...@googlegroups.com>
 *Sent:* Friday, July 29, 2022 10:31:11 PM
 *To:* Ansible Project 
 *Subject:* [ansible-project] Deploying Windows Server using Ansible 
 Tower 
  
 Ansible Newbie Calling... 

 We have Ansible Tower and Satellite. 

 I've been asked to look at Deploying Windows Server using Ansible Tower.

 I've created a win2019-tmp (template) in VMware

 Now I need to look at creating a Role playbook to deploy a Windows 
 system in VMware.

 I've made a start on the main.yml and vars.yml files but I am not sure 
 they will run on my new pipeline yet. 

 Is there a way to check if the pipeline is ready to test playbooks on ?

 Also, since I will be deploying a Windows Server that has not been 
 created yet, how can I put any info in the Ansible Tower Template 
 Inventory 
 area if it does not exist?  

 I hope someone can help me with Windows deployements using Ansible. I 
 couldn't find a suitable Red Hat course for this.

 Thanks
 Nick





 DISCLAIMER

 This email is confidential and subject to important disclaimers and 
 conditions in relation to monitoring, viruses, confidentiality and legal 
 privilege full details of which can be viewed on our Email Policy at the 
 following link: http://www.next.co.uk/Policy/

 Next Holdings Ltd registered in England 35161.  Registered Office 
 Desford Road Enderby Leicester LE19 4AT.  Authorised and regulated by the 
 Financial Conduct Authority

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

Re: [ansible-project] Deploying Windows Server using Ansible Tower

2022-08-01 Thread 'Walter Rowe' via Ansible Project
The "secret" to any good provisioning workflow is to parameterize 
EVERYTHING. We feed user specifications from a ServiceNow request into our 
Ansible Tower workflow. These specifications include what network, what AD 
OU to deposit the new computer object we create, what function the server 
will provide, what OS and version (windows 2016, windows 2019, ubuntu 20, 
ubuntu22, redhat8, rocky8, debian10, debian11, etc), AWS or VMware, etc. 
Our playbooks in ansible tower use most of these parameters from the 
ServiceNow request as keys into dictionaries or as indicators of specific 
vars files to import that have detailed specifications in YAML format we 
can use to do all our work for provisioning. We can add new operating 
system versions, new cloud service providers, new machine purposes and 
describe all of these in our vars files and parameters from ServiceNow. We 
have to make few if any changes to the actual playbooks. Even attached 
storage is described in a JSON list that cleverly has all the disks 
associated with each machine type for both Windows and Linux. A json_query 
lets us pull out the records we need from the JSON list.
--
Walter Rowe, Chief
Infrastructure Services
walter.r...@nist.gov

Office of Information Systems Mgmt
National Institute of Standards and Technology
US Department of Commerce

On Monday, August 1, 2022 at 7:30:28 AM UTC-4 Walter Rowe wrote:

> You don't need the machine added to an inventory and you don't need 
> ansible tower callbacks. The vmware_guest module doesn't require either 
> one. You do need to know the name of the new machine in a variable.
>
> We have a very elaborate ServiceNow -> Ansible Tower request and deliver 
> workflow. We create the VMs (or EC2s in AWS), then create the DNS record, 
> then do OS level machine customization.
>
> Email be directly and I can set up a TEAMS call to show you our playbook 
> for creating a machine in VMware.
>
> [image: ASP-Workflow-Concept.png]
>
> On Friday, July 29, 2022 at 3:28:03 PM UTC-4 ehi...@gmail.com wrote:
>
>> Sounds like good use of Tower callback function. That way Tower does not 
>> have to know anything about the new host. Just be sure the windows image is 
>> configure for ansible, and then use either a cloud_init or or a first run 
>> script to execute the callback.
>>
>> On Fri, Jul 29, 2022, 12:18 PM Wei-Yen Tan  wrote:
>>
>>> You can use add_host to the playbook that generates In memory hosts 
>>> during the execution run 
>>>
>>> Get Outlook for iOS 
>>> --
>>> *From:* 'Nicholas Branson' via Ansible Project <
>>> ansible...@googlegroups.com>
>>> *Sent:* Friday, July 29, 2022 10:31:11 PM
>>> *To:* Ansible Project 
>>> *Subject:* [ansible-project] Deploying Windows Server using Ansible 
>>> Tower 
>>>  
>>> Ansible Newbie Calling... 
>>>
>>> We have Ansible Tower and Satellite. 
>>>
>>> I've been asked to look at Deploying Windows Server using Ansible Tower.
>>>
>>> I've created a win2019-tmp (template) in VMware
>>>
>>> Now I need to look at creating a Role playbook to deploy a Windows 
>>> system in VMware.
>>>
>>> I've made a start on the main.yml and vars.yml files but I am not sure 
>>> they will run on my new pipeline yet. 
>>>
>>> Is there a way to check if the pipeline is ready to test playbooks on ?
>>>
>>> Also, since I will be deploying a Windows Server that has not been 
>>> created yet, how can I put any info in the Ansible Tower Template Inventory 
>>> area if it does not exist?  
>>>
>>> I hope someone can help me with Windows deployements using Ansible. I 
>>> couldn't find a suitable Red Hat course for this.
>>>
>>> Thanks
>>> Nick
>>>
>>>
>>>
>>>
>>>
>>> DISCLAIMER
>>>
>>> This email is confidential and subject to important disclaimers and 
>>> conditions in relation to monitoring, viruses, confidentiality and legal 
>>> privilege full details of which can be viewed on our Email Policy at the 
>>> following link: http://www.next.co.uk/Policy/
>>>
>>> Next Holdings Ltd registered in England 35161.  Registered Office 
>>> Desford Road Enderby Leicester LE19 4AT.  Authorised and regulated by the 
>>> Financial Conduct Authority
>>>
>>> -- 
>>> 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/a54de861-ffef-4f15-bffa-46d472101ec2n%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-proje...@googlegroups.com.
>>>
>> To view 

Re: [ansible-project] rsync failure

2022-08-01 Thread Ashok Reddy
Hi Team,

whatever i've mentioned the inventory hostname just ref i.e not the actual
one.

On Mon, Aug 1, 2022 at 4:18 PM Dick Visser  wrote:

>
>
> On Mon, 1 Aug 2022 at 12:23, Ashok Reddy  wrote:
>
>> ---
>>
>> - hosts: all
>>
>>   become: true
>>
>>   become_method: sudo
>>
>>   gather_facts: true
>>
>>   tasks:
>>
>> - name: block
>>
>>   block:
>>
>> - name: rsync
>>
>>   command: "cat /proc/meminfo"
>>
>>   rescue:
>>
>> - debug:
>>
>> msg: proceed to install
>>
>> - name: install rsync
>>
>>   dnf:
>>
>> name: rsync
>>
>> state: present
>>
>>   delegate_to: localhost
>>
>> - name: sync
>>
>>   ansible.posix.synchronize:
>>
>> src: /root
>>
>> dest: /root
>>
>>   delegate_to: inventory hostname
>>
>>
>> Error:
>>
>>
>>  FAILED! => {"changed": false, "msg": "Could not determine controller
>> hostname for rsync to send to"}
>>
>
>
> The listeral string "inventory hostname" is not a valid hostname. Fix that.
> Also, "become_method: sudo" and "gather_facts: true" are both the same as
> the defaults, so you can leave that out.
>
> --
> 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/CAF8BbLa4-JSaG5%2BB2yQ0%2BRm_S-t4JgayH6TJKfxS97%2Bz0Kwinw%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/CAKRLcHg2Sbjz7Ysgkvb5NsFjn9xdm%3DwmVzn4ja4iSTz9BKUpTQ%40mail.gmail.com.


Re: [ansible-project] rsync failure

2022-08-01 Thread Dick Visser
On Mon, 1 Aug 2022 at 12:23, Ashok Reddy  wrote:

> ---
>
> - hosts: all
>
>   become: true
>
>   become_method: sudo
>
>   gather_facts: true
>
>   tasks:
>
> - name: block
>
>   block:
>
> - name: rsync
>
>   command: "cat /proc/meminfo"
>
>   rescue:
>
> - debug:
>
> msg: proceed to install
>
> - name: install rsync
>
>   dnf:
>
> name: rsync
>
> state: present
>
>   delegate_to: localhost
>
> - name: sync
>
>   ansible.posix.synchronize:
>
> src: /root
>
> dest: /root
>
>   delegate_to: inventory hostname
>
>
> Error:
>
>
>  FAILED! => {"changed": false, "msg": "Could not determine controller
> hostname for rsync to send to"}
>


The listeral string "inventory hostname" is not a valid hostname. Fix that.
Also, "become_method: sudo" and "gather_facts: true" are both the same as
the defaults, so you can leave that out.

-- 
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/CAF8BbLa4-JSaG5%2BB2yQ0%2BRm_S-t4JgayH6TJKfxS97%2Bz0Kwinw%40mail.gmail.com.


Re: [ansible-project] rsync failure

2022-08-01 Thread Ashok Reddy
---

- hosts: all

  become: true

  become_method: sudo

  gather_facts: true

  tasks:

- name: block

  block:

- name: rsync

  command: "cat /proc/meminfo"

  rescue:

- debug:

msg: proceed to install

- name: install rsync

  dnf:

name: rsync

state: present

  delegate_to: localhost

- name: sync

  ansible.posix.synchronize:

src: /root

dest: /root

  delegate_to: inventory hostname


Error:


 FAILED! => {"changed": false, "msg": "Could not determine controller
hostname for rsync to send to"}



On Mon, Aug 1, 2022 at 1:07 PM dulhaver via Ansible Project <
ansible-project@googlegroups.com> wrote:

>
> > On 08/01/2022 9:04 AM CEST Ashok Reddy  wrote:
> >
> >
> > ---
> > - hosts: all
> >  become: true
> >  become_method: sudo
> >  gather_facts: true
> >  tasks:
> >  - name: rsync
> >  ansible.posix.synchronize:
> >  src: /root
> >  dest: /root
> >  delegate_to: hostname
> >
> >
> > error:
> >
> >
> > TASK [rsync]
> **
> > fatal: [ FAILED! => {"changed": false, "msg": "Failed to find required
> executable \"rsync\" in paths:
> /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin"}
> > fatal: [localhost -> ]: FAILED! => {"changed": false, "msg": "Could not
> determine controller hostname for rsync to send to"}
> >
> > PLAY RECAP
> ***
>
> my guess: Ansible detects that the host has no rsync installed, so the
> TASK can not be executed.
> So you'd you have to create a preceeding (package/yum/apt) TASK that makes
> sure rsync is installed on the hosts in order to make this work.
>
> --
> 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/931614963.59128.1659339453322%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/CAKRLcHivNDFmVEMYgo6WLL%3DtHsa1RJK1BGOeLLt6pNZcAO4T9A%40mail.gmail.com.


Re: [ansible-project] failed instances

2022-08-01 Thread Dick Visser
Once you've solved that you will also run into another undefined variable:
_failed



On Mon, 1 Aug 2022 at 09:46, Abhijeet Kasurde  wrote:

> 'ok' is undefined
>
> On Mon, Aug 1, 2022 at 12:24 PM Ashok Reddy  wrote:
>
>>
>>
>>
>> ---
>> - hosts: all
>>   become: true
>>   become_method: sudo
>>   gather_facts: false
>>   vars:
>> - failed: "{{ ansible_play_hosts_all | difference(ansible_play_hosts)
>> }}"
>>   tasks:
>> - assert:
>> that: ok | bool
>> - debug:
>> var: _failed
>>
>> error;
>>
>> TASK [assert]
>> *
>> fatal: [modsec-pakistan.tt040sqa3.dev.sicpa.io]: FAILED! => {"msg": "The
>> conditional check 'ok | bool' failed. The error was: error while evaluating
>> conditional (ok | bool): 'ok' is undefined"}
>> fatal: [localhost]: FAILED! => {"msg": "The conditional check 'ok | bool'
>> failed. The error was: error while evaluating conditional (ok | bool): 'ok'
>> is undefined"}
>>
>> --
>> 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/8f0640f3-5fa2-4e29-abcf-d320ccaffe2dn%40googlegroups.com
>> 
>> .
>>
>
>
> --
> Thanks,
> Abhijeet Kasurde
>
> --
> 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/CAFwWkHobDjDHrPh19%2BZXLfedAWF%2BKq-cCLEam8jOJXj%3DZKRvjg%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/CAF8BbLYUH%3DmFPJJN11czBvC%3DA5c5r5ohZ6aQJD_O7g15KK2nVg%40mail.gmail.com.


Re: [ansible-project] failed instances

2022-08-01 Thread Abhijeet Kasurde
'ok' is undefined

On Mon, Aug 1, 2022 at 12:24 PM Ashok Reddy  wrote:

>
>
>
> ---
> - hosts: all
>   become: true
>   become_method: sudo
>   gather_facts: false
>   vars:
> - failed: "{{ ansible_play_hosts_all | difference(ansible_play_hosts)
> }}"
>   tasks:
> - assert:
> that: ok | bool
> - debug:
> var: _failed
>
> error;
>
> TASK [assert]
> *
> fatal: [modsec-pakistan.tt040sqa3.dev.sicpa.io]: FAILED! => {"msg": "The
> conditional check 'ok | bool' failed. The error was: error while evaluating
> conditional (ok | bool): 'ok' is undefined"}
> fatal: [localhost]: FAILED! => {"msg": "The conditional check 'ok | bool'
> failed. The error was: error while evaluating conditional (ok | bool): 'ok'
> is undefined"}
>
> --
> 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/8f0640f3-5fa2-4e29-abcf-d320ccaffe2dn%40googlegroups.com
> 
> .
>


-- 
Thanks,
Abhijeet Kasurde

-- 
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/CAFwWkHobDjDHrPh19%2BZXLfedAWF%2BKq-cCLEam8jOJXj%3DZKRvjg%40mail.gmail.com.


Re: [ansible-project] rsync failure

2022-08-01 Thread dulhaver via Ansible Project


> On 08/01/2022 9:04 AM CEST Ashok Reddy  wrote:
> 
> 
> ---
> - hosts: all
>  become: true
>  become_method: sudo
>  gather_facts: true
>  tasks:
>  - name: rsync
>  ansible.posix.synchronize:
>  src: /root
>  dest: /root
>  delegate_to: hostname
> 
> 
> error:
> 
> 
> TASK [rsync] 
> **
> fatal: [ FAILED! => {"changed": false, "msg": "Failed to find required 
> executable \"rsync\" in paths: /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin"}
> fatal: [localhost -> ]: FAILED! => {"changed": false, "msg": "Could not 
> determine controller hostname for rsync to send to"}
> 
> PLAY RECAP 
> ***

my guess: Ansible detects that the host has no rsync installed, so the TASK can 
not be executed. 
So you'd you have to create a preceeding (package/yum/apt) TASK that makes sure 
rsync is installed on the hosts in order to make this work.

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


[ansible-project] rsync failure

2022-08-01 Thread Ashok Reddy
---
- hosts: all
  become: true
  become_method: sudo
  gather_facts: true
  tasks:
- name: rsync
  ansible.posix.synchronize:
src: /root
dest: /root
  delegate_to: hostname

error:


TASK [rsync] 
**
fatal: [ FAILED! => {"changed": false, "msg": "Failed to find required 
executable \"rsync\" in paths: 
/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin"}
fatal: [localhost -> ]: FAILED! => {"changed": false, "msg": "Could not 
determine controller hostname for rsync to send to"}

PLAY RECAP 
***

-- 
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/9a5b2c02-2146-4dd1-be1e-f6fcf2598940n%40googlegroups.com.


[ansible-project] failed instances

2022-08-01 Thread Ashok Reddy



---
- hosts: all
  become: true
  become_method: sudo
  gather_facts: false
  vars:
- failed: "{{ ansible_play_hosts_all | difference(ansible_play_hosts) 
}}"
  tasks:
- assert:
that: ok | bool
- debug:
var: _failed

error;

TASK [assert] 
*
fatal: [modsec-pakistan.tt040sqa3.dev.sicpa.io]: FAILED! => {"msg": "The 
conditional check 'ok | bool' failed. The error was: error while evaluating 
conditional (ok | bool): 'ok' is undefined"}
fatal: [localhost]: FAILED! => {"msg": "The conditional check 'ok | bool' 
failed. The error was: error while evaluating conditional (ok | bool): 'ok' 
is undefined"}

-- 
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/8f0640f3-5fa2-4e29-abcf-d320ccaffe2dn%40googlegroups.com.


Re: [ansible-project] Re: unsupported parameter for ios_l2_interfaces

2022-08-01 Thread Sagar Paul
Hi Hossein,

Thanks for sharing the details.
You may use "ansible-galaxy collection list ." to
figure out the collection version you are using.
You may raise an issue here
 for me to track
it better.

Regards,
Sagar Paul

On Sun, Jul 31, 2022 at 7:33 AM Hossein Malakooti <
hmalako...@tst-cfexpress.com> wrote:

> Hi PAul
>
> Sure , here is the 9200 version
>
> Cisco IOS XE Software, Version 17.03.04b
> Cisco IOS Software [Amsterdam], Catalyst L3 Switch Software
> (CAT9K_LITE_IOSXE),
>
> and here is the 2960X version
> Cisco IOS Software, C2960X Software (C2960X-UNIVERSALK9-M), Version
> 15.2(7)E5
>
> I'm abit new to ansible where can I find the Collector version ?
>
> Regards,
>
>
>
>
>
> On Sat, Jul 30, 2022 at 12:43 AM Sagar Paul  wrote:
>
>> Hi Hossein,
>>
>> Would you be able to help me with the collection version you are using
>> and the cisco ios version that both the devices have? Note the
>> currently supported version of the collection is 15.6.x we are planning to
>> upgrade to 17.4.x soon.
>>
>> Regards,
>> Sagar Paul
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Ansible Project" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/ansible-project/-Pui8AiMKmA/unsubscribe
>> .
>> To unsubscribe from this group and all its topics, 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/CAEs9WgaASKu5WxxqdVAVXBDJojX2AvUk_7JfGgn64jfG4P_23A%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/CABNDS_FxfZknfZQj7NM9PbgXzq0K-%3D3bXN4EuxEzNH-TJFPsgg%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/CAEs9WgZuGK%2Bs1fypbVVe5%3D_is8JO2NQwUJUDRgtBoU_KGFweTg%40mail.gmail.com.